Correct OC_Config writer. Use var_export (has support for array,...)
This commit is contained in:
parent
bef9b671ee
commit
72fe463f7f
1 changed files with 3 additions and 14 deletions
|
@ -152,23 +152,12 @@ class OC_Config{
|
||||||
*
|
*
|
||||||
* Saves the config to the config file.
|
* Saves the config to the config file.
|
||||||
*
|
*
|
||||||
* Known flaws: Strings are not escaped properly
|
|
||||||
*/
|
*/
|
||||||
public static function writeData(){
|
public static function writeData(){
|
||||||
// Create a php file ...
|
// Create a php file ...
|
||||||
$content = "<?php\n\$CONFIG = array(\n";
|
$content = "<?php\n\$CONFIG = ";
|
||||||
|
$content .= var_export(self::$cache, true);
|
||||||
foreach( self::$cache as $key => $value ){
|
$content .= ";\n?>\n";
|
||||||
if( is_bool( $value )){
|
|
||||||
$value = $value ? 'true' : 'false';
|
|
||||||
$content .= "\"$key\" => $value,\n";
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$value = str_replace( "'", "\\'", $value );
|
|
||||||
$content .= "\"$key\" => '$value',\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$content .= ");\n?>\n";
|
|
||||||
|
|
||||||
$filename = OC::$SERVERROOT."/config/config.php";
|
$filename = OC::$SERVERROOT."/config/config.php";
|
||||||
// Write the file
|
// Write the file
|
||||||
|
|
Loading…
Reference in a new issue