function testSettingChange() { $oConf = new OA_Admin_Settings(true); $oConf->settingChange('group', 'item', 'value'); $expected = array('group' => array('item' => 'value')); $this->assertEqual($expected, $oConf->aConf); }
function test_postscript_install_Client() { $oSettings = new OA_Admin_Settings(); $oSettings->settingChange('logging', 'sniff', '1'); $oSettings->writeConfigChange(); $this->assertTrue($GLOBALS['_MAX']['CONF']['logging']['sniff']); $oPostInstall = new postscript_install_Client(); $oPostInstall->execute(); $this->assertNull($GLOBALS['_MAX']['CONF']['logging']['sniff']); $this->assertTrue($GLOBALS['_MAX']['CONF']['Client']['sniff']); }
/** * * @return boolean True */ function execute() { if (isset($GLOBALS['_MAX']['CONF']['logging']['sniff'])) { $value = $GLOBALS['_MAX']['CONF']['logging']['sniff']; unset($GLOBALS['_MAX']['CONF']['logging']['sniff']); $oSettings = new OA_Admin_Settings(); $oSettings->settingChange('Client', 'sniff', $value); $oSettings->writeConfigChange(); } return true; }
/** * This method takes the array of registered hooks from the plugin/component group's XML files and saves a structured list in the config file * * @return boolean True if writing the config file change was sucessful false otherwise */ function _saveComponentHooks($aHooks = array()) { $oSettings = new OA_Admin_Settings(); if (!$oSettings) { return false; } // Clear out any existing hooks $oSettings->aConf['deliveryHooks'] = array(); foreach ($aHooks as $hookName => &$aComponentIdentifiers) { $aComponentIdentifiers = $this->orderDependencyComponents($hookName, $aComponentIdentifiers, $aHooks); $oSettings->settingChange('deliveryHooks', $hookName, implode('|', $aComponentIdentifiers)); } return $oSettings->writeConfigChange(); }
/** * Update checkForUpdates value into Settings * * @param boolean $syncEnabled * @return boolean */ function putSyncSettings($syncEnabled) { require_once MAX_PATH . '/lib/OA/Admin/Settings.php'; require_once MAX_PATH . '/lib/OA/Sync.php'; $oSettings = new OA_Admin_Settings(); $oSettings->settingChange('sync', 'checkForUpdates', $syncEnabled); // Reset Sync cache OA_Dal_ApplicationVariables::delete('sync_cache'); OA_Dal_ApplicationVariables::delete('sync_timestamp'); OA_Dal_ApplicationVariables::delete('sync_last_seen'); if (!$oSettings->writeConfigChange()) { $this->oLogger->logError('Error saving Sync settings to the config file'); return false; } // Generate a new Platform Hash if empty $platformHash = OA_Dal_ApplicationVariables::get('platform_hash'); if (empty($platformHash) && !OA_Dal_ApplicationVariables::set('platform_hash', OA_Dal_ApplicationVariables::generatePlatformHash())) { $this->oLogger->logError('Error inserting Platform Hash into database'); return false; } $oSync = new OA_Sync(); OA::disableErrorHandling(); $oSync->checkForUpdates(); OA::enableErrorHandling(); return true; }
function onEnable() { $oSettings = new OA_Admin_Settings(); $oSettings->settingChange('allowedBanners', 'video', '1'); $oSettings->writeConfigChange(); return true; }