Clean up, get front and backends operational again

This commit is contained in:
Samuel Georges 2015-02-05 19:47:20 +11:00
parent 03eb949e71
commit 4c29c5080d
16 changed files with 110 additions and 382 deletions

View File

@ -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`

View File

@ -1,73 +0,0 @@
<?php
/*
|--------------------------------------------------------------------------
| Application & Route Filters
|--------------------------------------------------------------------------
|
| Below you will find the "before" and "after" events for the application
| which may be used to do any work before or after a request into your
| application. Here you may also register your custom route filters.
|
*/
App::before(function ($request) {
//
});
App::after(function ($request, $response) {
//
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter('auth', function () {
// if (Auth::guest()) return Redirect::guest('login');
});
Route::filter('auth.basic', function () {
// return Auth::basic();
});
/*
|--------------------------------------------------------------------------
| Guest Filter
|--------------------------------------------------------------------------
|
| The "guest" filter is the counterpart of the authentication filters as
| it simply checks that the current user is not logged in. A redirect
| response will be issued if they are, which you may freely change.
|
*/
Route::filter('guest', function () {
// if (Auth::check()) return Redirect::to('/');
});
/*
|--------------------------------------------------------------------------
| CSRF Protection Filter
|--------------------------------------------------------------------------
|
| The CSRF filter is responsible for protecting your application against
| cross-site request forgery attacks. If this special token in a user
| session does not match the one given in this request, we'll bail.
|
*/
Route::filter('csrf', function () {
if (Session::token() !== Input::get('_token')) {
throw new Illuminate\Session\TokenMismatchException;
}
});

View File

@ -1,12 +0,0 @@
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/

View File

@ -1,12 +0,0 @@
<?php
/*
|--------------------------------------------------------------------------
| Register The Artisan Commands
|--------------------------------------------------------------------------
|
| Each available Artisan command must be registered with the console so
| that it is available to be called. We'll register every command so
| the console gets access to each of the command object instances.
|
*/

View File

@ -1,82 +0,0 @@
<?php
/*
|--------------------------------------------------------------------------
| Register The Laravel Class Loader
|--------------------------------------------------------------------------
|
| In addition to using Composer, you may use the Laravel class loader to
| load your controllers and models. This is useful for keeping all of
| your classes in the "global" namespace without Composer updating.
|
*/
ClassLoader::addDirectories(array(
app_path().'/commands',
app_path().'/controllers',
app_path().'/models',
app_path().'/database/seeds',
));
/*
|--------------------------------------------------------------------------
| Application Error Logger
|--------------------------------------------------------------------------
|
| Here we will configure the error logger setup for the application which
| is built on top of the wonderful Monolog library. By default we will
| build a basic log file setup which creates a single file for logs.
|
*/
Log::useFiles(storage_path().'/logs/system.log');
/*
|--------------------------------------------------------------------------
| Application Error Handler
|--------------------------------------------------------------------------
|
| Here you may handle any errors that occur in your application, including
| logging them or displaying custom views for specific errors. You may
| even register several error handlers to handle different types of
| exceptions. If nothing is returned, the default error view is
| shown, which includes a detailed stack trace during debug.
|
*/
App::error(function (Exception $exception, $code) {
/*
* October uses a custom error handler, see
* System\Classes\ErrorHandler::handleException
*/
});
/*
|--------------------------------------------------------------------------
| Maintenance Mode Handler
|--------------------------------------------------------------------------
|
| The "down" Artisan command gives you the ability to put an application
| into maintenance mode. Here, you will define what is displayed back
| to the user if maintenance mode is in effect for this application.
|
*/
App::down(function () {
return Response::make("Be right back!", 503);
});
/*
|--------------------------------------------------------------------------
| Require The Filters File
|--------------------------------------------------------------------------
|
| Next we will load the filters file for the application. This gives us
| a nice separate location to store our route and application filter
| definitions instead of putting them all in the main routes file.
|
*/
require app_path().'/filters.php';

View File

@ -41,57 +41,6 @@ $app->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

View File

@ -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'));

View File

@ -1,57 +0,0 @@
<?php
return array(
/*
|--------------------------------------------------------------------------
| Application Path
|--------------------------------------------------------------------------
|
| Here we just defined the path to the application directory. Most likely
| you will never need to change this value as the default setup should
| work perfectly fine for the vast majority of all our applications.
|
*/
'app' => __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',
);

View File

@ -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();

View File

@ -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;
/**

View File

@ -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);
}
}

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -1,6 +1,6 @@
<?php namespace System\Classes;
use Controller as BaseController;
use Illuminate\Routing\Controller as ControllerBase;
use ApplicationException;
use System\Classes\CombineAssets;
use Exception;
@ -11,7 +11,7 @@ use Exception;
* @package october\system
* @author Alexey Bobkov, Samuel Georges
*/
class Controller extends BaseController
class Controller extends ControllerBase
{
/**
* Combines JavaScript and StyleSheet assets.

View File

@ -5,29 +5,7 @@ return [
/*
* Laravel providers
*/
// 'Illuminate\Foundation\Providers\ArtisanServiceProvider',
// 'Illuminate\Cache\CacheServiceProvider',
// 'Illuminate\Session\CommandsServiceProvider',
// 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
// 'Illuminate\Routing\ControllerServiceProvider',
// 'Illuminate\Cookie\CookieServiceProvider',
// 'Illuminate\Encryption\EncryptionServiceProvider',
// 'Illuminate\Hashing\HashServiceProvider',
// 'Illuminate\Log\LogServiceProvider',
// 'Illuminate\Database\MigrationServiceProvider',
// 'Illuminate\Foundation\Providers\OptimizeServiceProvider',
// 'Illuminate\Pagination\PaginationServiceProvider',
// 'Illuminate\Queue\QueueServiceProvider',
// 'Illuminate\Redis\RedisServiceProvider',
// 'Illuminate\Remote\RemoteServiceProvider',
// 'Illuminate\Database\SeedServiceProvider',
// 'Illuminate\Foundation\Providers\ServerServiceProvider',
// 'Illuminate\Session\SessionServiceProvider',
// 'Illuminate\Validation\ValidationServiceProvider',
// 'Illuminate\View\ViewServiceProvider',
'Illuminate\Foundation\Providers\ArtisanServiceProvider',
// 'Illuminate\Auth\AuthServiceProvider',
'Illuminate\Bus\BusServiceProvider',
'Illuminate\Cache\CacheServiceProvider',
'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
@ -43,9 +21,7 @@ return [
'Illuminate\Pipeline\PipelineServiceProvider',
'Illuminate\Queue\QueueServiceProvider',
'Illuminate\Redis\RedisServiceProvider',
// 'Illuminate\Auth\Passwords\PasswordResetServiceProvider',
'Illuminate\Session\SessionServiceProvider',
// 'Illuminate\Translation\TranslationServiceProvider',
'Illuminate\Validation\ValidationServiceProvider',
'Illuminate\View\ViewServiceProvider',
@ -55,10 +31,9 @@ return [
'October\Rain\Cron\CronServiceProvider',
'October\Rain\Database\DatabaseServiceProvider',
'October\Rain\Filesystem\FilesystemServiceProvider',
// 'October\Rain\Config\ConfigServiceProvider',
'October\Rain\Html\HtmlServiceProvider',
'October\Rain\Network\NetworkServiceProvider',
'October\Rain\Translation\TranslationServiceProvider',
// 'October\Rain\Translation\TranslationServiceProvider',
'October\Rain\Scaffold\ScaffoldServiceProvider',
'October\Rain\Flash\FlashServiceProvider',
'October\Rain\Mail\MailServiceProvider',