this bug 6014 was solved, added a way to validate if a file exist

This commit is contained in:
Carlos Pacha
2011-01-26 21:16:48 +00:00
parent 3b5414df51
commit 60ea1b73a9

View File

@@ -93,9 +93,15 @@ class Translation extends BaseTranslation {
}
}
try {
if( ! is_dir(dirname($cacheFile)) )
G::mk_dir(dirname($cacheFile));
if (!file_exists($cacheFile) || !file_exists($cacheFileJS)){
$error = 'translation file does not exist';
throw new Exception($error);
}
$f = fopen( $cacheFile , 'w+');
fwrite( $f , "<?php\n" );
fwrite( $f , '$translation =' . 'unserialize(\'' . addcslashes( serialize ( $translation ), '\\\'' ) . "');\n");
@@ -113,6 +119,10 @@ class Translation extends BaseTranslation {
$res['rows'] = count ( $translation );
$res['rowsJS'] = count ( $translationJS );
return $res;
} catch( Exception $e ) {
//echo 'Caught exception: ', $e->getMessage(), "\n";
}
}
/**