/** * Sets parameter in ppp options file. * * @param string $parameter parameter in options file * @param string $value value for given parameter * * @access private * @return void */ protected function _set_options_parameter($parameter, $value) { clearos_profile(__METHOD__, __LINE__); $file = new File(self::FILE_OPTIONS); if (empty($value)) { $file->delete_lines("/^{$parameter}\\s*/i"); } else { $match = $file->replace_lines("/^{$parameter}\\s*/i", "{$parameter} {$value}\n"); if (!$match) { $file->add_lines_after("{$parameter} {$value}\n", "/^[^#]/"); } } }
/** * Deletes a parameter. * * @param string $key parameter * @param string $config configuration file * * @access private * @return void * @throws Engine_Exception */ protected function _delete_parameter($key, $config = self::FILE_CONFIG) { clearos_profile(__METHOD__, __LINE__); if (!$this->is_loaded) { $this->_load_config(); } $this->is_loaded = FALSE; $this->config = array(); $file = new File($config, TRUE); $match = $file->delete_lines("/^{$key}\\s+/i"); }