Load plugins after the cache initialization

This commit is contained in:
Fedor A. Fetisov 2016-12-28 19:31:22 +03:00
parent f44ccdc4e1
commit 547efb38e4
3 changed files with 12 additions and 5 deletions

View File

@ -22,6 +22,7 @@ require_once(dirname(__FILE__) . '/libs/init.php');
use Mibew\Cache\CacheFactory;
use Mibew\Maintenance\CronWorker;
use Mibew\Plugin\PluginManager;
$configs = load_system_configs();
@ -30,6 +31,11 @@ $cache_factory = new CacheFactory($configs['cache']);
// For now directory for cache files cannot be changed via the configs file.
$cache_factory->setOption('path', MIBEW_FS_ROOT . '/cache/stash');
// Run plugins
if (get_maintenance_mode() === false) {
PluginManager::getInstance()->loadPlugins($configs['plugins']);
}
// Do the job.
$worker = new CronWorker($cache_factory->getCache());
$success = $worker->run();

View File

@ -24,6 +24,7 @@ use Mibew\Application;
use Mibew\Authentication\AuthenticationManager;
use Mibew\Cache\CacheFactory;
use Mibew\Mail\MailerFactory;
use Mibew\Plugin\PluginManager;
use Mibew\Routing\Router;
use Mibew\Routing\Loader\CacheLoader;
use Mibew\Routing\Loader\PluginLoader;
@ -40,6 +41,11 @@ $cache_factory = new CacheFactory($configs['cache']);
// TODO: Evaluate possibility of using custom cache directory.
$cache_factory->setOption('path', MIBEW_FS_ROOT . '/cache/stash');
// Run plugins
if (get_maintenance_mode() === false) {
PluginManager::getInstance()->loadPlugins($configs['plugins']);
}
// The main route loader which loads nothig but works as a cache proxy for other
// loaders.
$route_loader = new CacheLoader($cache_factory->getCache());

View File

@ -101,8 +101,3 @@ require_once(MIBEW_FS_ROOT . '/libs/pagination.php');
require_once(MIBEW_FS_ROOT . '/libs/statistics.php');
require_once(MIBEW_FS_ROOT . '/libs/track.php');
require_once(MIBEW_FS_ROOT . '/libs/userinfo.php');
// Run plugins only after all libs are loaded.
if (get_maintenance_mode() === false) {
\Mibew\Plugin\PluginManager::getInstance()->loadPlugins($configs['plugins']);
}