Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "*",
Expand Down
45 changes: 42 additions & 3 deletions core/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down Expand Up @@ -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()
{
Expand All @@ -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');
Expand Down Expand Up @@ -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');
Expand Down
18 changes: 0 additions & 18 deletions core/GlobalController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

/**
Expand Down