1
0

added warning messages for easier inconsistency detection

This commit is contained in:
Thomas E. Horner 2012-03-16 08:29:06 +01:00
parent 5a023f5e0c
commit 3a3a26936e

View File

@ -47,17 +47,24 @@ class Gallery1DataParser {
* object Unserialized user metadata * object Unserialized user metadata
*/ */
function loadFile($fileName) { function loadFile($fileName) {
$fileName = str_replace('//','/',$fileName);
if (!file_exists($fileName) || !is_readable($fileName)) { if (!file_exists($fileName) || !is_readable($fileName)) {
if (file_exists($fileName . '.bak') && if (file_exists($fileName . '.bak') &&
is_readable($fileName . '.bak')) { is_readable($fileName . '.bak')) {
$fileName .= '.bak'; $fileName .= '.bak';
} else { } else {
message::warning(
t('Gallery1 inconsistency: Missing or not readable file %file',
array('file' => $fileName)));
return array('ERROR_BAD_PARAMETER', null); return array('ERROR_BAD_PARAMETER', null);
} }
} }
$tmp = file($fileName); $tmp = file($fileName);
if (empty($tmp)) { if (empty($tmp)) {
message::warning(
t('Gallery1 inconsistency: Empty file %file',
array('file' => $fileName)));
return array('ERROR_MISSING_VALUE', null); return array('ERROR_MISSING_VALUE', null);
} }