Skip to content

Instantly share code, notes, and snippets.

@Boorj
Last active August 29, 2015 14:21
Show Gist options
  • Save Boorj/343d6381da30c6d16878 to your computer and use it in GitHub Desktop.
Save Boorj/343d6381da30c6d16878 to your computer and use it in GitHub Desktop.
<?php
/**
* Bolt config v0.1 (16.05.2015)
*/
// My server (apache on localhost and nginx on remote) takes /web dir as web_dir
// 1.
// Remote server index file is app.php
// # web/app.php :
define('ENV', 'prod');
require_once "index.php";
// 2.
// Local server index file is app_dev.php
// # web/app_dev.php :
define('ENV', 'dev'); //TODO ip list check as in symfony's app_dev.php
require_once "index.php";
// 3.
// # web/index.php :
$vendor_dir = 'app/vendor';
$files_dir = 'up'; // relatively to web dir
require_once "../{$vendor_dir}/autoload.php";
$configuration = new Bolt\Configuration\Composer(dirname(__DIR__));
$configuration->setPath('vendor_dir', $vendor_dir);
$configuration->setPath('cache', 'app/vars/cache');
$configuration->setPath('database', 'app/database'); // as default
$configuration->setPath('extensionspath', 'app/extensions');
$configuration->setPath("themebase", "src");
$configuration->setPath('config', 'src/config');
$configuration->setPath('extensionsconfig', 'src/config/extensions');
$configuration->setPath("web", 'web');
$configuration->setPath('files', "web/{$files_dir}");
$configuration->getVerifier()->disableApacheChecks();
$configuration->verify();
$app = new Bolt\Application(array('resources'=>$configuration));
$app->initialize();
// custom thumbnails dir
$app->mount("/{$files_dir}/thumbs", new \Bolt\Thumbs\ThumbnailProvider());
//my precious mthaml
$app->register(new SilexMtHaml\MtHamlServiceProvider());
// FrontEnd controller with suctom actions
require_once "../src/controllers/Front.php";
//i copied default functions there, so now i can use this in routing:
// defaults: { _controller: 'App\Controllers\Front::listing', 'contenttypeslug': 'rings', }
$app->run();
// 4.
// Also had to change vendor dir location
// added this to composer.json
, "config": {
"vendor-dir": "app/vendor/"
}
//changed bolt/bolt/src/Application.php # line 264
$app['resources']->getPath('root') . '/vendor/symfony/web-profiler-bundle/Symfony/Bundle/WebProfilerBundle/Resources/views',
//to
$app['resources']->getPath('vendor_dir') . '/symfony/web-profiler-bundle/Symfony/Bundle/WebProfilerBundle/Resources/views',
// and bolt/bolt/src/Application.php # line 323, 324
require_once $this['resources']->getPath('root/vendor/symfony/locale/Symfony/Component/Locale/Resources/stubs/functions.php');
require_once $this['resources']->getPath('root/vendor/symfony/locale/Symfony/Component/Locale/Resources/stubs/IntlDateFormatter.php');
// to
require_once $this['resources']->getPath($this['resources']->getPath('vendor_dir') . '/symfony/locale/Symfony/Component/Locale/Resources/stubs/functions.php');
require_once $this['resources']->getPath($this['resources']->getPath('vendor_dir') . '/symfony/locale/Symfony/Component/Locale/Resources/stubs/IntlDateFormatter.php');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment