diff options
Diffstat (limited to 'framework/Exceptions/TException.php')
-rw-r--r-- | framework/Exceptions/TException.php | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/framework/Exceptions/TException.php b/framework/Exceptions/TException.php index c6a87b4d..073b587d 100644 --- a/framework/Exceptions/TException.php +++ b/framework/Exceptions/TException.php @@ -35,6 +35,7 @@ class TException extends Exception
{
private $_errorCode='';
+ static $_messageCache=array(); /**
* Constructor.
@@ -64,16 +65,20 @@ class TException extends Exception protected function translateErrorMessage($key)
{
$msgFile=$this->getErrorMessageFile();
- if(($entries=@file($msgFile))!==false)
- {
- foreach($entries as $entry)
+ + // Cache messages + if (!isset(self::$_messageCache[$msgFile])) + { + if(($entries=@file($msgFile))!==false)
{
- @list($code,$message)=explode('=',$entry,2);
- if(trim($code)===$key)
- return trim($message);
+ foreach($entries as $entry)
+ {
+ @list($code,$message)=explode('=',$entry,2);
+ self::$_messageCache[$msgFile][trim($code)]=trim($message); + }
}
- }
- return $key;
+ } + return isset(self::$_messageCache[$msgFile][$key]) ? self::$_messageCache[$msgFile][$key] : $key;
}
/**
|