Skip to content

Commit

Permalink
Migrate bootstrap process
Browse files Browse the repository at this point in the history
  • Loading branch information
daftspunk committed Feb 4, 2015
1 parent b1b7003 commit ed22cc9
Show file tree
Hide file tree
Showing 35 changed files with 223 additions and 128 deletions.
8 changes: 0 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
* **Build !!!** (2015-!!-!!)
- **Upgraded framework to Laravel version 5**
- Renamed classes:
```
October\Rain\Support\Yaml -> Yaml
October\Rain\Support\Markdown -> Markdown
System\Classes\ApplicationException -> ApplicationException
System\Classes\SystemException -> SystemException
October\Rain\Support\ValidationException -> ValidationException
```
- Introduced a linking policy to control the way URLs are generated globally (see config cms.linkPolicy).

* **Build 18x** (2015-01-xx)
Expand Down
15 changes: 15 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### Renamed classes:

October\Rain\Support\Yaml -> Yaml
October\Rain\Support\Markdown -> Markdown
System\Classes\ApplicationException -> ApplicationException
System\Classes\SystemException -> SystemException
October\Rain\Support\ValidationException -> ValidationException


### File system changes

[MOVE] /app/config -> /config
[MOVE] /app/storage -> /storage
[CREATE] /storage/framework

1 change: 0 additions & 1 deletion app/storage/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions app/storage/twig/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions app/storage/views/.gitignore

This file was deleted.

53 changes: 33 additions & 20 deletions bootstrap/start.php → bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,35 @@
|
*/

$app = new Illuminate\Foundation\Application;
$app = new October\Rain\Foundation\Application(
realpath(__DIR__.'/../')
);

/*
|--------------------------------------------------------------------------
| Detect The Application Environment
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Laravel takes a dead simple approach to your application environments
| so you can just specify a machine name or HTTP host that matches a
| given environment, then we will automatically detect it for you.
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/

$env = $app->detectEnvironment(function () {
return getenv('CMS_ENV') ?: 'production';
});
$app->singleton(
'Illuminate\Contracts\Http\Kernel',
'October\Rain\Foundation\Http\Kernel'
);

$app->singleton(
'Illuminate\Contracts\Console\Kernel',
'October\Rain\Foundation\Console\Kernel'
);

$app->singleton(
'Illuminate\Contracts\Debug\ExceptionHandler',
'October\Rain\Foundation\Exceptions\Handler'
);

/*
|--------------------------------------------------------------------------
Expand All @@ -39,7 +52,7 @@
|
*/

$app->bindInstallPaths(require __DIR__.'/paths.php');
// $app->bindInstallPaths(require __DIR__.'/paths.php');

/*
|--------------------------------------------------------------------------
Expand All @@ -52,25 +65,25 @@
|
*/

$framework = $app['path.base'].'/vendor/laravel/framework/src';
// $framework = $app['path.base'].'/vendor/laravel/framework/src';

require $framework.'/Illuminate/Foundation/start.php';
// 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');
}
// 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');
// }

/*
|--------------------------------------------------------------------------
Expand Down
32 changes: 4 additions & 28 deletions bootstrap/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,11 @@
|
*/

if (file_exists($compiled = __DIR__.'/compiled.php')) {
require $compiled;
}
$compiledPath = __DIR__.'/../storage/framework/compiled.php';

/*
|--------------------------------------------------------------------------
| Setup Patchwork UTF-8 Handling
|--------------------------------------------------------------------------
|
| The Patchwork library provides solid handling of UTF-8 strings as well
| as provides replacements for all mb_* and iconv type functions that
| are not available by default in PHP. We'll setup this stuff here.
|
*/

Patchwork\Utf8\Bootup::initMbstring();
if (file_exists($compiledPath)) {
require $compiledPath;
}

/*
|--------------------------------------------------------------------------
Expand All @@ -55,16 +44,3 @@

October\Rain\Support\ClassLoader::register();
October\Rain\Support\ClassLoader::addDirectories(array(__DIR__.'/../modules', __DIR__.'/../plugins'));

/*
|--------------------------------------------------------------------------
| Register The Laravel Auto Loader
|--------------------------------------------------------------------------
|
| We register an auto-loader "behind" the Composer loader that can load
| model classes on the fly, even if the autoload files have not been
| regenerated for the application. We'll add it to the stack here.
|
*/

