Only protect file if it was written
This commit is contained in:
parent
8a48e9ce78
commit
54f1cb9d34
|
@ -116,10 +116,10 @@ abstract class persistence
|
||||||
self::_initialize();
|
self::_initialize();
|
||||||
$file = self::$_path . DIRECTORY_SEPARATOR . $filename;
|
$file = self::$_path . DIRECTORY_SEPARATOR . $filename;
|
||||||
$writtenBytes = @file_put_contents($file, $data, LOCK_EX);
|
$writtenBytes = @file_put_contents($file, $data, LOCK_EX);
|
||||||
chmod($file, 0640); // protect file access
|
|
||||||
if ($writtenBytes === false || $writtenBytes < strlen($data)) {
|
if ($writtenBytes === false || $writtenBytes < strlen($data)) {
|
||||||
throw new Exception('unable to write to file ' . $file, 13);
|
throw new Exception('unable to write to file ' . $file, 13);
|
||||||
}
|
}
|
||||||
|
chmod($file, 0640); // protect file access
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue