function __construct($filename, $section = null, $options = false) { $this->iniDataBackup = $this->iniData = $this->_parseRawIniFile($filename); $this->configfilename = $filename; //print_r( array_keys($this->iniData["development : production"]) ); parent::__construct($filename, $section, $options); }
public function __construct($filePath) { if (!file_exists($filePath)) { file_put_contents($filePath, ''); } $this->filePath = $filePath; parent::__construct($filePath, null, true); }
/** * * Creates a new test configuration * @param unknown_type $filePath */ public function __construct($filePath = null) { if (empty($filePath)) { $this->_allowModifications = true; return; } if (!file_exists($filePath)) { KalturaLog::debug("Test configuration doesn't exists [{$filePath}] creating new "); file_put_contents($filePath, ''); } $this->filePath = $filePath; parent::__construct($filePath, null, true); }
public function __construct($configFileName, $workerName, $maxInstances) { parent::__construct($configFileName, $workerName, true); $this->name = $workerName; $this->maxInstances = $maxInstances; if ($this->filter) { $filter = new KalturaBatchJobFilter(); foreach ($this->filter as $attr => $value) { $filter->{$attr} = $value; } $this->filter = $filter; } }
/** * If $config['create'] = true the config will be create if he doesn't exist. * * @param string Path to config file * @param string Section of config file * @param array Configuration array * @throw USVN_Exception */ public function __construct($filename, $section, $config = array()) { $this->_filename = $filename; if (!file_exists($filename)) { if (isset($config['create']) && $config['create'] === true) { if (@file_put_contents($filename, "[{$section}]\n") === false) { throw new USVN_Exception("Can't write config file %s.", $filename); } } else { throw new USVN_Exception("Can't open config file %s.", $filename); } } try { parent::__construct($filename, $section, true); } catch (Exception $e) { throw new USVN_Exception($e->getMessage()); } }
public function __construct($filename, $section = null, $options = false) { $options['allowModifications'] = true; try { parent::__construct($filename, $section, $options); } catch (Zend_Config_Exception $e) { // Catch invalid Section exceptions here... if (!count(sscanf($e->getMessage(), "Section '%s' cannot be found in %s"))) { throw $e; } // ...and provide a better one we can use to show a friendly error $validSections = array_keys($this->_loadIniFile($filename)); $superException = new Garp_Config_Ini_InvalidSectionException($e->getMessage()); $superException->setValidSections($validSections); throw $superException; } if (isset($this->config)) { $this->_mergeSubConfigs($section, $options); } }
public function load() { $this->configTimestamp = $this->calculateFileTimestamp(); $configFileName = $this->configFileName; KalturaLog::log("loading configuration {$configFileName} at " . $this->configTimestamp); if (is_dir($this->configFileName)) { $configFileName = kEnvironment::get('cache_root_path') . DIRECTORY_SEPARATOR . 'batch' . DIRECTORY_SEPARATOR . 'config.ini'; $this->implodeDirectoryFiles($configFileName); } $hostname = self::getHostname(); parent::__construct($configFileName, $hostname, true); $this->name = $hostname; $this->hostName = $hostname; $this->taskConfigList = array(); foreach ($this->enabledWorkers as $workerName => $maxInstances) { if (!$maxInstances) { continue; } $task = new KSchedularTaskConfig($configFileName, $workerName, $maxInstances); $task->setPartnerId($this->getPartnerId()); $task->setSecret($this->getSecret()); $task->setCurlTimeout($this->getCurlTimeout()); $task->setSchedulerId($this->getId()); $task->setSchedulerName($this->getName()); $task->setServiceUrl($this->getServiceUrl()); $task->setDwhPath($this->getDwhPath()); $task->setDirectoryChmod($this->getDirectoryChmod()); $task->setChmod($this->getChmod()); $task->setDwhEnabled($this->getDwhEnabled()); $task->setTimezone($this->getTimezone()); $task->setInitOnly(false); $task->setRemoteServerUrl($this->getRemoteServerUrl()); $task->setMaxIdleTime($this->getMaxIdleTime()); $this->taskConfigList[$workerName] = $task; } }
public function __construct() { $this->_fileConfig = FILE_PATH . DS . 'Configs' . DS . 'site.ini'; parent::__construct($this->_fileConfig, null, array('allowModifications' => true)); }
/** * Loads the section $section from the array $config for * access facilitated by nested object properties. * * * @param array $config * @param string|null $section * @param boolean|array $options * @throws Zend_Config_Exception * @return void */ public function __construct(array $config, $section = null, $options = false) { parent::__construct($config, $section, $options); }