Illuminate\Support\ClassLoader::register();
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"require": {
"php": ">=5.4",
"laravel/framework": "4.2.*",
"laravel/framework": "5.0.*@dev",
"october/system": "~1.0",
"october/backend": "~1.0",
"october/cms": "~1.0",
Expand Down
27 changes: 14 additions & 13 deletions app/config/app.php → config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,20 @@

'cipher' => MCRYPT_RIJNDAEL_128,

/*
|--------------------------------------------------------------------------
| Logging Configuration
|--------------------------------------------------------------------------
|
| Here you may configure the log settings for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Settings: "single", "daily", "syslog"
|
*/
'log' => 'single',

/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
Expand All @@ -103,19 +117,6 @@
'System\ServiceProvider',
)),

/*
|--------------------------------------------------------------------------
| Service Provider Manifest
|--------------------------------------------------------------------------
|
| The service provider manifest is used by Laravel to lazy load service
| providers which are not needed for each request, as well to keep a
| list of all of the services. Here, you may set its storage spot.
|
*/

'manifest' => storage_path().'/meta',

/*
|--------------------------------------------------------------------------
| Class Aliases
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
38 changes: 32 additions & 6 deletions app/config/session.php → config/session.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

return array(
return [

/*
|--------------------------------------------------------------------------
Expand All @@ -11,12 +11,12 @@
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "native", "cookie", "database", "apc",
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "array"
|
*/

'driver' => 'native',
'driver' => env('SESSION_DRIVER', 'file'),

/*
|--------------------------------------------------------------------------
Expand All @@ -33,6 +33,19 @@

'expire_on_close' => false,

/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
*/

'encrypt' => false,

/*
|--------------------------------------------------------------------------
| Session File Location
Expand All @@ -44,7 +57,7 @@
|
*/

'files' => storage_path().'/sessions',
'files' => storage_path().'/framework/sessions',

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -83,7 +96,7 @@
|
*/

'lottery' => array(2, 100),
'lottery' => [2, 100],

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -124,4 +137,17 @@

'domain' => null,

);
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you if it can not be done securely.
|
*/

'secure' => false,

];
File renamed without changes.
File renamed without changes.
12 changes: 10 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
|
*/

$app = require_once __DIR__.'/bootstrap/start.php';
$app = require_once __DIR__.'/bootstrap/app.php';

/*
|--------------------------------------------------------------------------
Expand All @@ -37,4 +37,12 @@
|
*/

$app->run();
$kernel = $app->make('Illuminate\Contracts\Http\Kernel');

$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);

$response->send();

$kernel->terminate($request, $response);
2 changes: 1 addition & 1 deletion modules/backend/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function register()
$manager->registerFormWidget('Backend\FormWidgets\DataGrid', [
'label' => 'Data Grid',
'code' => 'datagrid'
]); // @deprecated if year >= 2015
]); // @deprecated if year >= 2016
$manager->registerFormWidget('Backend\FormWidgets\DataTable', [
'label' => 'Data Table',
'code' => 'datatable'
Expand Down
2 changes: 1 addition & 1 deletion modules/backend/classes/BackendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use App;
use File;
use Config;
use Controller as ControllerBase;
use Illuminate\Routing\Controller as ControllerBase;
use October\Rain\Router\Helper as RouterHelper;

/**
Expand Down
9 changes: 4 additions & 5 deletions modules/system/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public function register()
/*
* Register core providers
*/
App::register('October\Rain\Config\ConfigServiceProvider');
App::register('October\Rain\Translation\TranslationServiceProvider');

/*
Expand Down Expand Up @@ -103,10 +102,10 @@ public function register()
/*
* Error handling for uncaught Exceptions
*/
App::error(function (\Exception $exception, $httpCode) {
$handler = new ErrorHandler;
return $handler->handleException($exception, $httpCode);
});
// App::error(function (\Exception $exception, $httpCode) {
// $handler = new ErrorHandler;
// return $handler->handleException($exception, $httpCode);
// });

/*
* Write all log events to the database
Expand Down
Loading

0 comments on commit ed22cc9

Please sign in to comment.