From 083b2bdae3fbb6a20f3ab687a108792065127f07 Mon Sep 17 00:00:00 2001 From: DariusIII Date: Wed, 11 Sep 2019 21:22:35 +0000 Subject: [PATCH 1/2] Use facade/ignition in place of filp/whoops package --- Changelog | 1 + composer.json | 3 +- composer.lock | 364 ++++++++++++++++++++++++++++++++------------------ 3 files changed, 236 insertions(+), 132 deletions(-) diff --git a/Changelog b/Changelog index f991b8e80..c939feb22 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2019-09-11 DariusIII + * Chg: Use facade/ignition in place of filp/whoops package * Fix: Fix fixtures package name * Chg: Update laravel/framework to version 6.0.2 and related packages to their latest versions 2019-09-10 DariusIII diff --git a/composer.json b/composer.json index e3d8deea8..c828e3b3e 100755 --- a/composer.json +++ b/composer.json @@ -152,12 +152,11 @@ }, "require-dev": { - "barryvdh/laravel-debugbar": "^3.1", "barryvdh/laravel-ide-helper": "^2.4", "beyondcode/laravel-dump-server": "^1.0", "captainhook/captainhook": "^4.4", "captainhook/plugin-composer": "^4.0", - "filp/whoops": "~2.0", + "facade/ignition": "^1.6", "friendsofphp/php-cs-fixer": "^2.14", "fzaninotto/faker": "~1.4", "laracasts/generators": "^1.1", diff --git a/composer.lock b/composer.lock index c1d7590ee..30a0745cd 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f2d08ffc204817cde0dc0f7adb9563ec", + "content-hash": "afcbc056e91c15c674b1aba2985f8a48", "packages": [ { "name": "aharen/omdbapi", @@ -8506,74 +8506,6 @@ } ], "packages-dev": [ - { - "name": "barryvdh/laravel-debugbar", - "version": "v3.2.8", - "source": { - "type": "git", - "url": "https://github.com/barryvdh/laravel-debugbar.git", - "reference": "18208d64897ab732f6c04a19b319fe8f1d57a9c0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/18208d64897ab732f6c04a19b319fe8f1d57a9c0", - "reference": "18208d64897ab732f6c04a19b319fe8f1d57a9c0", - "shasum": "" - }, - "require": { - "illuminate/routing": "^5.5|^6", - "illuminate/session": "^5.5|^6", - "illuminate/support": "^5.5|^6", - "maximebf/debugbar": "~1.15.0", - "php": ">=7.0", - "symfony/debug": "^3|^4", - "symfony/finder": "^3|^4" - }, - "require-dev": { - "laravel/framework": "5.5.x" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - }, - "laravel": { - "providers": [ - "Barryvdh\\Debugbar\\ServiceProvider" - ], - "aliases": { - "Debugbar": "Barryvdh\\Debugbar\\Facade" - } - } - }, - "autoload": { - "psr-4": { - "Barryvdh\\Debugbar\\": "src/" - }, - "files": [ - "src/helpers.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Barry vd. Heuvel", - "email": "barryvdh@gmail.com" - } - ], - "description": "PHP Debugbar integration for Laravel", - "keywords": [ - "debug", - "debugbar", - "laravel", - "profiler", - "webprofiler" - ], - "time": "2019-08-29T07:01:03+00:00" - }, { "name": "barryvdh/laravel-ide-helper", "version": "v2.6.5", @@ -9245,6 +9177,172 @@ ], "time": "2019-03-17T17:37:11+00:00" }, + { + "name": "facade/flare-client-php", + "version": "1.0.4", + "source": { + "type": "git", + "url": "https://github.com/facade/flare-client-php.git", + "reference": "7128b251b48f24ef64e5cddd7f8d40cc3a06fd3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/facade/flare-client-php/zipball/7128b251b48f24ef64e5cddd7f8d40cc3a06fd3e", + "reference": "7128b251b48f24ef64e5cddd7f8d40cc3a06fd3e", + "shasum": "" + }, + "require": { + "facade/ignition-contracts": "~1.0", + "illuminate/pipeline": "~5.5|~5.6|~5.7|~5.8|^6.0", + "php": "^7.1", + "symfony/http-foundation": "~3.3|~4.1", + "symfony/var-dumper": "^3.4|^4.0" + }, + "require-dev": { + "larapack/dd": "^1.1", + "phpunit/phpunit": "^7.0", + "spatie/phpunit-snapshot-assertions": "^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Facade\\FlareClient\\": "src" + }, + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Send PHP errors to Flare", + "homepage": "https://github.com/facade/flare-client-php", + "keywords": [ + "exception", + "facade", + "flare", + "reporting" + ], + "time": "2019-09-11T14:19:56+00:00" + }, + { + "name": "facade/ignition", + "version": "1.6.0", + "source": { + "type": "git", + "url": "https://github.com/facade/ignition.git", + "reference": "36a1e4ca0973ac8e5c8289ee31956bbaf8e6bb67" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/facade/ignition/zipball/36a1e4ca0973ac8e5c8289ee31956bbaf8e6bb67", + "reference": "36a1e4ca0973ac8e5c8289ee31956bbaf8e6bb67", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-mbstring": "*", + "facade/flare-client-php": "^1.0", + "facade/ignition-contracts": "^1.0", + "filp/whoops": "^2.4", + "illuminate/support": "~5.5.0 || ~5.6.0 || ~5.7.0 || ~5.8.0 || ^6.0", + "monolog/monolog": "^1.12 || ^2.0", + "php": "^7.1", + "scrivo/highlight.php": "^9.15", + "symfony/console": "^3.4 || ^4.0", + "symfony/var-dumper": "^3.4 || ^4.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.14", + "mockery/mockery": "^1.2", + "orchestra/testbench": "^3.5 || ^3.6 || ^3.7 || ^3.8 || ^4.0" + }, + "suggest": { + "laravel/telescope": "^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + }, + "laravel": { + "providers": [ + "Facade\\Ignition\\IgnitionServiceProvider" + ], + "aliases": { + "Flare": "Facade\\Ignition\\Facades\\Flare" + } + } + }, + "autoload": { + "psr-4": { + "Facade\\Ignition\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A beautiful error page for Laravel applications.", + "homepage": "https://github.com/facade/ignition", + "keywords": [ + "error", + "flare", + "laravel", + "page" + ], + "time": "2019-09-09T14:06:15+00:00" + }, + { + "name": "facade/ignition-contracts", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/facade/ignition-contracts.git", + "reference": "f445db0fb86f48e205787b2592840dd9c80ded28" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/facade/ignition-contracts/zipball/f445db0fb86f48e205787b2592840dd9c80ded28", + "reference": "f445db0fb86f48e205787b2592840dd9c80ded28", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Facade\\IgnitionContracts\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://flareapp.io", + "role": "Developer" + } + ], + "description": "Solution contracts for Ignition", + "homepage": "https://github.com/facade/ignition-contracts", + "keywords": [ + "contracts", + "flare", + "ignition" + ], + "time": "2019-08-30T14:06:08+00:00" + }, { "name": "filp/whoops", "version": "2.5.0", @@ -9774,67 +9872,6 @@ ], "time": "2019-09-05T13:41:48+00:00" }, - { - "name": "maximebf/debugbar", - "version": "v1.15.0", - "source": { - "type": "git", - "url": "https://github.com/maximebf/php-debugbar.git", - "reference": "30e7d60937ee5f1320975ca9bc7bcdd44d500f07" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/30e7d60937ee5f1320975ca9bc7bcdd44d500f07", - "reference": "30e7d60937ee5f1320975ca9bc7bcdd44d500f07", - "shasum": "" - }, - "require": { - "php": ">=5.3.0", - "psr/log": "^1.0", - "symfony/var-dumper": "^2.6|^3.0|^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0|^5.0" - }, - "suggest": { - "kriswallsmith/assetic": "The best way to manage assets", - "monolog/monolog": "Log using Monolog", - "predis/predis": "Redis storage" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.14-dev" - } - }, - "autoload": { - "psr-4": { - "DebugBar\\": "src/DebugBar/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Maxime Bouroumeau-Fuseau", - "email": "maxime.bouroumeau@gmail.com", - "homepage": "http://maximebf.com" - }, - { - "name": "Barry vd. Heuvel", - "email": "barryvdh@gmail.com" - } - ], - "description": "Debug bar in the browser for php application", - "homepage": "https://github.com/maximebf/php-debugbar", - "keywords": [ - "debug", - "debugbar" - ], - "time": "2017-12-15T11:13:46+00:00" - }, { "name": "mockery/mockery", "version": "1.2.3", @@ -11565,6 +11602,73 @@ ], "time": "2019-08-21T07:05:16+00:00" }, + { + "name": "scrivo/highlight.php", + "version": "v9.15.10.0", + "source": { + "type": "git", + "url": "https://github.com/scrivo/highlight.php.git", + "reference": "9ad3adb4456dc91196327498dbbce6aa1ba1239e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/scrivo/highlight.php/zipball/9ad3adb4456dc91196327498dbbce6aa1ba1239e", + "reference": "9ad3adb4456dc91196327498dbbce6aa1ba1239e", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-mbstring": "*", + "php": ">=5.4" + }, + "require-dev": { + "phpunit/phpunit": "^4.8|^5.7", + "symfony/finder": "^2.8" + }, + "suggest": { + "ext-dom": "Needed to make use of the features in the utilities namespace" + }, + "type": "library", + "autoload": { + "psr-0": { + "Highlight\\": "", + "HighlightUtilities\\": "" + }, + "files": [ + "HighlightUtilities/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Geert Bergman", + "role": "Project Author", + "homepage": "http://www.scrivo.org/" + }, + { + "name": "Vladimir Jimenez", + "role": "Contributor", + "homepage": "https://allejo.io" + }, + { + "name": "Martin Folkers", + "role": "Contributor", + "homepage": "https://twobrain.io" + } + ], + "description": "Server side syntax highlighter that supports 185 languages. It's a PHP port of highlight.js", + "keywords": [ + "code", + "highlight", + "highlight.js", + "highlight.php", + "syntax" + ], + "time": "2019-08-27T04:27:48+00:00" + }, { "name": "sebastian/code-unit-reverse-lookup", "version": "1.0.1", From 5368d3a27a37b61969f68b17ea6a9a431b1dd798 Mon Sep 17 00:00:00 2001 From: DariusIII Date: Wed, 11 Sep 2019 21:51:56 +0000 Subject: [PATCH 2/2] Use LazyCollections where possible to reduce memory usage of queries --- Changelog | 1 + app/Http/Controllers/Admin/RoleController.php | 6 +++--- app/Http/Controllers/Admin/UserController.php | 15 ++++++++------- app/Models/Settings.php | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Changelog b/Changelog index c939feb22..c96a950df 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2019-09-11 DariusIII + * Chg: Use LazyCollections where possible to reduce memory usage of queries * Chg: Use facade/ignition in place of filp/whoops package * Fix: Fix fixtures package name * Chg: Update laravel/framework to version 6.0.2 and related packages to their latest versions diff --git a/app/Http/Controllers/Admin/RoleController.php b/app/Http/Controllers/Admin/RoleController.php index 427e73f8e..bea223af5 100644 --- a/app/Http/Controllers/Admin/RoleController.php +++ b/app/Http/Controllers/Admin/RoleController.php @@ -18,7 +18,7 @@ class RoleController extends BasePageController $meta_title = $title = 'User Role List'; //get the user roles - $userroles = Role::all(); + $userroles = Role::cursor(); $this->smarty->assign('userroles', $userroles); @@ -126,10 +126,10 @@ class RoleController extends BasePageController $meta_title = $title = 'User Roles'; // Get the user roles. - $userRoles = Role::all(); + $userRoles = Role::cursor(); $roles = []; foreach ($userRoles as $userRole) { - $roles[$userRole['id']] = $userRole['name']; + $roles[$userRole->id] = $userRole->name; } switch ($request->input('action') ?? 'view') { diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 2edf86ba0..592b969bd 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -23,8 +23,9 @@ class UserController extends BasePageController $meta_title = $title = 'User List'; $roles = []; - foreach (Role::all()->toArray() as $userRole) { - $roles[$userRole['id']] = $userRole['name']; + $userRoles = Role::cursor(); + foreach ($userRoles as $userRole) { + $roles[$userRole->id] = $userRole->name; } $ordering = getUserBrowseOrdering(); @@ -99,15 +100,15 @@ class UserController extends BasePageController $action = $request->input('action') ?? 'view'; //get the user roles - $userRoles = Role::all()->toArray(); + $userRoles = Role::cursor(); $roles = []; $defaultRole = 'User'; $defaultInvites = Invitation::DEFAULT_INVITES; foreach ($userRoles as $r) { - $roles[$r['id']] = $r['name']; - if ($r['isdefault'] === 1) { - $defaultRole = $r['id']; - $defaultInvites = $r['defaultinvites']; + $roles[$r->id] = $r->name; + if ($r->isdefault === 1) { + $defaultRole = $r->id; + $defaultInvites = $r->defaultinvites; } } diff --git a/app/Models/Settings.php b/app/Models/Settings.php index 942ff92a3..9274ee258 100644 --- a/app/Models/Settings.php +++ b/app/Models/Settings.php @@ -142,7 +142,7 @@ class Settings extends Model */ public static function toTree($excludeUnsectioned = true): array { - $results = self::all(); + $results = self::cursor(); $tree = []; if (! empty($results)) {