From e2759b5bb58e0d7317a0afcbc49219781e6c31ae Mon Sep 17 00:00:00 2001
From: Ryan Smith <0ryansmith1994@gmail.com>
Date: Mon, 10 Aug 2015 14:15:57 +0100
Subject: [PATCH 01/35] Redirects to the intended route after login.
---
app/controllers/LoginController.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/LoginController.php b/app/controllers/LoginController.php
index f86812f397..5cfe7aeacc 100644
--- a/app/controllers/LoginController.php
+++ b/app/controllers/LoginController.php
@@ -20,7 +20,7 @@ public function login(){
$remember_me = Input::get('remember', 0);
if( Auth::attempt($creds, $remember_me) ){
- return Redirect::to('/');
+ return Redirect::intended('/');
}
return Redirect::route('login.create')
From f60753f3a127496ee4e809d7d3d060d1b9b4cb86 Mon Sep 17 00:00:00 2001
From: Ryan Smith <0ryansmith1994@gmail.com>
Date: Wed, 12 Aug 2015 12:44:42 +0100
Subject: [PATCH 02/35] Attempts to add Mongo sessions.
---
app/config/app.php | 5 +-
composer.json | 7 +-
composer.lock | 378 +++++++++++++++++++++++++--------------------
3 files changed, 220 insertions(+), 170 deletions(-)
diff --git a/app/config/app.php b/app/config/app.php
index 0c004a984e..5c224132f9 100644
--- a/app/config/app.php
+++ b/app/config/app.php
@@ -108,17 +108,18 @@
'Illuminate\Validation\ValidationServiceProvider',
'Illuminate\View\ViewServiceProvider',
'Illuminate\Workbench\WorkbenchServiceProvider',
+ 'Jenssegers\Mongodb\MongodbServiceProvider',
+ 'Jenssegers\Mongodb\Auth\ReminderServiceProvider',
+ 'Jenssegers\Mongodb\Session\SessionServiceProvider',
'Locker\Repository\RepositoryServiceProvider',
'Locker\Data\DataServiceProvider',
'Locker\Graphing\GraphServiceProvider',
- 'Jenssegers\Mongodb\MongodbServiceProvider',
'DaveJamesMiller\Breadcrumbs\ServiceProvider',
'Way\Generators\GeneratorsServiceProvider',
'Barryvdh\Cors\CorsServiceProvider',
'JsLocalization\JsLocalizationServiceProvider',
'locker\RequestServiceProvider',
'Philo\Translate\TranslateServiceProvider',
- 'Jenssegers\Mongodb\Auth\ReminderServiceProvider',
),
/*
diff --git a/composer.json b/composer.json
index ab27a16acd..25e8986c2b 100644
--- a/composer.json
+++ b/composer.json
@@ -32,8 +32,8 @@
}
],
"require": {
- "laravel/framework": "4.2.8",
- "jenssegers/mongodb": "1.4.x",
+ "laravel/framework": "4.2.x",
+ "jenssegers/mongodb": "2.0.x",
"davejamesmiller/laravel-breadcrumbs": "2.2.x",
"way/generators": "2.6.x",
"ramsey/array_column": "1.1.x",
@@ -42,7 +42,8 @@
"philo/laravel-translate": "1.0.x",
"learninglocker/statementfactory": "0.0.x",
"bshaffer/oauth2-server-php": "1.7.x",
- "bshaffer/oauth2-server-httpfoundation-bridge": "1.1.x"
+ "bshaffer/oauth2-server-httpfoundation-bridge": "1.1.x",
+ "jenssegers/mongodb-session": "~1.0"
},
"require-dev": {
"phpunit/phpunit": "4.1.*"
diff --git a/composer.lock b/composer.lock
index c8bcad095a..2aefb6ed90 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "hash": "bcdfb4af26f8bd68dcce2f1705632c89",
+ "hash": "5c3730d30a2f50f10a2943aa9f48ddcb",
"packages": [
{
"name": "andywer/js-localization",
@@ -200,16 +200,16 @@
},
{
"name": "bshaffer/oauth2-server-php",
- "version": "v1.7.0",
+ "version": "v1.7.1",
"source": {
"type": "git",
"url": "https://github.com/bshaffer/oauth2-server-php.git",
- "reference": "8878e192dcd3abb48d92b69a5d2cf75bcda4eb72"
+ "reference": "7fde34c417e0f6542dfbe6aedf8132eb5575acfb"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/bshaffer/oauth2-server-php/zipball/8878e192dcd3abb48d92b69a5d2cf75bcda4eb72",
- "reference": "8878e192dcd3abb48d92b69a5d2cf75bcda4eb72",
+ "url": "https://api.github.com/repos/bshaffer/oauth2-server-php/zipball/7fde34c417e0f6542dfbe6aedf8132eb5575acfb",
+ "reference": "7fde34c417e0f6542dfbe6aedf8132eb5575acfb",
"shasum": ""
},
"require": {
@@ -244,7 +244,7 @@
"oauth",
"oauth2"
],
- "time": "2015-04-24 03:00:33"
+ "time": "2015-05-21 20:07:03"
},
{
"name": "classpreloader/classpreloader",
@@ -377,16 +377,16 @@
},
{
"name": "filp/whoops",
- "version": "1.1.5",
+ "version": "1.1.7",
"source": {
"type": "git",
"url": "https://github.com/filp/whoops.git",
- "reference": "c982fe62c44798c433229cb0425c61b487cc1883"
+ "reference": "72538eeb70bbfb11964412a3d098d109efd012f7"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/filp/whoops/zipball/c982fe62c44798c433229cb0425c61b487cc1883",
- "reference": "c982fe62c44798c433229cb0425c61b487cc1883",
+ "url": "https://api.github.com/repos/filp/whoops/zipball/72538eeb70bbfb11964412a3d098d109efd012f7",
+ "reference": "72538eeb70bbfb11964412a3d098d109efd012f7",
"shasum": ""
},
"require": {
@@ -431,7 +431,7 @@
"whoops",
"zf2"
],
- "time": "2015-03-30 15:26:59"
+ "time": "2015-06-29 05:42:04"
},
{
"name": "ircmaxell/password-compat",
@@ -477,16 +477,16 @@
},
{
"name": "jenssegers/mongodb",
- "version": "v1.4.3",
+ "version": "v2.0.5",
"source": {
"type": "git",
"url": "https://github.com/jenssegers/laravel-mongodb.git",
- "reference": "7534e6f999fca65c208559998d593769a53d5160"
+ "reference": "3cd44d09ee2a42ec3f74cd14e793ff9ae10cae43"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/jenssegers/laravel-mongodb/zipball/7534e6f999fca65c208559998d593769a53d5160",
- "reference": "7534e6f999fca65c208559998d593769a53d5160",
+ "url": "https://api.github.com/repos/jenssegers/laravel-mongodb/zipball/3cd44d09ee2a42ec3f74cd14e793ff9ae10cae43",
+ "reference": "3cd44d09ee2a42ec3f74cd14e793ff9ae10cae43",
"shasum": ""
},
"require": {
@@ -531,7 +531,52 @@
"mongo",
"mongodb"
],
- "time": "2014-08-06 14:21:53"
+ "time": "2015-03-22 20:45:06"
+ },
+ {
+ "name": "jenssegers/mongodb-session",
+ "version": "v1.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/jenssegers/laravel-mongodb-session.git",
+ "reference": "45d9ec0032971221070a2021c17f4f5403f5f466"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/jenssegers/laravel-mongodb-session/zipball/45d9ec0032971221070a2021c17f4f5403f5f466",
+ "reference": "45d9ec0032971221070a2021c17f4f5403f5f466",
+ "shasum": ""
+ },
+ "require": {
+ "illuminate/session": "4.*|5.*",
+ "jenssegers/mongodb": "*",
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-0": {
+ "Jenssegers\\Mongodb\\Session": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jens Segers",
+ "homepage": "http://jenssegers.be"
+ }
+ ],
+ "description": "A MongoDB session driver for Laravel 4",
+ "keywords": [
+ "driver",
+ "laravel",
+ "mongo",
+ "mongodb",
+ "session"
+ ],
+ "time": "2015-01-30 14:14:09"
},
{
"name": "jeremeamia/SuperClosure",
@@ -583,27 +628,27 @@
},
{
"name": "laravel/framework",
- "version": "v4.2.8",
+ "version": "v4.2.17",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
- "reference": "e60ea917ab862254a6db37fa9cb8933138c1e73c"
+ "reference": "3359de6d6cd322e8a1b251c2f8d9dd42a3e4e232"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/laravel/framework/zipball/e60ea917ab862254a6db37fa9cb8933138c1e73c",
- "reference": "e60ea917ab862254a6db37fa9cb8933138c1e73c",
+ "url": "https://api.github.com/repos/laravel/framework/zipball/3359de6d6cd322e8a1b251c2f8d9dd42a3e4e232",
+ "reference": "3359de6d6cd322e8a1b251c2f8d9dd42a3e4e232",
"shasum": ""
},
"require": {
- "classpreloader/classpreloader": "~1.0",
+ "classpreloader/classpreloader": "~1.0.2",
"d11wtq/boris": "~1.0",
"filp/whoops": "1.1.*",
"ircmaxell/password-compat": "~1.0",
- "jeremeamia/superclosure": "~1.0",
+ "jeremeamia/superclosure": "~1.0.1",
"monolog/monolog": "~1.6",
"nesbot/carbon": "~1.0",
- "patchwork/utf8": "1.1.*",
+ "patchwork/utf8": "~1.1",
"php": ">=5.4.0",
"phpseclib/phpseclib": "0.3.*",
"predis/predis": "0.8.*",
@@ -694,7 +739,7 @@
"framework",
"laravel"
],
- "time": "2014-08-05 19:52:17"
+ "time": "2015-02-11 20:37:15"
},
{
"name": "learninglocker/statementfactory",
@@ -731,16 +776,16 @@
},
{
"name": "monolog/monolog",
- "version": "1.13.1",
+ "version": "1.16.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
- "reference": "c31a2c4e8db5da8b46c74cf275d7f109c0f249ac"
+ "reference": "c0c0b4bee3aabce7182876b0d912ef2595563db7"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Seldaek/monolog/zipball/c31a2c4e8db5da8b46c74cf275d7f109c0f249ac",
- "reference": "c31a2c4e8db5da8b46c74cf275d7f109c0f249ac",
+ "url": "https://api.github.com/repos/Seldaek/monolog/zipball/c0c0b4bee3aabce7182876b0d912ef2595563db7",
+ "reference": "c0c0b4bee3aabce7182876b0d912ef2595563db7",
"shasum": ""
},
"require": {
@@ -751,12 +796,14 @@
"psr/log-implementation": "1.0.0"
},
"require-dev": {
- "aws/aws-sdk-php": "~2.4, >2.4.8",
+ "aws/aws-sdk-php": "^2.4.9",
"doctrine/couchdb": "~1.0@dev",
"graylog2/gelf-php": "~1.0",
- "phpunit/phpunit": "~4.0",
- "raven/raven": "~0.5",
- "ruflin/elastica": "0.90.*",
+ "php-console/php-console": "^3.1.3",
+ "phpunit/phpunit": "~4.5",
+ "phpunit/phpunit-mock-objects": "2.3.0",
+ "raven/raven": "~0.8",
+ "ruflin/elastica": ">=0.90 <3.0",
"swiftmailer/swiftmailer": "~5.3",
"videlalvaro/php-amqplib": "~2.4"
},
@@ -766,6 +813,7 @@
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
"ext-mongo": "Allow sending log messages to a MongoDB server",
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
+ "php-console/php-console": "Allow sending log messages to Google Chrome",
"raven/raven": "Allow sending log messages to a Sentry server",
"rollbar/rollbar": "Allow sending log messages to Rollbar",
"ruflin/elastica": "Allow sending log messages to an Elastic Search server",
@@ -774,7 +822,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.13.x-dev"
+ "dev-master": "1.16.x-dev"
}
},
"autoload": {
@@ -800,7 +848,7 @@
"logging",
"psr-3"
],
- "time": "2015-03-09 09:58:04"
+ "time": "2015-08-09 17:44:44"
},
{
"name": "nesbot/carbon",
@@ -895,16 +943,16 @@
},
{
"name": "patchwork/utf8",
- "version": "v1.1.29",
+ "version": "v1.2.3",
"source": {
"type": "git",
"url": "https://github.com/tchwork/utf8.git",
- "reference": "65b19607048351f767a034d4cc709db8b136d2c5"
+ "reference": "a7a9a987d01d052ff9c99510ecbd07ebc6c270f2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/tchwork/utf8/zipball/65b19607048351f767a034d4cc709db8b136d2c5",
- "reference": "65b19607048351f767a034d4cc709db8b136d2c5",
+ "url": "https://api.github.com/repos/tchwork/utf8/zipball/a7a9a987d01d052ff9c99510ecbd07ebc6c270f2",
+ "reference": "a7a9a987d01d052ff9c99510ecbd07ebc6c270f2",
"shasum": ""
},
"require": {
@@ -914,15 +962,23 @@
"suggest": {
"ext-iconv": "Use iconv for best performance",
"ext-intl": "Use Intl for best performance",
- "ext-mbstring": "Use Mbstring for best performance"
+ "ext-mbstring": "Use Mbstring for best performance",
+ "ext-wfio": "Use WFIO for UTF-8 filesystem access on Windows"
},
"type": "library",
- "autoload": {
- "psr-0": {
- "Patchwork": "class/",
- "Normalizer": "class/"
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.2-dev"
}
},
+ "autoload": {
+ "psr-4": {
+ "Patchwork\\": "src/Patchwork/"
+ },
+ "classmap": [
+ "src/Normalizer.php"
+ ]
+ },
"notification-url": "https://packagist.org/downloads/",
"license": [
"(Apache-2.0 or GPL-2.0)"
@@ -942,7 +998,7 @@
"utf-8",
"utf8"
],
- "time": "2015-04-26 09:48:22"
+ "time": "2015-06-25 08:17:49"
},
{
"name": "philo/laravel-translate",
@@ -1269,23 +1325,23 @@
},
{
"name": "swiftmailer/swiftmailer",
- "version": "v5.4.0",
+ "version": "v5.4.1",
"source": {
"type": "git",
"url": "https://github.com/swiftmailer/swiftmailer.git",
- "reference": "31454f258f10329ae7c48763eb898a75c39e0a9f"
+ "reference": "0697e6aa65c83edf97bb0f23d8763f94e3f11421"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/31454f258f10329ae7c48763eb898a75c39e0a9f",
- "reference": "31454f258f10329ae7c48763eb898a75c39e0a9f",
+ "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/0697e6aa65c83edf97bb0f23d8763f94e3f11421",
+ "reference": "0697e6aa65c83edf97bb0f23d8763f94e3f11421",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
- "mockery/mockery": "~0.9.1"
+ "mockery/mockery": "~0.9.1,<0.9.4"
},
"type": "library",
"extra": {
@@ -1314,14 +1370,15 @@
"description": "Swiftmailer, free feature-rich PHP mailer",
"homepage": "http://swiftmailer.org",
"keywords": [
+ "email",
"mail",
"mailer"
],
- "time": "2015-03-14 06:06:39"
+ "time": "2015-06-06 14:19:39"
},
{
"name": "symfony/browser-kit",
- "version": "v2.5.11",
+ "version": "v2.5.12",
"target-dir": "Symfony/Component/BrowserKit",
"source": {
"type": "git",
@@ -1376,7 +1433,7 @@
},
{
"name": "symfony/console",
- "version": "v2.5.11",
+ "version": "v2.5.12",
"target-dir": "Symfony/Component/Console",
"source": {
"type": "git",
@@ -1431,7 +1488,7 @@
},
{
"name": "symfony/css-selector",
- "version": "v2.5.11",
+ "version": "v2.5.12",
"target-dir": "Symfony/Component/CssSelector",
"source": {
"type": "git",
@@ -1482,7 +1539,7 @@
},
{
"name": "symfony/debug",
- "version": "v2.5.11",
+ "version": "v2.5.12",
"target-dir": "Symfony/Component/Debug",
"source": {
"type": "git",
@@ -1541,7 +1598,7 @@
},
{
"name": "symfony/dom-crawler",
- "version": "v2.5.11",
+ "version": "v2.5.12",
"target-dir": "Symfony/Component/DomCrawler",
"source": {
"type": "git",
@@ -1594,21 +1651,20 @@
},
{
"name": "symfony/event-dispatcher",
- "version": "v2.6.6",
- "target-dir": "Symfony/Component/EventDispatcher",
+ "version": "v2.7.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/EventDispatcher.git",
- "reference": "70f7c8478739ad21e3deef0d977b38c77f1fb284"
+ "reference": "9310b5f9a87ec2ea75d20fec0b0017c77c66dac3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/70f7c8478739ad21e3deef0d977b38c77f1fb284",
- "reference": "70f7c8478739ad21e3deef0d977b38c77f1fb284",
+ "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/9310b5f9a87ec2ea75d20fec0b0017c77c66dac3",
+ "reference": "9310b5f9a87ec2ea75d20fec0b0017c77c66dac3",
"shasum": ""
},
"require": {
- "php": ">=5.3.3"
+ "php": ">=5.3.9"
},
"require-dev": {
"psr/log": "~1.0",
@@ -1625,11 +1681,11 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.6-dev"
+ "dev-master": "2.7-dev"
}
},
"autoload": {
- "psr-0": {
+ "psr-4": {
"Symfony\\Component\\EventDispatcher\\": ""
}
},
@@ -1638,36 +1694,35 @@
"MIT"
],
"authors": [
- {
- "name": "Symfony Community",
- "homepage": "http://symfony.com/contributors"
- },
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony EventDispatcher Component",
- "homepage": "http://symfony.com",
- "time": "2015-03-13 17:37:22"
+ "homepage": "https://symfony.com",
+ "time": "2015-06-18 19:21:56"
},
{
"name": "symfony/filesystem",
- "version": "v2.6.6",
- "target-dir": "Symfony/Component/Filesystem",
+ "version": "v2.7.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/Filesystem.git",
- "reference": "4983964b3693e4f13449cb3800c64a9112c301b4"
+ "reference": "2d7b2ddaf3f548f4292df49a99d19c853d43f0b8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Filesystem/zipball/4983964b3693e4f13449cb3800c64a9112c301b4",
- "reference": "4983964b3693e4f13449cb3800c64a9112c301b4",
+ "url": "https://api.github.com/repos/symfony/Filesystem/zipball/2d7b2ddaf3f548f4292df49a99d19c853d43f0b8",
+ "reference": "2d7b2ddaf3f548f4292df49a99d19c853d43f0b8",
"shasum": ""
},
"require": {
- "php": ">=5.3.3"
+ "php": ">=5.3.9"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
@@ -1675,11 +1730,11 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.6-dev"
+ "dev-master": "2.7-dev"
}
},
"autoload": {
- "psr-0": {
+ "psr-4": {
"Symfony\\Component\\Filesystem\\": ""
}
},
@@ -1688,22 +1743,22 @@
"MIT"
],
"authors": [
- {
- "name": "Symfony Community",
- "homepage": "http://symfony.com/contributors"
- },
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Filesystem Component",
- "homepage": "http://symfony.com",
- "time": "2015-03-22 16:55:57"
+ "homepage": "https://symfony.com",
+ "time": "2015-07-09 16:07:40"
},
{
"name": "symfony/finder",
- "version": "v2.5.11",
+ "version": "v2.5.12",
"target-dir": "Symfony/Component/Finder",
"source": {
"type": "git",
@@ -1750,7 +1805,7 @@
},
{
"name": "symfony/http-foundation",
- "version": "v2.5.11",
+ "version": "v2.5.12",
"target-dir": "Symfony/Component/HttpFoundation",
"source": {
"type": "git",
@@ -1803,17 +1858,17 @@
},
{
"name": "symfony/http-kernel",
- "version": "v2.5.11",
+ "version": "v2.5.12",
"target-dir": "Symfony/Component/HttpKernel",
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpKernel.git",
- "reference": "7b1632cf2bdbc69c59a44942b70d5aae91034304"
+ "reference": "31652385d94eafc2103a98435d6d5bd7eea61736"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/7b1632cf2bdbc69c59a44942b70d5aae91034304",
- "reference": "7b1632cf2bdbc69c59a44942b70d5aae91034304",
+ "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/31652385d94eafc2103a98435d6d5bd7eea61736",
+ "reference": "31652385d94eafc2103a98435d6d5bd7eea61736",
"shasum": ""
},
"require": {
@@ -1873,11 +1928,11 @@
],
"description": "Symfony HttpKernel Component",
"homepage": "http://symfony.com",
- "time": "2015-04-01 16:01:45"
+ "time": "2015-05-26 23:43:20"
},
{
"name": "symfony/process",
- "version": "v2.5.11",
+ "version": "v2.5.12",
"target-dir": "Symfony/Component/Process",
"source": {
"type": "git",
@@ -1924,7 +1979,7 @@
},
{
"name": "symfony/routing",
- "version": "v2.5.11",
+ "version": "v2.5.12",
"target-dir": "Symfony/Component/Routing",
"source": {
"type": "git",
@@ -1992,7 +2047,7 @@
},
{
"name": "symfony/security-core",
- "version": "v2.5.11",
+ "version": "v2.5.12",
"target-dir": "Symfony/Component/Security/Core",
"source": {
"type": "git",
@@ -2055,7 +2110,7 @@
},
{
"name": "symfony/translation",
- "version": "v2.5.11",
+ "version": "v2.5.12",
"target-dir": "Symfony/Component/Translation",
"source": {
"type": "git",
@@ -2161,16 +2216,16 @@
"packages-dev": [
{
"name": "phpunit/php-code-coverage",
- "version": "2.0.16",
+ "version": "2.2.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
- "reference": "934fd03eb6840508231a7f73eb8940cf32c3b66c"
+ "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/934fd03eb6840508231a7f73eb8940cf32c3b66c",
- "reference": "934fd03eb6840508231a7f73eb8940cf32c3b66c",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2d7c03c0e4e080901b8f33b2897b0577be18a13c",
+ "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c",
"shasum": ""
},
"require": {
@@ -2178,7 +2233,7 @@
"phpunit/php-file-iterator": "~1.3",
"phpunit/php-text-template": "~1.2",
"phpunit/php-token-stream": "~1.3",
- "sebastian/environment": "~1.0",
+ "sebastian/environment": "^1.3.2",
"sebastian/version": "~1.0"
},
"require-dev": {
@@ -2193,7 +2248,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.0.x-dev"
+ "dev-master": "2.2.x-dev"
}
},
"autoload": {
@@ -2219,7 +2274,7 @@
"testing",
"xunit"
],
- "time": "2015-04-11 04:35:00"
+ "time": "2015-08-04 03:42:39"
},
{
"name": "phpunit/php-file-iterator",
@@ -2268,16 +2323,16 @@
},
{
"name": "phpunit/php-text-template",
- "version": "1.2.0",
+ "version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-text-template.git",
- "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a"
+ "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a",
- "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
+ "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
"shasum": ""
},
"require": {
@@ -2286,20 +2341,17 @@
"type": "library",
"autoload": {
"classmap": [
- "Text/"
+ "src/"
]
},
"notification-url": "https://packagist.org/downloads/",
- "include-path": [
- ""
- ],
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
- "email": "sb@sebastian-bergmann.de",
+ "email": "sebastian@phpunit.de",
"role": "lead"
}
],
@@ -2308,20 +2360,20 @@
"keywords": [
"template"
],
- "time": "2014-01-30 17:20:04"
+ "time": "2015-06-21 13:50:34"
},
{
"name": "phpunit/php-timer",
- "version": "1.0.5",
+ "version": "1.0.7",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-timer.git",
- "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c"
+ "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
- "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b",
+ "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b",
"shasum": ""
},
"require": {
@@ -2330,13 +2382,10 @@
"type": "library",
"autoload": {
"classmap": [
- "PHP/"
+ "src/"
]
},
"notification-url": "https://packagist.org/downloads/",
- "include-path": [
- ""
- ],
"license": [
"BSD-3-Clause"
],
@@ -2352,20 +2401,20 @@
"keywords": [
"timer"
],
- "time": "2013-08-02 07:42:54"
+ "time": "2015-06-21 08:01:12"
},
{
"name": "phpunit/php-token-stream",
- "version": "1.4.1",
+ "version": "1.4.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
- "reference": "eab81d02569310739373308137284e0158424330"
+ "reference": "7a9b0969488c3c54fd62b4d504b3ec758fd005d9"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/eab81d02569310739373308137284e0158424330",
- "reference": "eab81d02569310739373308137284e0158424330",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/7a9b0969488c3c54fd62b4d504b3ec758fd005d9",
+ "reference": "7a9b0969488c3c54fd62b4d504b3ec758fd005d9",
"shasum": ""
},
"require": {
@@ -2401,7 +2450,7 @@
"keywords": [
"tokenizer"
],
- "time": "2015-04-08 04:46:07"
+ "time": "2015-06-19 03:43:16"
},
{
"name": "phpunit/phpunit",
@@ -2536,16 +2585,16 @@
},
{
"name": "sebastian/comparator",
- "version": "1.1.1",
+ "version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
- "reference": "1dd8869519a225f7f2b9eb663e225298fade819e"
+ "reference": "937efb279bd37a375bcadf584dec0726f84dbf22"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dd8869519a225f7f2b9eb663e225298fade819e",
- "reference": "1dd8869519a225f7f2b9eb663e225298fade819e",
+ "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22",
+ "reference": "937efb279bd37a375bcadf584dec0726f84dbf22",
"shasum": ""
},
"require": {
@@ -2559,7 +2608,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.1.x-dev"
+ "dev-master": "1.2.x-dev"
}
},
"autoload": {
@@ -2596,7 +2645,7 @@
"compare",
"equality"
],
- "time": "2015-01-29 16:28:08"
+ "time": "2015-07-26 15:48:44"
},
{
"name": "sebastian/diff",
@@ -2652,16 +2701,16 @@
},
{
"name": "sebastian/environment",
- "version": "1.2.2",
+ "version": "1.3.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
- "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e"
+ "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5a8c7d31914337b69923db26c4221b81ff5a196e",
- "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e",
+ "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44",
+ "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44",
"shasum": ""
},
"require": {
@@ -2698,20 +2747,20 @@
"environment",
"hhvm"
],
- "time": "2015-01-01 10:01:08"
+ "time": "2015-08-03 06:14:51"
},
{
"name": "sebastian/exporter",
- "version": "1.2.0",
+ "version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git",
- "reference": "84839970d05254c73cde183a721c7af13aede943"
+ "reference": "7ae5513327cb536431847bcc0c10edba2701064e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/84839970d05254c73cde183a721c7af13aede943",
- "reference": "84839970d05254c73cde183a721c7af13aede943",
+ "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e",
+ "reference": "7ae5513327cb536431847bcc0c10edba2701064e",
"shasum": ""
},
"require": {
@@ -2764,20 +2813,20 @@
"export",
"exporter"
],
- "time": "2015-01-27 07:23:06"
+ "time": "2015-06-21 07:55:53"
},
{
"name": "sebastian/recursion-context",
- "version": "1.0.0",
+ "version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/recursion-context.git",
- "reference": "3989662bbb30a29d20d9faa04a846af79b276252"
+ "reference": "994d4a811bafe801fb06dccbee797863ba2792ba"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/3989662bbb30a29d20d9faa04a846af79b276252",
- "reference": "3989662bbb30a29d20d9faa04a846af79b276252",
+ "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba",
+ "reference": "994d4a811bafe801fb06dccbee797863ba2792ba",
"shasum": ""
},
"require": {
@@ -2817,20 +2866,20 @@
],
"description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
- "time": "2015-01-24 09:48:32"
+ "time": "2015-06-21 08:04:50"
},
{
"name": "sebastian/version",
- "version": "1.0.5",
+ "version": "1.0.6",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/version.git",
- "reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4"
+ "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/ab931d46cd0d3204a91e1b9a40c4bc13032b58e4",
- "reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4",
+ "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
+ "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
"shasum": ""
},
"type": "library",
@@ -2852,25 +2901,24 @@
],
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version",
- "time": "2015-02-24 06:35:25"
+ "time": "2015-06-21 13:59:46"
},
{
"name": "symfony/yaml",
- "version": "v2.6.6",
- "target-dir": "Symfony/Component/Yaml",
+ "version": "v2.7.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml.git",
- "reference": "174f009ed36379a801109955fc5a71a49fe62dd4"
+ "reference": "71340e996171474a53f3d29111d046be4ad8a0ff"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Yaml/zipball/174f009ed36379a801109955fc5a71a49fe62dd4",
- "reference": "174f009ed36379a801109955fc5a71a49fe62dd4",
+ "url": "https://api.github.com/repos/symfony/Yaml/zipball/71340e996171474a53f3d29111d046be4ad8a0ff",
+ "reference": "71340e996171474a53f3d29111d046be4ad8a0ff",
"shasum": ""
},
"require": {
- "php": ">=5.3.3"
+ "php": ">=5.3.9"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
@@ -2878,11 +2926,11 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.6-dev"
+ "dev-master": "2.7-dev"
}
},
"autoload": {
- "psr-0": {
+ "psr-4": {
"Symfony\\Component\\Yaml\\": ""
}
},
@@ -2891,18 +2939,18 @@
"MIT"
],
"authors": [
- {
- "name": "Symfony Community",
- "homepage": "http://symfony.com/contributors"
- },
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Yaml Component",
- "homepage": "http://symfony.com",
- "time": "2015-03-30 15:54:10"
+ "homepage": "https://symfony.com",
+ "time": "2015-07-28 14:07:07"
}
],
"aliases": [],
From 31b867eb066f3eeacc248aa23758deb4c3f524f8 Mon Sep 17 00:00:00 2001
From: Ryan Smith <0ryansmith1994@gmail.com>
Date: Thu, 13 Aug 2015 10:03:50 +0100
Subject: [PATCH 03/35] Begins migration of foreign keys.
---
...08_12_150203_ConsistentForeignKeyNames.php | 45 +++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 app/database/migrations/2015_08_12_150203_ConsistentForeignKeyNames.php
diff --git a/app/database/migrations/2015_08_12_150203_ConsistentForeignKeyNames.php b/app/database/migrations/2015_08_12_150203_ConsistentForeignKeyNames.php
new file mode 100644
index 0000000000..efd676a652
--- /dev/null
+++ b/app/database/migrations/2015_08_12_150203_ConsistentForeignKeyNames.php
@@ -0,0 +1,45 @@
+chunkKeyRenaming(new DocumentAPI, 'lrs', 'lrs_id');
+ $this->chunkKeyRenaming(new Statement, 'lrs._id', 'lrs_id');
+ $this->chunkKeyRenaming(new Lrs, 'owner._id', 'owner_id');
+ $this->chunkKeyRenaming(new Report, 'lrs', 'lrs_id');
+ $this->chunkKeyRenaming(new Export, 'lrs', 'lrs_id');
+ }
+
+ public function down() {
+ }
+
+ private function renameKeyOnModel($model, $old_name, $new_name) {
+ $value = array_reduce(explode('.', $old_name), function ($value, $key) {
+ return is_object($value) ? $value->{$key} : $value[$key];
+ }, $model);
+ //$model->$new_name = new \MongoId($value);
+ $model->$new_name = $value;
+ $model->save();
+ }
+
+ private function renameKeyOnModels($models, $old_name, $new_name) {
+ foreach ($models as $model){
+ $this->renameKeyOnModel($model, $old_name, $new_name);
+ }
+ echo count($models) . ' converted.'.PHP_EOL;
+ }
+
+ private function chunkKeyRenaming($model, $old_name, $new_name) {
+ $this->chunkModelMigration($model, function($documents) use ($old_name, $new_name) {
+ $this->renameKeyOnModels($documents, $old_name, $new_name);
+ });
+ }
+
+ private function chunkModelMigration($model, Callable $migration) {
+ $model->chunk(1000, $migration);
+ echo 'All finished, hopefully!'.PHP_EOL;
+ }
+
+}
From c4f8711f426761cebee86d686306c9551371eddb Mon Sep 17 00:00:00 2001
From: Ryan Smith <0ryansmith1994@gmail.com>
Date: Thu, 13 Aug 2015 11:42:23 +0100
Subject: [PATCH 04/35] Refactors to lrs_id.
---
app/locker/data/dashboards/LrsDashboard.php | 14 +++++------
app/locker/data/reporting/getActivities.php | 2 +-
app/locker/data/reporting/getContext.php | 2 +-
app/locker/data/reporting/getVerbs.php | 2 +-
.../repository/Base/EloquentRepository.php | 2 +-
.../Document/EloquentDocumentRepository.php | 23 +++++++++++--------
.../repository/Export/EloquentRepository.php | 2 +-
.../repository/Lrs/EloquentRepository.php | 2 +-
.../Query/EloquentQueryRepository.php | 10 ++++----
.../repository/Report/EloquentRepository.php | 6 ++---
.../repository/Statement/EloquentInserter.php | 3 ++-
.../repository/Statement/EloquentReader.php | 2 +-
app/models/DocumentAPI.php | 4 ++--
app/models/Export.php | 2 +-
app/models/Report.php | 17 ++++++++------
app/models/Statement.php | 2 +-
app/tests/StatementsTestCase.php | 2 +-
app/tests/routes/ExportsTest.php | 2 +-
app/tests/routes/ResourcesTestCase.php | 2 +-
app/tests/routes/StatementAttachmentTest.php | 4 ++--
app/tests/routes/StatementRefTest.php | 2 +-
.../partials/reporting/statements.blade.php | 4 ++--
.../site/backbone/templates.blade.php | 2 +-
23 files changed, 60 insertions(+), 53 deletions(-)
diff --git a/app/locker/data/dashboards/LrsDashboard.php b/app/locker/data/dashboards/LrsDashboard.php
index 063a1b5eb4..53f527d765 100644
--- a/app/locker/data/dashboards/LrsDashboard.php
+++ b/app/locker/data/dashboards/LrsDashboard.php
@@ -39,7 +39,7 @@ public function getGraphData(\DateTime $startDate = null, \DateTime $endDate = n
**/
public function statementCount(){
return \DB::collection('statements')
- ->where('lrs._id', $this->lrs)
+ ->where('lrs_id', $this->lrs)
->remember(5)
->count();
}
@@ -55,25 +55,25 @@ public function actorCount(){
$count_array = ['mbox' => '', 'openid' => '', 'mbox_sha1sum' => '', 'account' => ''];
$count_array['mbox'] = $this->db->statements->aggregate([
- ['$match' => ['lrs._id' => $this->lrs, 'statement.actor.mbox' => ['$exists' => true]]],
+ ['$match' => ['lrs_id' => $this->lrs, 'statement.actor.mbox' => ['$exists' => true]]],
['$group' => ['_id' => '$statement.actor.mbox']],
['$group' => ['_id' => 1, 'count' => ['$sum' => 1]]]
]);
$count_array['openid'] = $this->db->statements->aggregate([
- ['$match' => ['lrs._id' => $this->lrs, 'statement.actor.openid' => ['$exists' => true]]],
+ ['$match' => ['lrs_id' => $this->lrs, 'statement.actor.openid' => ['$exists' => true]]],
['$group' => ['_id' => '$statement.actor.openid']],
['$group' => ['_id' => 1, 'count' => ['$sum' => 1]]]
]);
$count_array['mbox_sha1sum'] = $this->db->statements->aggregate([
- ['$match' => ['lrs._id' => $this->lrs, 'statement.actor.mbox_sha1sum' => ['$exists' => true]]],
+ ['$match' => ['lrs_id' => $this->lrs, 'statement.actor.mbox_sha1sum' => ['$exists' => true]]],
['$group' => ['_id' => '$statement.actor.mbox_sha1sum']],
['$group' => ['_id' => 1, 'count' => ['$sum' => 1]]]
]);
$count_array['account'] = $this->db->statements->aggregate([
- ['$match' => ['lrs._id' => $this->lrs, 'statement.actor.account' => ['$exists' => true]]],
+ ['$match' => ['lrs_id' => $this->lrs, 'statement.actor.account' => ['$exists' => true]]],
['$group' => ['_id' => ['accountName' => '$statement.actor.account.name', 'accountHomePage' => '$statement.actor.account.homePage']]],
['$group' => ['_id' => 1, 'count' => ['$sum' => 1]]]
]);
@@ -96,7 +96,7 @@ public function actorCount(){
**/
private function statementDays(){
$firstStatement = \DB::collection('statements')
- ->where('lrs._id', $this->lrs)
+ ->where('lrs_id', $this->lrs)
->orderBy("timestamp")->first();
if($firstStatement) {
@@ -198,7 +198,7 @@ public function getStatementNumbersByDate(\DateTime $startDate = null, \DateTime
[
'$match' => [
'timestamp' => $timestamp,
- 'lrs._id' => $this->lrs
+ 'lrs_id' => $this->lrs
]
],
[
diff --git a/app/locker/data/reporting/getActivities.php b/app/locker/data/reporting/getActivities.php
index 5f74eede84..58af289582 100644
--- a/app/locker/data/reporting/getActivities.php
+++ b/app/locker/data/reporting/getActivities.php
@@ -6,7 +6,7 @@ public function __construct(){}
public function getActivities( $lrs ){
- return \Statement::where('lrs._id', $lrs)
+ return \Statement::where('lrs_id', $lrs)
->where('statement.object.objectType', 'Activity')
->select('statement.object.definition.type')
->distinct()
diff --git a/app/locker/data/reporting/getContext.php b/app/locker/data/reporting/getContext.php
index de3a0cdc2d..a0c180e0f0 100644
--- a/app/locker/data/reporting/getContext.php
+++ b/app/locker/data/reporting/getContext.php
@@ -18,7 +18,7 @@ public function getContextInstructors( $lrs ){
private function setSelect( $lrs, $select ){
- return \Statement::where('lrs._id', $lrs)
+ return \Statement::where('lrs_id', $lrs)
->select( $select )
->distinct()
->remember(15)
diff --git a/app/locker/data/reporting/getVerbs.php b/app/locker/data/reporting/getVerbs.php
index cac133ac80..16224a6b38 100644
--- a/app/locker/data/reporting/getVerbs.php
+++ b/app/locker/data/reporting/getVerbs.php
@@ -5,7 +5,7 @@ class getVerbs {
public function __construct(){}
public function getVerbs( $lrs ){
- $verbs = \Statement::where('lrs._id', $lrs)
+ $verbs = \Statement::where('lrs_id', $lrs)
->select('statement.verb')
->distinct()
->remember(15)
diff --git a/app/locker/repository/Base/EloquentRepository.php b/app/locker/repository/Base/EloquentRepository.php
index 97744faacb..06ecd61862 100644
--- a/app/locker/repository/Base/EloquentRepository.php
+++ b/app/locker/repository/Base/EloquentRepository.php
@@ -14,7 +14,7 @@ abstract protected function constructStore(Model $model, array $data, array $opt
* @return \Jenssegers\Mongodb\Eloquent\Builder
*/
protected function where(array $opts) {
- return (new $this->model)->where('lrs', $opts['lrs_id']);
+ return (new $this->model)->where('lrs_id', $opts['lrs_id']);
}
/**
diff --git a/app/locker/repository/Document/EloquentDocumentRepository.php b/app/locker/repository/Document/EloquentDocumentRepository.php
index e078374e0c..9e887de0e7 100644
--- a/app/locker/repository/Document/EloquentDocumentRepository.php
+++ b/app/locker/repository/Document/EloquentDocumentRepository.php
@@ -167,7 +167,7 @@ private function filterScopes($options, $scope, $read = true) {
public function allStateDocs( $options, $activityId, $agent, $registration, $since, $get ){
$this->filterScopes($options, 'state');
- $query = $this->documentapi->where('lrs', $options['lrs_id'])
+ $query = $this->documentapi->where('lrs_id', $options['lrs_id'])
->where('documentType', DocumentType::STATE)
->where('activityId', $activityId);
@@ -201,7 +201,7 @@ public function allStateDocs( $options, $activityId, $agent, $registration, $si
public function findStateDoc( $options, $stateId, $activityId, $agent, $registration, $get ){
$this->filterScopes($options, 'state');
- $query = $this->documentapi->where('lrs', $options['lrs_id'])
+ $query = $this->documentapi->where('lrs_id', $options['lrs_id'])
->where('documentType', DocumentType::STATE)
->where('activityId', $activityId)
->where('identId', $stateId);
@@ -249,8 +249,9 @@ public function storeStateDoc( $options, $data, $updated, $method ){
$document = $this->documentapi;
//LL vars
- $document->lrs = $options['lrs_id']; //LL specific
- $document->documentType = DocumentType::STATE; //LL specific
+ $document->lrs = $options['lrs_id']; // Deprected.
+ $document->lrs_id = $options['lrs_id'];
+ $document->documentType = DocumentType::STATE;
//AP vars
$document->identId = $data['stateId'];
@@ -290,7 +291,7 @@ public function storeStateDoc( $options, $data, $updated, $method ){
public function allActivityDocs( $options, $activityId, $since, $get ){
$this->filterScopes($options, 'profile');
- $query = $this->documentapi->where('lrs', $options['lrs_id'])
+ $query = $this->documentapi->where('lrs_id', $options['lrs_id'])
->where('documentType', DocumentType::ACTIVITY)
->where('activityId', $activityId);
@@ -319,7 +320,7 @@ public function allActivityDocs( $options, $activityId, $since, $get ){
public function findActivityDoc( $options, $profileId, $activityId, $get ){
$this->filterScopes($options, 'profile');
- $query = $this->documentapi->where('lrs', $options['lrs_id'])
+ $query = $this->documentapi->where('lrs_id', $options['lrs_id'])
->where('documentType', DocumentType::ACTIVITY)
->where('activityId', $activityId)
->where('identId', $profileId);
@@ -372,7 +373,8 @@ public function storeActivityDoc( $options, $data, $updated, $method ){
$document = $this->documentapi;
//LL vars
- $document->lrs = $options['lrs_id']; //LL specific
+ $document->lrs = $options['lrs_id']; // Deprected.
+ $document->lrs_id = $options['lrs_id'];
$document->documentType = DocumentType::ACTIVITY; //LL specific
//AP vars
@@ -412,7 +414,7 @@ public function storeActivityDoc( $options, $data, $updated, $method ){
public function allAgentDocs( $options, $agent, $since, $get ){
$this->filterScopes($options, 'profile');
- $query = $this->documentapi->where('lrs', $options['lrs_id'])
+ $query = $this->documentapi->where('lrs_id', $options['lrs_id'])
->where('documentType', DocumentType::AGENT);
$query = $this->setQueryAgent( $query, $agent );
@@ -443,7 +445,7 @@ public function allAgentDocs( $options, $agent, $since, $get ){
public function findAgentDoc( $options, $profileId, $agent, $get ){
$this->filterScopes($options, 'profile');
- $query = $this->documentapi->where('lrs', $options['lrs_id'])
+ $query = $this->documentapi->where('lrs_id', $options['lrs_id'])
->where('documentType', DocumentType::AGENT)
->where('identId', $profileId);
@@ -483,7 +485,8 @@ public function storeAgentDoc( $options, $data, $updated, $method ){
$document = $this->documentapi;
//LL vars
- $document->lrs = $options['lrs_id']; //LL specific
+ $document->lrs = $options['lrs_id']; // Deprected.
+ $document->lrs_id = $options['lrs_id'];
$document->documentType = DocumentType::AGENT; //LL specific
//AP vars
diff --git a/app/locker/repository/Export/EloquentRepository.php b/app/locker/repository/Export/EloquentRepository.php
index 732686cd6c..9b9d196b6f 100644
--- a/app/locker/repository/Export/EloquentRepository.php
+++ b/app/locker/repository/Export/EloquentRepository.php
@@ -49,7 +49,7 @@ protected function constructStore(Model $model, array $data, array $opts) {
// Sets properties on model.
$model->name = $data['name'];
$model->description = $data['description'];
- $model->lrs = $opts['lrs_id'];
+ $model->lrs_id = $opts['lrs_id'];
$model->fields = $data['fields'];
$model->report = $data['report'];
diff --git a/app/locker/repository/Lrs/EloquentRepository.php b/app/locker/repository/Lrs/EloquentRepository.php
index f742086392..d8abfcd97e 100644
--- a/app/locker/repository/Lrs/EloquentRepository.php
+++ b/app/locker/repository/Lrs/EloquentRepository.php
@@ -128,7 +128,7 @@ public function index(array $opts) {
* @return Boolean
*/
public function destroy($id, array $opts) {
- StatementModel::where('lrs._id', $id)->delete();
+ StatementModel::where('lrs_id', $id)->delete();
return parent::destroy($id, $opts);
}
diff --git a/app/locker/repository/Query/EloquentQueryRepository.php b/app/locker/repository/Query/EloquentQueryRepository.php
index 6c64d10a4d..441cf4bb07 100644
--- a/app/locker/repository/Query/EloquentQueryRepository.php
+++ b/app/locker/repository/Query/EloquentQueryRepository.php
@@ -7,7 +7,7 @@
class EloquentQueryRepository implements QueryRepository {
- const LRS_ID_KEY = 'lrs._id';
+ const LRS_ID_KEY = 'lrs_id';
protected $db;
public function __construct(){
@@ -215,7 +215,7 @@ public function void(array $match, array $opts) {
**/
public function selectDistinctField( $lrs='', $table='', $field='', $value='', $select='' ){
return \DB::table($table)
- ->where('lrs._id', $lrs)
+ ->where('lrs_id', $lrs)
->where( $field, $value )
->select( $select )
->distinct()
@@ -234,7 +234,7 @@ public function selectDistinctField( $lrs='', $table='', $field='', $value='', $
* @return Statement query
*/
public function selectStatementDocs( $lrs='', $filter, $raw=false, $sections=[] ){
- $statements = \Statement::where('lrs._id', $lrs);
+ $statements = \Statement::where('lrs_id', $lrs);
if( !empty($filter) ){
@@ -300,7 +300,7 @@ public function selectStatements( $lrs='', $filter, $raw=false, $sections=[] ){
public function timedGrouping( $lrs, $filters, $interval, $type='time' ){
//set filters
- $lrs_filter = ['lrs._id' => $lrs];
+ $lrs_filter = ['lrs_id' => $lrs];
//if further filters passed, add them
$match = array_merge( $lrs_filter, $filters );
@@ -381,7 +381,7 @@ public function timedGrouping( $lrs, $filters, $interval, $type='time' ){
public function objectGrouping( $lrs, $section='', $filters='', $returnFields ){
//set filters
- $lrs_filter = array('lrs._id' => $lrs);
+ $lrs_filter = array('lrs_id' => $lrs);
//if further filters passed, add them
$match = array_merge( $lrs_filter, $filters );
diff --git a/app/locker/repository/Report/EloquentRepository.php b/app/locker/repository/Report/EloquentRepository.php
index 34c0b044cf..895085ff7b 100644
--- a/app/locker/repository/Report/EloquentRepository.php
+++ b/app/locker/repository/Report/EloquentRepository.php
@@ -50,7 +50,7 @@ protected function constructStore(Model $model, array $data, array $opts) {
// Sets properties on model.
$model->name = $data['name'];
$model->description = $data['description'];
- $model->lrs = $opts['lrs_id'];
+ $model->lrs_id = $opts['lrs_id'];
$model->query = Helpers::replaceFullStop($data['query']);
$model->since = $data['since'];
$model->until = $data['until'];
@@ -87,7 +87,7 @@ protected function constructUpdate(Model $model, array $data, array $opts) {
*/
public function setQuery($lrs, $query, $field, $wheres) {
return \Statement::select($field)
- ->where('lrs._id', $lrs)
+ ->where('lrs_id', $lrs)
->where($wheres, 'like', '%'.$query.'%')
->distinct()
->get()
@@ -103,7 +103,7 @@ public function setQuery($lrs, $query, $field, $wheres) {
public function statements($id, array $opts) {
$report = $this->show($id, $opts);
return (new QueryRepository)->where(
- $report->lrs,
+ $report->lrs_id,
Helpers::replaceHtmlEntity($report->where)
)->orderBy('statement.stored', 'DESC');
}
diff --git a/app/locker/repository/Statement/EloquentInserter.php b/app/locker/repository/Statement/EloquentInserter.php
index 9a87901c13..ba5d3f86e1 100644
--- a/app/locker/repository/Statement/EloquentInserter.php
+++ b/app/locker/repository/Statement/EloquentInserter.php
@@ -86,7 +86,8 @@ private function matchableStatement(\stdClass $statement) {
*/
private function constructModel(\stdClass $statement, StoreOptions $opts) {
return [
- 'lrs' => ['_id' => $opts->getOpt('lrs_id')],
+ 'lrs' => ['_id' => $opts->getOpt('lrs_id')], // Deprecated.
+ 'lrs_id' => $opts->getOpt('lrs_id'),
'client_id' => $opts->getOpt('client')->_id,
'statement' => Helpers::replaceFullStop(json_decode(json_encode($statement), true)),
'active' => false,
diff --git a/app/locker/repository/Statement/EloquentReader.php b/app/locker/repository/Statement/EloquentReader.php
index d8a0657abb..9beb1692ab 100644
--- a/app/locker/repository/Statement/EloquentReader.php
+++ b/app/locker/repository/Statement/EloquentReader.php
@@ -14,7 +14,7 @@ abstract class EloquentReader {
*/
protected function where(Options $opts) {
$scopes = $opts->getOpt('scopes');
- $query = (new $this->model)->where('lrs._id', $opts->getOpt('lrs_id'));
+ $query = (new $this->model)->where('lrs_id', $opts->getOpt('lrs_id'));
if (in_array('all', $scopes) || in_array('all/read', $scopes) || in_array('statements/read', $scopes)) {
// Get all statements.
diff --git a/app/models/DocumentAPI.php b/app/models/DocumentAPI.php
index 7b01448b79..87b45c99fb 100644
--- a/app/models/DocumentAPI.php
+++ b/app/models/DocumentAPI.php
@@ -12,7 +12,7 @@
class DocumentAPI extends Eloquent {
protected $collection = 'documentapi';
- protected $hidden = ['_id', 'created_at', 'updated_at', 'lrs', 'apitype'];
+ protected $hidden = ['_id', 'created_at', 'updated_at', 'lrs_id', 'apitype'];
/**
* Returns true if $array is associative.
@@ -136,7 +136,7 @@ public function setContent( $content_info, $method){
}
public function getContentDir(){
- $dir = Helpers::getEnvVar('LOCAL_FILESTORE').'/'.$this->lrs.'/documents/';
+ $dir = Helpers::getEnvVar('LOCAL_FILESTORE').'/'.$this->lrs_id.'/documents/';
if( !file_exists($dir) ){
mkdir( $dir, 0774, true );
}
diff --git a/app/models/Export.php b/app/models/Export.php
index 337159dd20..656700b60f 100644
--- a/app/models/Export.php
+++ b/app/models/Export.php
@@ -4,5 +4,5 @@
class Export extends Eloquent {
protected $collection = 'exports';
- protected $fillable = ['name', 'description', 'fields', 'lrs', 'report'];
+ protected $fillable = ['name', 'description', 'fields', 'lrs_id', 'report'];
}
\ No newline at end of file
diff --git a/app/models/Report.php b/app/models/Report.php
index ca32910c46..b3ae216bc2 100644
--- a/app/models/Report.php
+++ b/app/models/Report.php
@@ -11,7 +11,7 @@ class Report extends Eloquent {
*/
protected $collection = 'reports';
public static $rules = [];
- protected $fillable = ['name', 'description', 'query', 'lrs', 'since', 'until'];
+ protected $fillable = ['name', 'description', 'query', 'lrs_id', 'since', 'until'];
protected $actorQuery = [ 'statement.actor.account', 'statement.actor.mbox', 'statement.actor.openid', 'statement.actor.mbox_sha1sum' ];
protected $instructorQuery = [
'statement.context.instructor.account',
@@ -80,13 +80,16 @@ public function getMatchAttribute() {
if ($until) {
$match['statement.timestamp']['$lte'] = $until;
}
- $andMatch = ['$and' => []];
- if (!empty($actorMatch)) $andMatch['$and'][] = $actorMatch;
- if (!empty($instructorMatch)) $andMatch['$and'][] = $instructorMatch;
- if (!empty($match)) $andMatch['$and'][] = $match;
- //echo(json_encode($andMatch));die;
+ $andMatch = [];
+ if (!empty($actorMatch)) $andMatch[] = $actorMatch;
+ if (!empty($instructorMatch)) $andMatch[] = $instructorMatch;
+ if (!empty($match)) $andMatch[] = $match;
- return $andMatch;
+ if (!empty($andMatch)) {
+ $match = ['$and' => $andMatch];
+ }
+
+ return $match;
}
public function getWhereAttribute() {
diff --git a/app/models/Statement.php b/app/models/Statement.php
index 9a7ece1ba1..41435bc807 100644
--- a/app/models/Statement.php
+++ b/app/models/Statement.php
@@ -6,7 +6,7 @@ class Statement extends Eloquent {
protected $collection = 'statements';
protected $hidden = ['_id', 'created_at', 'updated_at'];
- protected $fillable = ['statement', 'active', 'voided', 'refs', 'lrs', 'timestamp'];
+ protected $fillable = ['statement', 'active', 'voided', 'refs', 'lrs_id', 'timestamp'];
public function lrs(){
return $this->belongsTo('Lrs');
diff --git a/app/tests/StatementsTestCase.php b/app/tests/StatementsTestCase.php
index 59003c4ee5..ddf310f06f 100644
--- a/app/tests/StatementsTestCase.php
+++ b/app/tests/StatementsTestCase.php
@@ -41,7 +41,7 @@ protected function generateStatement($statement = []) {
protected function createStatement(\Lrs $lrs, \Client $client, array $statement) {
$model = new \Statement([
- 'lrs' => ['_id' => $lrs->_id],
+ 'lrs_id' => $lrs->_id,
'client_id' => $client->_id,
'statement' => $statement,
'active' => true,
diff --git a/app/tests/routes/ExportsTest.php b/app/tests/routes/ExportsTest.php
index 02a529380e..d486d6106e 100644
--- a/app/tests/routes/ExportsTest.php
+++ b/app/tests/routes/ExportsTest.php
@@ -27,7 +27,7 @@ protected function createReport() {
'query' => [
'statement.actor.mbox' => ['mailto:test@example.com']
],
- 'lrs' => $this->lrs->_id
+ 'lrs_id' => $this->lrs->_id
]);
$model->save();
return $model;
diff --git a/app/tests/routes/ResourcesTestCase.php b/app/tests/routes/ResourcesTestCase.php
index d489c87600..c58f8d5099 100644
--- a/app/tests/routes/ResourcesTestCase.php
+++ b/app/tests/routes/ResourcesTestCase.php
@@ -16,7 +16,7 @@ public function setup() {
}
protected function constructData($data) {
- $data['lrs'] = $this->lrs->_id;
+ $data['lrs_id'] = $this->lrs->_id;
return $data;
}
diff --git a/app/tests/routes/StatementAttachmentTest.php b/app/tests/routes/StatementAttachmentTest.php
index 14a8bd9836..a05de59b88 100644
--- a/app/tests/routes/StatementAttachmentTest.php
+++ b/app/tests/routes/StatementAttachmentTest.php
@@ -81,7 +81,7 @@ private function storeAttachments() {
public function testIndexAttachments() {
$attachment = $this->storeAttachments();
$statement = (new \Statement)
- ->where('lrs._id', $this->lrs->_id)
+ ->where('lrs_id', $this->lrs->_id)
->where('statement.id', $this->statement_id)
->first()->statement;
@@ -123,7 +123,7 @@ public function tearDown() {
$dir = Helpers::getEnvVar('LOCAL_FILESTORE').'/'.$this->lrs->_id;
$this->deleteDirectory($dir);
(new \Statement)
- ->where('lrs._id', $this->lrs->_id)
+ ->where('lrs_id', $this->lrs->_id)
->delete();
}
}
diff --git a/app/tests/routes/StatementRefTest.php b/app/tests/routes/StatementRefTest.php
index 31d9daf078..35d121116f 100644
--- a/app/tests/routes/StatementRefTest.php
+++ b/app/tests/routes/StatementRefTest.php
@@ -34,7 +34,7 @@ private function createIdStatement($id, $statement = []) {
private function checkStatement($id, $expected_references = [], $expected_referrers = []) {
$uuid = $this->generateUUID($id);
- $statement = \Statement::where('lrs._id', $this->lrs->_id)->where('statement.id', '=', $uuid)->first();
+ $statement = \Statement::where('lrs_id', $this->lrs->_id)->where('statement.id', '=', $uuid)->first();
//$queries = DB::getQueryLog();
diff --git a/app/views/partials/reporting/statements.blade.php b/app/views/partials/reporting/statements.blade.php
index 1eb0b8e0c8..8950438c39 100644
--- a/app/views/partials/reporting/statements.blade.php
+++ b/app/views/partials/reporting/statements.blade.php
@@ -23,13 +23,13 @@
- - {{ Lang::get('statements.reporting') }}
+ - {{ Lang::get('statements.reporting') }}
- {{$report->name}}
@stop
@section('buttons')
- {{ Lang::get('site.edit') }}
+ {{ Lang::get('site.edit') }}
{{ Lang::get('reporting.graph') }}
@stop
diff --git a/app/views/partials/site/backbone/templates.blade.php b/app/views/partials/site/backbone/templates.blade.php
index db0dd21422..301f0f2d0b 100644
--- a/app/views/partials/site/backbone/templates.blade.php
+++ b/app/views/partials/site/backbone/templates.blade.php
@@ -64,7 +64,7 @@
<% if ( lrs_owned.length > 0 ){ %>
Lrs's owned:
<% _.each(lrs_owned, function(lrs) { %>
- <%= lrs.title %>,
+ <%= lrs.title %>,
<% }); %>
<% } %>
From f4167c45ba3b7ef89ebfc819c8dff8346fd2c9fd Mon Sep 17 00:00:00 2001
From: Ryan Smith <0ryansmith1994@gmail.com>
Date: Thu, 13 Aug 2015 12:00:34 +0100
Subject: [PATCH 05/35] Fixes users.
---
app/views/partials/site/backbone/templates.blade.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/partials/site/backbone/templates.blade.php b/app/views/partials/site/backbone/templates.blade.php
index 301f0f2d0b..db0dd21422 100644
--- a/app/views/partials/site/backbone/templates.blade.php
+++ b/app/views/partials/site/backbone/templates.blade.php
@@ -64,7 +64,7 @@
<% if ( lrs_owned.length > 0 ){ %>
Lrs's owned:
<% _.each(lrs_owned, function(lrs) { %>
- <%= lrs.title %>,
+ <%= lrs.title %>,
<% }); %>
<% } %>
From 3500dc53a4506d22cf039117cbc31fc4fe2cc2a7 Mon Sep 17 00:00:00 2001
From: Ryan Smith <0ryansmith1994@gmail.com>
Date: Thu, 13 Aug 2015 12:09:39 +0100
Subject: [PATCH 06/35] Fixes owners.
---
app/filters.php | 2 +-
app/locker/helpers/Lrs.php | 2 +-
app/locker/repository/Lrs/EloquentRepository.php | 9 ++++-----
app/locker/repository/User/EloquentUserRepository.php | 4 ++--
app/models/Lrs.php | 2 +-
app/tests/LrsTestCase.php | 2 +-
app/views/partials/users/item-lrs.blade.php | 4 ++--
7 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/app/filters.php b/app/filters.php
index e95cc4e51c..5cf52d5c95 100644
--- a/app/filters.php
+++ b/app/filters.php
@@ -69,7 +69,7 @@
$lrs = Helpers::getLrsFromAuth();
//attempt login once
- if ( ! Auth::onceUsingId($lrs->owner['_id']) ) {
+ if ( ! Auth::onceUsingId($lrs->owner_id) ) {
throw new Exceptions\Exception('Unauthorized request.', 401);
}
diff --git a/app/locker/helpers/Lrs.php b/app/locker/helpers/Lrs.php
index 3251b9372c..65fd01532d 100644
--- a/app/locker/helpers/Lrs.php
+++ b/app/locker/helpers/Lrs.php
@@ -75,7 +75,7 @@ public static function lrsEdit( $lrs ){
**/
public static function lrsOwner( $lrs_id ){
$lrs = \Lrs::find( $lrs_id );
- if( $lrs->owner['_id'] == \Auth::user()->_id || \Auth::user()->role == 'super' ){
+ if( $lrs->owner_id == \Auth::user()->_id || \Auth::user()->role == 'super' ){
return true;
}else{
return false;
diff --git a/app/locker/repository/Lrs/EloquentRepository.php b/app/locker/repository/Lrs/EloquentRepository.php
index d8abfcd97e..da06c36220 100644
--- a/app/locker/repository/Lrs/EloquentRepository.php
+++ b/app/locker/repository/Lrs/EloquentRepository.php
@@ -31,8 +31,7 @@ protected function where(array $opts) {
protected function validateData(array $data) {
if (isset($data['title'])) XAPIHelpers::checkType('title', 'string', $data['title']);
if (isset($data['description'])) XAPIHelpers::checkType('description', 'string', $data['description']);
- if (isset($data['owner'])) XAPIHelpers::checkType('owner', 'array', $data['owner']);
- if (isset($data['owner']['_id'])) XAPIHelpers::checkType('owner._id', 'string', $data['owner']['_id']);
+ if (isset($data['owner_id'])) XAPIHelpers::checkType('owner_id', 'string', $data['owner_id']);
// Validate users.
if (isset($data['users'])) {
@@ -57,7 +56,7 @@ protected function validateData(array $data) {
protected function constructStore(Model $model, array $data, array $opts) {
// Merges and validates data with defaults.
$data = array_merge($this->defaults, $data, [
- 'owner' => ['_id' => $opts['user']->_id],
+ 'owner_id' => $opts['user']->_id,
'users' => [[
'_id' => $opts['user']->_id,
'email' => $opts['user']->email,
@@ -70,7 +69,7 @@ protected function constructStore(Model $model, array $data, array $opts) {
// Sets properties on model.
$model->title = $data['title'];
$model->description = $data['description'];
- $model->owner = $data['owner'];
+ $model->owner_id = $data['owner_id'];
$model->users = $data['users'];
return $model;
@@ -137,7 +136,7 @@ public function removeUser($id, $user_id) {
}
public function getLrsOwned($user_id) {
- return $this->where([])->where('owner._id', $user_id)->select('title')->get()->toArray();
+ return $this->where([])->where('owner_id', $user_id)->select('title')->get()->toArray();
}
public function getLrsMember($user_id) {
diff --git a/app/locker/repository/User/EloquentUserRepository.php b/app/locker/repository/User/EloquentUserRepository.php
index b695d8059e..24d2ff4133 100644
--- a/app/locker/repository/User/EloquentUserRepository.php
+++ b/app/locker/repository/User/EloquentUserRepository.php
@@ -93,7 +93,7 @@ public function delete( $id ){
$super = \User::where('role', 'super')->first();
//get all LRSs owned by user being deleted
- $get_lrs = \Lrs::where('owner._id', $id)->get();
+ $get_lrs = \Lrs::where('owner_id', $id)->get();
//do LRS exists?
if( $get_lrs ){
@@ -107,7 +107,7 @@ public function delete( $id ){
//add merged users
$lrs->users = $existing;
//set owner to super admin
- $lrs->owner = array('_id' => $super->_id);
+ $lrs->owner_id = $super->_id;
$lrs->save();
}
}
diff --git a/app/models/Lrs.php b/app/models/Lrs.php
index d6a0a480ee..ebcc14888f 100644
--- a/app/models/Lrs.php
+++ b/app/models/Lrs.php
@@ -10,7 +10,7 @@ class Lrs extends Eloquent {
* @var string
*/
protected $collection = 'lrs';
- protected $fillable = ['title', 'description', 'owner', 'users'];
+ protected $fillable = ['title', 'description', 'owner_id', 'users'];
/**
* Validation rules for statement input
diff --git a/app/tests/LrsTestCase.php b/app/tests/LrsTestCase.php
index 1f82f7665b..2a4b20e2a4 100644
--- a/app/tests/LrsTestCase.php
+++ b/app/tests/LrsTestCase.php
@@ -14,7 +14,7 @@ public function setUp() {
protected function createLrs(\User $user) {
$model = new \Lrs([
'title' => 'Test',
- 'owner' => ['_id' => $user->_id],
+ 'owner_id' => $user->_id,
'users' => [[
'_id' => $user->_id,
'email' => $user->email,
diff --git a/app/views/partials/users/item-lrs.blade.php b/app/views/partials/users/item-lrs.blade.php
index d97edaffa1..7bd9986286 100644
--- a/app/views/partials/users/item-lrs.blade.php
+++ b/app/views/partials/users/item-lrs.blade.php
@@ -4,7 +4,7 @@
?>
- @if ( $lrs->owner['_id'] != $user['_id'] )
+ @if ( $lrs->owner_id != $user['_id'] )
@include('partials.lrs.forms.removeUser', array('lrs' => $lrs, 'user' => $user))
@@ -17,7 +17,7 @@
{{ $user['email'] }}
- @if ( $lrs->owner['_id'] != $user['_id'] )
+ @if ( $lrs->owner_id != $user['_id'] )