function test_cachePreferenceOptions() { $oExtension = new OX_Extension_Common(); $GLOBALS['_MAX']['CONF']['pluginPaths']['packages'] = '/lib/OX/Extension/tests/data/'; $GLOBALS['_MAX']['CONF']['pluginGroupComponents'] = array('testPlugin' => 1); $this->_backupCacheFile('PrefOptions_Plugins'); $oExtension->cachePreferenceOptions(); $oCache = new OA_Cache('Plugins', 'PrefOptions'); $oCache->setFileNameProtection(false); $aPrefOptions = $oCache->load(true); $this->assertIsA($aPrefOptions, 'array'); $this->assertEqual(count($aPrefOptions), 1); $this->assertTrue(isset($aPrefOptions['testPlugin'])); $this->assertTrue(isset($aPrefOptions['testPlugin']['value'])); $this->assertTrue(isset($aPrefOptions['testPlugin']['name'])); $this->assertTrue(isset($aPrefOptions['testPlugin']['perm'])); $this->assertEqual($aPrefOptions['testPlugin']['name'], 'testPlugin'); $this->assertEqual($aPrefOptions['testPlugin']['text'], 'Option Text'); $this->assertEqual($aPrefOptions['testPlugin']['value'], 'account-preferences-plugin.php?group=testPlugin'); $this->assertEqual(count($aPrefOptions['testPlugin']['perm']), 4); $this->_restoreCacheFile('PrefOptions_Plugins'); TestEnv::restoreConfig(); }
function test_getListOfRegisteredComponentsForHook() { $GLOBALS['_MAX']['CONF']['pluginPaths']['packages'] = '/lib/OX/Plugin/tests/data/plugins/etc/'; $GLOBALS['_MAX']['CONF']['pluginPaths']['admin'] = '/lib/OX/Plugin/tests/data/www/admin/plugins/'; $GLOBALS['_MAX']['CONF']['plugins'] = array('testPluginPackage' => 1); $GLOBALS['_MAX']['CONF']['pluginGroupComponents'] = array('testPlugin' => 1); require_once LIB_PATH . '/Extension/ExtensionCommon.php'; //generate test cache $oExtension = new OX_Extension_Common(); $oExtension->cacheComponentHooks(); $aHooks = OX_Component::getListOfRegisteredComponentsForHook('duringTest'); $this->assertIsA($aHooks, 'array'); $this->assertEqual(count($aHooks), 1); $this->assertEqual($aHooks[0], 'admin:testPlugin:testPlugin'); //remove cache unset($GLOBALS['_MAX']['ComponentHooks']); $oCache = new OA_Cache('Plugins', 'ComponentHooks'); $oCache->setFileNameProtection(false); $oCache->clear(); //should auto regenerate cache $aHooks = OX_Component::getListOfRegisteredComponentsForHook('duringTest'); $this->assertIsA($aHooks, 'array'); $this->assertEqual(count($aHooks), 1); $this->assertEqual($aHooks[0], 'admin:testPlugin:testPlugin'); //cache file should be regenerated $aAllHooks = $oCache->load(); $this->assertEqual($aHooks, $aAllHooks['duringTest']); TestEnv::restoreConfig(); $oCache->clear(); }
protected function initInstallStatus($forceInit = false) { $oStorage = OX_Admin_UI_Install_InstallUtils::getSessionStorage(); $oStatus = $oStorage->get('installStatus'); //initialize status if : // 1) it's null // 2) recovery was recently discovered // 3) upgrader reports need for recovery // AD1) If recovery was finished we need to give installer a chanse to // reset to new state after recovery // AD2) If upgrader requires recovery we need to enforce it if ($oStatus == null || $oStatus->isRecovery() || $this->oUpgrader->isRecoveryRequired() || $forceInit) { //ask upgrader to determine installation status, also reset any data //stored by wizard $oStatus = new OX_Admin_UI_Install_InstallStatus($this->oUpgrader); $oStorage->set('installStatus', $oStatus); $oWizard = new OX_Admin_UI_Install_Wizard($oStatus); $oWizard->reset(); // Rebild component hooks to avoid problems with previous plugin installation require_once LIB_PATH . '/Extension/ExtensionCommon.php'; $oExtensionManager = new OX_Extension_Common(); $oExtensionManager->cacheComponentHooks(); } $this->oInstallStatus = $oStatus; }
fwrite($fp, "\n********** getPluginsDiagnostics() var_dump: **********\n"); fwrite($fp, print_r($aPlugins['detail'], true)); fclose($fp); } break; case 'pref': // this rebuilds the cached array that holds the text and links // for the account-preferences drop-down list require_once LIB_PATH . '/Extension/ExtensionCommon.php'; $oExtensionManager = new OX_Extension_Common(); $oExtensionManager->cachePreferenceOptions(); break; case 'hook': // this rebuilds the cached array that holds the component hook registration array require_once LIB_PATH . '/Extension/ExtensionCommon.php'; $oExtensionManager = new OX_Extension_Common(); $oExtensionManager->cacheComponentHooks(); break; case 'reg': // currently rewrites delivery hooks to conf require_once LIB_PATH . '/Extension/ExtensionDelivery.php'; $oExtensionManager = new OX_Extension_Delivery(); $oExtensionManager->runTasksOnDemand(); break; case 'exp': $oTpl = new OA_Admin_Template('plugin-export.html'); require_once LIB_PATH . '/Plugin/PluginExport.php'; $oExporter = new OX_PluginExport(); $aErrors = array(); foreach ($GLOBALS['_MAX']['CONF']['plugins'] as $name => $enabled) { $aPlugins[$name]['file'] = '';
function runTasksAfterPluginDisable() { parent::runTasksAfterPluginDisable(); $this->_cacheAllMenus(); }
function runTasksAfterPluginDisable() { parent::runTasksAfterPluginDisable(); return $this->_cacheDeliveryHooks(); }