if (preg_match('/^' . $updateKey . '(|\\/index\\/)/', $parameter)) { $isUpdater = true; } elseif (BC_INSTALLED && !$isMaintenance && (!empty($bcSite['version']) && getVersion() > $bcSite['version'])) { header('Location: ' . topLevelUrl(false) . baseUrl() . 'maintenance/index'); exit; } Configure::write('BcRequest.isUpdater', $isUpdater); } /** * プラグインをCake側で有効化 * * カレントテーマのプラグインも読み込む */ if (BC_INSTALLED && !$isUpdater && !$isMaintenance) { App::build(array('Plugin' => array_merge(array(BASER_THEMES . $bcSite['theme'] . DS . 'Plugin' . DS), App::path('Plugin')))); $plugins = getEnablePlugins(); foreach ($plugins as $plugin) { loadPlugin($plugin['Plugin']['name'], $plugin['Plugin']['priority']); } $plugins = Hash::extract($plugins, '{n}.Plugin.name'); Configure::write('BcStatus.enablePlugins', $plugins); /** * イベント登録 */ App::uses('BcControllerEventDispatcher', 'Event'); App::uses('BcModelEventDispatcher', 'Event'); App::uses('BcViewEventDispatcher', 'Event'); $CakeEvent = CakeEventManager::instance(); $CakeEvent->attach(new BcControllerEventDispatcher()); $CakeEvent->attach(new BcModelEventDispatcher()); $CakeEvent->attach(new BcViewEventDispatcher());
/** * 利用可能なプラグインのリストを取得する */ public function testGetEnablePlugins() { $result = getEnablePlugins(); $pluginNames = array($result[0]['Plugin']['name'], $result[1]['Plugin']['name'], $result[2]['Plugin']['name']); $expect = array('Blog', 'Feed', 'Mail'); $this->assertEquals($expect, $pluginNames, '利用可能なプラグインのリストを正しく取得できません'); }