cvs: pear /Cache_Lite Cache_Lite.php

From: Date: Fri, 16 Aug 2002 09:44:41 +0000
Subject: cvs: pear /Cache_Lite Cache_Lite.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-5769@lists.php.net to get a copy of this message
fab Fri Aug 16 05:44:41 2002 EDT Modified files: /pear/Cache_Lite Cache_Lite.php Log: raiseError() method becomes public Index: pear/Cache_Lite/Cache_Lite.php diff -u pear/Cache_Lite/Cache_Lite.php:1.8 pear/Cache_Lite/Cache_Lite.php:1.9 --- pear/Cache_Lite/Cache_Lite.php:1.8 Sat Aug 10 16:54:40 2002 +++ pear/Cache_Lite/Cache_Lite.php Fri Aug 16 05:44:41 2002 @@ -11,7 +11,7 @@ * Technical choices are described in the 'docs/technical' file * * @package Cache_Lite -* @version $Id: Cache_Lite.php,v 1.8 2002/08/10 20:54:40 fab Exp $ +* @version $Id: Cache_Lite.php,v 1.9 2002/08/16 09:44:41 fab Exp $ * @author Fabien MARTY <fab@php.net> */ @@ -217,7 +217,7 @@ { $this->_setFileName($id, $group); if (!@unlink($this->_file)) { - Cache_Lite::_raiseError('Cache_Lite : Unable to remove cache !', -3); + Cache_Lite::raiseError('Cache_Lite : Unable to remove cache !', -3); return false; } return true; @@ -237,7 +237,7 @@ { $motif = ($group) ? "cache_$group_" : 'cache_'; if (!($dh = opendir($this->_cacheDir))) { - Cache_Lite::_raiseError('Cache_Lite : Unable to open cache directory !', -4); + Cache_Lite::raiseError('Cache_Lite : Unable to open cache directory !', -4); return false; } while ($file = readdir($dh)) { @@ -246,7 +246,7 @@ if (is_file($file)) { if (strpos($file, $motif, 0)) { if (!@unlink($file)) { - Cache_Lite::_raiseError('Cache_Lite : Unable to remove cache !', -3); + Cache_Lite::raiseError('Cache_Lite : Unable to remove cache !', -3); return false; } } @@ -268,7 +268,24 @@ { $this->_pearErrorMode = PEAR_ERROR_DIE; } - + + /** + * Trigger a PEAR error + * + * To improve performances, the PEAR.php file is included dynamically. + * The file is so included only when an error is triggered. So, in most + * cases, the file isn't included and perfs are much better. + * + * @param string $msg error message + * @param int $code error code + * @access public + */ + function raiseError($msg, $code) + { + include_once('PEAR.php'); + PEAR::raiseError($msg, $code, $this->_pearErrorMode); + } + // --- Private methods --- /** @@ -311,7 +328,7 @@ } return $data; } - Cache_Lite::_raiseError('Cache_Lite : Unable to read cache !', -2); + Cache_Lite::raiseError('Cache_Lite : Unable to read cache !', -2); return false; } @@ -336,7 +353,7 @@ @fclose($fp); return true; } - Cache_Lite::_raiseError('Cache_Lite : Unable to write cache !', -1); + Cache_Lite::raiseError('Cache_Lite : Unable to write cache !', -1); return false; } @@ -372,25 +389,8 @@ case 'strlen': return sprintf('% 32d', strlen($data)); default: - $this->_raiseError('Unknown controlType ! (available values are only \'md5\', \'crc32\', \'strlen\')', -5); + $this->raiseError('Unknown controlType ! (available values are only \'md5\', \'crc32\', \'strlen\')', -5); } - } - - /** - * Trigger a PEAR error - * - * To improve performances, the PEAR.php file is included dynamically. - * The file is so included only when an error is triggered. So, in most - * cases, the file isn't included and perfs are much better. - * - * @param string $msg error message - * @param int $code error code - * @access private - */ - function _raiseError($msg, $code) - { - include_once('PEAR.php'); - PEAR::raiseError($msg, $code, $this->_pearErrorMode); } }

« previous php.pear.cvs (#5769) next »