Exemplo n.º 1
0
 public function testUpdateOption()
 {
     $updateOption = array('ldap_contact_tmpl' => '1');
     OptionRepository::update($updateOption, 'default');
     $dataset = $this->createFlatXmlDataSet(dirname(__DIR__) . '/data/option.update.xml')->getTable('cfg_options');
     $tableResult = $this->getConnection()->createQueryTable('cfg_options', 'SELECT * FROM cfg_options');
     $this->assertTablesEqual($dataset, $tableResult);
 }
Exemplo n.º 2
0
 /**
  * 
  * @return type
  */
 public static function getGlobalValues()
 {
     $globalOptions = array();
     $defaultOptionskeys = array('rrd_metric_path', 'rrd_status_path', 'rrd_path', 'rrd_port', 'storage_interval', 'broker_modules_directory', 'broker_data_directory');
     $defaultOptionsValues = OptionRepository::get('default', $defaultOptionskeys);
     foreach ($defaultOptionskeys as $key) {
         if (!isset($defaultOptionsValues[$key])) {
             $defaultOptionsValues[$key] = '';
         }
     }
     $defaultOptionsValuesKeys = array_keys($defaultOptionsValues);
     foreach ($defaultOptionsValuesKeys as &$optValue) {
         switch ($optValue) {
             case 'rrd_metric_path':
                 $optValue = 'rrd_metrics';
                 break;
             case 'rrd_status_path':
                 $optValue = 'rrd_status';
                 break;
             case 'storage_interval':
                 $optValue = 'interval';
                 break;
             default:
                 break;
         }
         $optValue = 'global_' . $optValue;
     }
     if (count($defaultOptionsValues)) {
         $globalOptions = array_combine($defaultOptionsValuesKeys, array_values($defaultOptionsValues));
     }
     return $globalOptions;
 }