Skip to content
Permalink
Browse files

Using keyword self instead of Configure, removing use of File class i…

…n favor of SplFileObject
  • Loading branch information...
lorenzo committed Jul 23, 2010
1 parent 766d7d5 commit 88ea68af961b07c7450946a846d117ec40ab10d3
Showing with 7 additions and 11 deletions.
  1. +7 −11 cake/libs/configure.php
@@ -249,7 +249,7 @@ public static function load($fileName) {
trigger_error(sprintf(__('Configure::load() - no variable $config found in %s.php'), $fileName), E_USER_WARNING);
return false;
}
return Configure::write($config);
return self::write($config);
}
/**
@@ -263,7 +263,7 @@ public static function load($fileName) {
public static function version() {
if (!isset(self::$_values['Cake']['version'])) {
require(CORE_PATH . 'cake' . DS . 'config' . DS . 'config.php');
Configure::write($config);
self::write($config);
}
return self::$_values['Cake']['version'];
}
@@ -292,7 +292,7 @@ public static function store($type, $name, $data = array()) {
if (is_null($type)) {
$write = false;
}
Configure::__writeConfig($content, $name, $write);
self::__writeConfig($content, $name, $write);
}
/**
@@ -308,7 +308,7 @@ public static function store($type, $name, $data = array()) {
private static function __writeConfig($content, $name, $write = true) {
$file = CACHE . 'persistent' . DS . $name . '.php';
if (Configure::read('debug') > 0) {
if (self::read('debug') > 0) {
$expires = "+10 seconds";
} else {
$expires = "+999 days";
@@ -320,13 +320,9 @@ private static function __writeConfig($content, $name, $write = true) {
}
if ($write === true) {
if (!class_exists('File')) {
require LIBS . 'file.php';
}
$fileClass = new File($file);
if ($fileClass->writable()) {
$fileClass->append($content);
$fileClass = new SplFileObject($file, 'a');
if ($fileClass->isWritable()) {
$fileClass->fwrite($content);
}
}
}

0 comments on commit 88ea68a

Please sign in to comment.
You can’t perform that action at this time.