diff --git a/.gitignore b/.gitignore index c64877870..e7de9ccf1 100644 --- a/.gitignore +++ b/.gitignore @@ -4,11 +4,11 @@ .idea/ .php_cs.cache .sass-cache/ -.vagrant/ +/.vagrant/ +/composer.lock +/composer.phar +/env/ +/site/ +/vendor/ bower_components/ -composer.lock -composer.phar -env/ node_modules/ -site/ -vendor/ diff --git a/composer.json b/composer.json index 3ebc1d7b6..0da5e71ca 100644 --- a/composer.json +++ b/composer.json @@ -15,31 +15,31 @@ "ext-fileinfo": "*", "ext-gd": "*", "ext-json": "*", - "erusev/parsedown-extra": "^0.7.0", + "erusev/parsedown-extra": "^0.7.1", "francodacosta/phmagick": "0.4.*@dev", - "google/apiclient": "^1.1.5", + "google/apiclient": "^1.1.6", "intervention/image": "^2.2.2", "ircmaxell/random-lib": "^1.1.0", "maennchen/zipstream-php": "^0.3.0", "moontoast/math": "^1.1.0", "ramsey/uuid": ">=2.8.3 <4.0", "reprovinci/solr-php-client": "^1.0.3", - "sendgrid/sendgrid": "^4.0.0", - "zendframework/zendframework1": "^1.12.16" + "sendgrid/sendgrid": "^4.0.1", + "zendframework/zendframework1": "^1.12.17" }, "require-dev": { "ext-xdebug": "*", - "fabpot/php-cs-fixer": "^1.10.2", + "fabpot/php-cs-fixer": "^1.11", "jokkedk/zfdebug": "^1.6.2", - "leafo/scssphp": "^0.3.2", + "leafo/scssphp": "^0.4.0", "phpcheckstyle/phpcheckstyle": "V0.14.1", "phpunit/dbunit": "^1.4.1", "phpunit/phpcov": "^2.0.2", - "phpunit/phpunit": "^4.8.16", + "phpunit/phpunit": "^4.8.19", "ramsey/uuid-console": "^1.0.0", "satooshi/php-coveralls": "^0.6.1", - "sensiolabs/security-checker": "^3.0.1", - "symfony/console": "^2.7.5" + "sensiolabs/security-checker": "^3.0.2", + "symfony/console": "^2.8.0" }, "suggest": { "ext-imagick": "*", diff --git a/core/Bootstrap.php b/core/Bootstrap.php index b88e4a35b..31c163da0 100644 --- a/core/Bootstrap.php +++ b/core/Bootstrap.php @@ -30,7 +30,7 @@ protected function _initDoctype() $this->bootstrap('view'); /** @var Zend_View $view */ - $view = $this->getResource('view'); + $view = $this->getResource('View'); $view->doctype('XHTML1_STRICT'); } @@ -109,6 +109,45 @@ protected function _initDatabase() return false; } + /** + * Initialize the cache. + * + * @return false|Zend_Cache_Core + */ + protected function _initCache() + { + $this->bootstrap('Config', 'Database'); + + if (Zend_Registry::get('configGlobal')->get('environment', 'production') === 'production') { + $frontendOptions = array( + 'automatic_serialization' => true, + 'lifetime' => 86400, + 'cache_id_prefix' => 'midas_', + ); + + if (extension_loaded('memcached') || session_save_path() === 'Memcache') { + $cache = Zend_Cache::factory('Core', 'Libmemcached', $frontendOptions, array()); + } elseif (extension_loaded('memcache')) { + $cache = Zend_Cache::factory('Core', 'Memcached', $frontendOptions, array()); + } else { + $cacheDir = UtilityComponent::getCacheDirectory().'/db'; + + if (is_dir($cacheDir) && is_writable($cacheDir)) { + $backendOptions = array('cache_dir' => $cacheDir); + $cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions); + } + } + + if ($cache !== false) { + Zend_Db_Table_Abstract::setDefaultMetadataCache($cache); + } + } + + Zend_Registry::set('cache', $cache); + + return $cache; + } + /** Initialize the error handler. */ protected function _initErrorHandle() { @@ -132,7 +171,7 @@ protected function _initErrorHandle() */ protected function _initInternationalization() { - $this->bootstrap(array('Config', 'Database', 'FrontController')); + $this->bootstrap(array('Cache', 'Config', 'Database', 'FrontController')); /** @var false|Zend_Db_Adapter_Abstract $database */ $database = $this->getResource('Database'); @@ -343,7 +382,7 @@ protected function _initSass() */ protected function _initRouter() { - $this->bootstrap(array('Config', 'Database', 'FrontController')); + $this->bootstrap(array('Cache', 'Config', 'Database', 'FrontController')); /** @var Zend_Controller_Front $frontController */ $frontController = $this->getResource('FrontController'); diff --git a/core/GlobalController.php b/core/GlobalController.php index f54523297..125b5f385 100644 --- a/core/GlobalController.php +++ b/core/GlobalController.php @@ -144,24 +144,6 @@ public function preDispatch() } } parent::preDispatch(); - if (!$this->isDebug()) { - $frontendOptions = array('automatic_serialization' => true, 'lifetime' => 86400, 'cache_id_prefix' => 'midas_'); - if (extension_loaded('memcached') || session_save_path() === 'Memcache' - ) { - $cache = Zend_Cache::factory('Core', 'Libmemcached', $frontendOptions, array()); - } elseif (extension_loaded('memcache')) { - $cache = Zend_Cache::factory('Core', 'Memcached', $frontendOptions, array()); - } else { - $cacheDir = UtilityComponent::getCacheDirectory().'/db'; - if (is_dir($cacheDir) && is_writable($cacheDir)) { - $backendOptions = array('cache_dir' => $cacheDir); - $cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions); - } - } - if (isset($cache)) { - Zend_Db_Table_Abstract::setDefaultMetadataCache($cache); - } - } } /**