From 4c29c5080db9ec5b3fca6824cbe1521b35dc1d19 Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Thu, 5 Feb 2015 19:47:20 +1100 Subject: [PATCH] Clean up, get front and backends operational again --- UPGRADE.md | 40 ++++++++++- app/filters.php | 73 ------------------- app/routes.php | 12 ---- app/start/artisan.php | 12 ---- app/start/global.php | 82 ---------------------- bootstrap/app.php | 51 -------------- bootstrap/autoload.php | 12 ---- bootstrap/paths.php | 57 --------------- modules/backend/widgets/Lists.php | 10 +-- modules/cms/classes/CmsCompoundObject.php | 2 - modules/cms/classes/Controller.php | 49 ++++++++++++- modules/system/ServiceProvider.php | 2 +- modules/system/aliases.php | 42 ++--------- modules/system/behaviors/SettingsModel.php | 17 +++-- modules/system/classes/Controller.php | 4 +- modules/system/providers.php | 27 +------ 16 files changed, 110 insertions(+), 382 deletions(-) delete mode 100644 app/filters.php delete mode 100644 app/routes.php delete mode 100644 app/start/artisan.php delete mode 100644 app/start/global.php delete mode 100644 bootstrap/paths.php diff --git a/UPGRADE.md b/UPGRADE.md index d25e4c871..f71468bd1 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -5,12 +5,48 @@ System\Classes\ApplicationException -> ApplicationException System\Classes\SystemException -> SystemException October\Rain\Support\ValidationException -> ValidationException - DB -> Db - HTML -> Html ### File system changes [MOVE] /app/config -> /config [MOVE] /app/storage -> /storage [CREATE] /storage/framework + [DELETE] /bootstrap/start.php + [DELETE] /bootstrap/autoload.php + [SPAWN] /bootstrap/app.php + [SPAWN] /bootstrap/autoload.php +*SPAWN* means to create a file using the git source. + +### Clean up + +Optional things you can delete, if they do not contain anything custom. + + [DELETE] /app/start/artisan.php + [DELETE] /app/start/global.php + [DELETE] /app/filters.php + [DELETE] /app/routes.php + [DELETE] /app + [DELETE] /storage/cache + +### Breaking code changes + +**Model->remember() has been removed** +**App::make('paginator')->setCurrentPage(5);** should no longer be used + +##### Paginator API changes + + getTotal() -> total() + getCurrentPage() -> currentPage() + getLastPage() -> lastPage() + getFrom() -> firstItem() + getTo() -> lastItem() + +### Things to do + +- Does config still inherit? +- Does translation still inherit? Switch to our own? +- Model->remember() replacement usage is buggy/broken +- Custom Exception Handler needs attention +- `laravel.log` should be renamed to system.log +- Search for `@todo L5` \ No newline at end of file diff --git a/app/filters.php b/app/filters.php deleted file mode 100644 index d4bb5c5f6..000000000 --- a/app/filters.php +++ /dev/null @@ -1,73 +0,0 @@ -singleton( 'October\Rain\Foundation\Exceptions\Handler' ); -/* -|-------------------------------------------------------------------------- -| Bind Paths -|-------------------------------------------------------------------------- -| -| Here we are binding the paths configured in paths.php to the app. You -| should not be changing these here. If you need to change these you -| may do so within the paths.php file and they will be bound here. -| -*/ - -// $app->bindInstallPaths(require __DIR__.'/paths.php'); - -/* -|-------------------------------------------------------------------------- -| Load The Application -|-------------------------------------------------------------------------- -| -| Here we will load the Illuminate application. We'll keep this is in a -| separate location so we can isolate the creation of an application -| from the actual running of the application with a given request. -| -*/ - -// $framework = $app['path.base'].'/vendor/laravel/framework/src'; - -// require $framework.'/Illuminate/Foundation/start.php'; - -/* -|-------------------------------------------------------------------------- -| Disable any caching -|-------------------------------------------------------------------------- -*/ - -// if (!isset($unitTesting) || !$unitTesting) { -// header('Cache-Control: no-store, private, no-cache, must-revalidate'); // HTTP/1.1 -// header('Cache-Control: pre-check=0, post-check=0, max-age=0, max-stale = 0', false); // HTTP/1.1 -// header('Pragma: public'); -// header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past -// header('Expires: 0', false); -// header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); -// header('Pragma: no-cache'); -// } - -/* -|-------------------------------------------------------------------------- -| Fix for XDebug aborting threads > 100 nested -|-------------------------------------------------------------------------- -*/ -ini_set('xdebug.max_nesting_level', 300); - /* |-------------------------------------------------------------------------- | Return The Application diff --git a/bootstrap/autoload.php b/bootstrap/autoload.php index 40c0f4097..339efedc4 100644 --- a/bootstrap/autoload.php +++ b/bootstrap/autoload.php @@ -32,15 +32,3 @@ $compiledPath = __DIR__.'/../storage/framework/compiled.php'; if (file_exists($compiledPath)) { require $compiledPath; } - -/* -|-------------------------------------------------------------------------- -| Register The October Auto Loader -|-------------------------------------------------------------------------- -| This should come before the Laravel loader because it is more likely -| to find a partner fo' life. -| -*/ - -October\Rain\Support\ClassLoader::register(); -October\Rain\Support\ClassLoader::addDirectories(array(__DIR__.'/../modules', __DIR__.'/../plugins')); diff --git a/bootstrap/paths.php b/bootstrap/paths.php deleted file mode 100644 index 6e2e2154d..000000000 --- a/bootstrap/paths.php +++ /dev/null @@ -1,57 +0,0 @@ - __DIR__.'/../app', - - /* - |-------------------------------------------------------------------------- - | Public Path - |-------------------------------------------------------------------------- - | - | The public path contains the assets for your web application, such as - | your JavaScript and CSS files, and also contains the primary entry - | point for web requests into these applications from the outside. - | - */ - - 'public' => __DIR__.'/..', - - /* - |-------------------------------------------------------------------------- - | Base Path - |-------------------------------------------------------------------------- - | - | The base path is the root of the Laravel installation. Most likely you - | will not need to change this value. But, if for some wild reason it - | is necessary you will do so here, just proceed with some caution. - | - */ - - 'base' => __DIR__.'/..', - - /* - |-------------------------------------------------------------------------- - | Storage Path - |-------------------------------------------------------------------------- - | - | The storage path is used by Laravel to store cached Blade views, logs - | and other pieces of information. You may modify the path here when - | you want to change the location of this directory for your apps. - | - */ - - 'storage' => __DIR__.'/../app/storage', - -); diff --git a/modules/backend/widgets/Lists.php b/modules/backend/widgets/Lists.php index 44bdfd92d..f3330392e 100644 --- a/modules/backend/widgets/Lists.php +++ b/modules/backend/widgets/Lists.php @@ -204,11 +204,11 @@ class Lists extends WidgetBase $this->vars['treeLevel'] = 0; if ($this->showPagination) { - $this->vars['recordTotal'] = $this->records->getTotal(); - $this->vars['pageCurrent'] = $this->records->getCurrentPage(); - $this->vars['pageLast'] = $this->records->getLastPage(); - $this->vars['pageFrom'] = $this->records->getFrom(); - $this->vars['pageTo'] = $this->records->getTo(); + $this->vars['recordTotal'] = $this->records->total(); + $this->vars['pageCurrent'] = $this->records->currentPage(); + $this->vars['pageLast'] = $this->records->lastPage(); + $this->vars['pageFrom'] = $this->records->firstItem(); + $this->vars['pageTo'] = $this->records->lastItem(); } else { $this->vars['recordTotal'] = $this->records->count(); diff --git a/modules/cms/classes/CmsCompoundObject.php b/modules/cms/classes/CmsCompoundObject.php index e951fb2c1..a461dc72c 100644 --- a/modules/cms/classes/CmsCompoundObject.php +++ b/modules/cms/classes/CmsCompoundObject.php @@ -11,8 +11,6 @@ use Cms\Classes\ViewBag; use Cms\Twig\Extension as CmsTwigExtension; use Cms\Twig\Loader as TwigLoader; use System\Twig\Extension as SystemTwigExtension; -use System\Classes\SystemException; -use October\Rain\Support\ValidationException; use Twig_Environment; /** diff --git a/modules/cms/classes/Controller.php b/modules/cms/classes/Controller.php index 5b3639773..8c5d9d752 100644 --- a/modules/cms/classes/Controller.php +++ b/modules/cms/classes/Controller.php @@ -14,7 +14,6 @@ use Response; use Exception; use BackendAuth; use Twig_Environment; -use Controller as BaseController; use Cms\Twig\Loader as TwigLoader; use Cms\Twig\DebugExtension; use Cms\Twig\Extension as CmsTwigExtension; @@ -35,7 +34,7 @@ use Illuminate\Http\RedirectResponse; * @package october\cms * @author Alexey Bobkov, Samuel Georges */ -class Controller extends BaseController +class Controller { use \System\Traits\AssetMaker; use \October\Rain\Support\Traits\Emitter; @@ -1190,4 +1189,50 @@ class Controller extends BaseController } } } + + // + // Keep Laravel Happy + // + + /** + * Get the middleware assigned to the controller. + * + * @return array + */ + public function getMiddleware() + { + return []; + } + + /** + * Get the registered "before" filters. + * + * @return array + */ + public function getBeforeFilters() + { + return []; + } + + /** + * Get the registered "after" filters. + * + * @return array + */ + public function getAfterFilters() + { + return []; + } + + /** + * Execute an action on the controller. + * + * @param string $method + * @param array $parameters + * @return \Symfony\Component\HttpFoundation\Response + */ + public function callAction($method, $parameters) + { + return call_user_func_array(array($this, $method), $parameters); + } } diff --git a/modules/system/ServiceProvider.php b/modules/system/ServiceProvider.php index 32eb2c35c..f525235fa 100644 --- a/modules/system/ServiceProvider.php +++ b/modules/system/ServiceProvider.php @@ -41,7 +41,7 @@ class ServiceProvider extends ModuleServiceProvider /* * Register core providers */ - App::register('October\Rain\Translation\TranslationServiceProvider'); + // App::register('October\Rain\Translation\TranslationServiceProvider'); /* * Define path constants diff --git a/modules/system/aliases.php b/modules/system/aliases.php index 53ca718d9..ab12ebb4a 100644 --- a/modules/system/aliases.php +++ b/modules/system/aliases.php @@ -5,53 +5,18 @@ return [ /* * Laravel aliases */ - // 'App' => 'Illuminate\Support\Facades\App', - // 'Artisan' => 'Illuminate\Support\Facades\Artisan', - // 'Cache' => 'Illuminate\Support\Facades\Cache', - // 'ClassLoader' => 'Illuminate\Support\ClassLoader', - // 'Controller' => 'Illuminate\Routing\Controller', - // 'Cookie' => 'Illuminate\Support\Facades\Cookie', - // 'Crypt' => 'Illuminate\Support\Facades\Crypt', - // 'DB' => 'Illuminate\Support\Facades\DB', - // 'Eloquent' => 'Illuminate\Database\Eloquent\Model', - // 'Event' => 'Illuminate\Support\Facades\Event', - // 'Hash' => 'Illuminate\Support\Facades\Hash', - // 'HTML' => 'Illuminate\Support\Facades\HTML', - // 'Input' => 'Illuminate\Support\Facades\Input', - // 'Lang' => 'Illuminate\Support\Facades\Lang', - // 'Log' => 'Illuminate\Support\Facades\Log', - // 'Mail' => 'Illuminate\Support\Facades\Mail', - // 'Paginator' => 'Illuminate\Support\Facades\Paginator', - // 'Password' => 'Illuminate\Support\Facades\Password', - // 'Queue' => 'Illuminate\Support\Facades\Queue', - // 'Redirect' => 'Illuminate\Support\Facades\Redirect', - // 'Redis' => 'Illuminate\Support\Facades\Redis', - // 'Request' => 'Illuminate\Support\Facades\Request', - // 'Response' => 'Illuminate\Support\Facades\Response', - // 'Route' => 'Illuminate\Support\Facades\Route', - // 'Schema' => 'Illuminate\Support\Facades\Schema', - // 'Session' => 'Illuminate\Support\Facades\Session', - // 'URL' => 'Illuminate\Support\Facades\URL', - // 'Validator' => 'Illuminate\Support\Facades\Validator', - // 'View' => 'Illuminate\Support\Facades\View', - // 'Form' => 'Illuminate\Support\Facades\Form', - 'App' => 'Illuminate\Support\Facades\App', 'Artisan' => 'Illuminate\Support\Facades\Artisan', - // 'Auth' => 'Illuminate\Support\Facades\Auth', - // 'Blade' => 'Illuminate\Support\Facades\Blade', 'Bus' => 'Illuminate\Support\Facades\Bus', 'Cache' => 'Illuminate\Support\Facades\Cache', - // 'Config' => 'Illuminate\Support\Facades\Config',* 'Cookie' => 'Illuminate\Support\Facades\Cookie', 'Crypt' => 'Illuminate\Support\Facades\Crypt', + 'Db' => 'Illuminate\Support\Facades\DB', // Preferred 'DB' => 'Illuminate\Support\Facades\DB', 'Eloquent' => 'Illuminate\Database\Eloquent\Model', 'Event' => 'Illuminate\Support\Facades\Event', - // 'File' => 'Illuminate\Support\Facades\File',* 'Hash' => 'Illuminate\Support\Facades\Hash', 'Input' => 'Illuminate\Support\Facades\Input', - // 'Inspiring' => 'Illuminate\Foundation\Inspiring', 'Lang' => 'Illuminate\Support\Facades\Lang', 'Log' => 'Illuminate\Support\Facades\Log', 'Mail' => 'Illuminate\Support\Facades\Mail', @@ -65,12 +30,13 @@ return [ 'Schema' => 'Illuminate\Support\Facades\Schema', 'Session' => 'Illuminate\Support\Facades\Session', 'Storage' => 'Illuminate\Support\Facades\Storage', + 'Url' => 'Illuminate\Support\Facades\URL', // Preferred 'URL' => 'Illuminate\Support\Facades\URL', 'Validator' => 'Illuminate\Support\Facades\Validator', 'View' => 'Illuminate\Support\Facades\View', - 'Form' => 'Illuminate\Html\FormFacade', - 'Html' => 'Illuminate\Html\HtmlFacade', + 'Html' => 'Illuminate\Html\HtmlFacade', // Preferred + 'HTML' => 'Illuminate\Html\HtmlFacade', /* * October aliases diff --git a/modules/system/behaviors/SettingsModel.php b/modules/system/behaviors/SettingsModel.php index 38606b9c3..8d591f1d0 100644 --- a/modules/system/behaviors/SettingsModel.php +++ b/modules/system/behaviors/SettingsModel.php @@ -110,11 +110,18 @@ class SettingsModel extends ModelBehavior */ public function getSettingsRecord() { - $record = Cache::remember($this->getCacheKey(), 1440, function() { - return $this->model - ->where('item', $this->recordCode) - ->first(); - }); + // + // @todo L5 disabled until bug is fixed + // + // $record = Cache::remember($this->getCacheKey(), 1440, function() { + // return $this->model + // ->where('item', $this->recordCode) + // ->first(); + // }); + + $record = $this->model + ->where('item', $this->recordCode) + ->first(); return $record ?: null; } diff --git a/modules/system/classes/Controller.php b/modules/system/classes/Controller.php index 5bd3e4431..d607c3494 100644 --- a/modules/system/classes/Controller.php +++ b/modules/system/classes/Controller.php @@ -1,6 +1,6 @@