|
|
|
@ -38,7 +38,7 @@ namespace OC; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* This class is responsible for reading and writing config.php, the very basic |
|
|
|
|
* configuration file of owncloud. |
|
|
|
|
* configuration file of ownCloud. |
|
|
|
|
*/ |
|
|
|
|
class Config { |
|
|
|
|
// associative array key => value |
|
|
|
@ -76,7 +76,7 @@ class Config { |
|
|
|
|
* $default will be returned. |
|
|
|
|
*/ |
|
|
|
|
public function getValue($key, $default = null) { |
|
|
|
|
if( array_key_exists( $key, $this->cache )) { |
|
|
|
|
if (isset($this->cache[$key])) { |
|
|
|
|
return $this->cache[$key]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -88,8 +88,8 @@ class Config { |
|
|
|
|
* @param string $key key |
|
|
|
|
* @param string $value value |
|
|
|
|
* |
|
|
|
|
* This function sets the value and writes the config.php. If the file can |
|
|
|
|
* not be written, false will be returned. |
|
|
|
|
* This function sets the value and writes the config.php. |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
public function setValue($key, $value) { |
|
|
|
|
// Add change |
|
|
|
@ -103,11 +103,11 @@ class Config { |
|
|
|
|
* @brief Removes a key from the config |
|
|
|
|
* @param string $key key |
|
|
|
|
* |
|
|
|
|
* This function removes a key from the config.php. If owncloud has no |
|
|
|
|
* write access to config.php, the function will return false. |
|
|
|
|
* This function removes a key from the config.php. |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
public function deleteKey($key) { |
|
|
|
|
if( array_key_exists( $key, $this->cache )) { |
|
|
|
|
if (isset($this->cache[$key])) { |
|
|
|
|
// Delete key from cache |
|
|
|
|
unset($this->cache[$key]); |
|
|
|
|
|
|
|
|
@ -169,7 +169,7 @@ class Config { |
|
|
|
|
throw new HintException( |
|
|
|
|
"Can't write into config directory 'config'", |
|
|
|
|
'You can usually fix this by giving the webserver user write access' |
|
|
|
|
.' to the config directory in owncloud'); |
|
|
|
|
.' to the config directory in ownCloud'); |
|
|
|
|
} |
|
|
|
|
// Prevent others not to read the config |
|
|
|
|
@chmod($this->configFilename, 0640); |
|
|
|
|