/**
  *
  * @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;
 }
 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']);
 }
 /**
  * Remove the entire "pluginUpdatesServer" setting section, as this was
  * deprecated in Revive Adserver 3.1.0
  */
 function _removePluginUpdateServerSettings()
 {
     $this->logOnly("Attempting to remove the 'pluginUpdatesServer' settings from the configuration file");
     $oConfiguration = new OA_Admin_Settings();
     unset($oConfiguration->aConf['pluginUpdatesServer']['protocol']);
     unset($oConfiguration->aConf['pluginUpdatesServer']['host']);
     unset($oConfiguration->aConf['pluginUpdatesServer']['path']);
     unset($oConfiguration->aConf['pluginUpdatesServer']['httpPort']);
     if ($oConfiguration->writeConfigChange()) {
         $this->logOnly("Removed the 'pluginUpdatesServer' settings from the configuration file");
     } else {
         $this->logError("Failed to remove the 'pluginUpdatesServer' settings from the configuration file");
     }
 }
 /**
  * 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();
 }
示例#5
0
 /**
  * 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;
 }
示例#7
0
 /**
  * Following method merges geotargeting plugins config
  * into global config file. By doing that we are improving
  * delivery performance for scripts using geotargeting data
  * by more than 15%.
  *
  * @return boolean  True on success else false
  */
 function mergeConfigWith($section, $mergeWithConf)
 {
     $config = new OA_Admin_Settings();
     $config->bulkSettingChange($section, $mergeWithConf);
     return $config->writeConfigChange();
 }
示例#8
0
$GLOBALS['_MAX']['CONF']['pluginPaths']['packages'] = $GLOBALS['_MAX']['CONF']['pluginPaths']['extensions'] . 'etc/';
$aErrors = array();
$result = array('name' => '', 'status' => 'Invalid Request', 'errors' => &$aErrors);
if (validRequest($result)) {
    if ($_REQUEST['status'] === '0') {
        $result = installPlugin($_REQUEST['plugin']);
    } else {
        if ($_REQUEST['status'] === '1') {
            $result = checkPlugin($_REQUEST['plugin']);
        }
    }
}
// Undo hack
unset($GLOBALS['_MAX']['CONF']['pluginPaths']['extensions']);
$oSettings = new OA_Admin_Settings();
$oSettings->writeConfigChange();
require_once MAX_PATH . '/lib/JSON/JSON.php';
$json = new Services_JSON();
$output = $json->encode($result);
header("Content-Type: application/x-javascript");
echo $output;
function getPlugin($pluginName)
{
    include MAX_PATH . '/etc/default_plugins.php';
    if ($aDefaultPlugins) {
        foreach ($aDefaultPlugins as $idx => $aPlugin) {
            if ($pluginName == $aPlugin['name']) {
                return $aPlugin;
            }
        }
    }
 function testMergeConfigChanges()
 {
     // Build a test dist.conf.php
     $oDistConf = new OA_Admin_Settings(true);
     $oDistConf->aConf['foo'] = array('one' => 'bar', 'two' => 'baz', 'new' => 'additional_value');
     $oDistConf->aConf['webpath']['admin'] = 'disthost';
     $oDistConf->aConf['webpath']['delivery'] = 'disthost';
     $oDistConf->aConf['webpath']['deliverySSL'] = 'disthost';
     $oDistConf->aConf['new'] = array('new_key' => 'new_value');
     $distFilename = 'oa_test_dist' . rand();
     $this->assertTrue($oDistConf->writeConfigChange($this->basePath, $distFilename, false), 'Error writing config file');
     // Build a test user conf
     $oUserConf = new OA_Admin_Settings(true);
     $oUserConf->aConf['foo'] = array('one' => 'bar', 'two' => 'baz', 'old' => 'old_value');
     $oUserConf->aConf['deprecated'] = array('old_key' => 'old_value');
     $oUserConf->aConf['webpath']['admin'] = 'localhost';
     $oUserConf->aConf['webpath']['delivery'] = 'localhost';
     $oUserConf->aConf['webpath']['deliverySSL'] = 'localhost';
     $userFilename = 'oa_test_user' . rand();
     $this->assertTrue($oUserConf->writeConfigChange($this->basePath, $userFilename), 'Error writing config file');
     $expected = array('foo' => array('one' => 'bar', 'two' => 'baz', 'new' => 'additional_value'), 'webpath' => array('admin' => 'localhost', 'delivery' => 'localhost', 'deliverySSL' => 'localhost'), 'new' => array('new_key' => 'new_value'));
     $this->assertEqual($expected, $oUserConf->mergeConfigChanges($this->basePath . '/disthost.' . $distFilename . '.conf.php'), 'Config files don\'t match');
     // Clean up
     unlink($this->basePath . '/disthost.' . $distFilename . '.conf.php');
     unlink($this->basePath . '/localhost.' . $userFilename . '.conf.php');
     unlink($this->basePath . '/default.' . $distFilename . '.conf.php');
 }
 /**
  * Remove the UI "show contact us link" setting, as this was deprecated in
  * Revive Adserver 3.0.0
  */
 function _removeShowContactUsLinkSetting()
 {
     $this->logOnly("Attempting to remove the 'share data' sync setting from the configuration file");
     $oConfiguration = new OA_Admin_Settings();
     unset($oConfiguration->aConf['ui']['showContactUsLink']);
     if ($oConfiguration->writeConfigChange()) {
         $this->logOnly("Removed the 'share data' sync setting from the configuration file");
     } else {
         $this->logError("Failed to remove the 'share data' sync setting from the configuration file");
     }
 }