From 88ea68af961b07c7450946a846d117ec40ab10d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Lorenzo=20Rodr=C3=ADguez=20Urdaneta?= Date: Fri, 23 Jul 2010 18:42:30 -0430 Subject: [PATCH] Using keyword self instead of Configure, removing use of File class in favor of SplFileObject --- cake/libs/configure.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/cake/libs/configure.php b/cake/libs/configure.php index 57c0a3dca4e..ce728902995 100644 --- a/cake/libs/configure.php +++ b/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); } } }