Commit 5c7a4b19 authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-641 Delete file only if it exists.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 7c89199f
......@@ -180,9 +180,11 @@ class FileStateMachine implements IStateMachine {
// TODO remove this block and implement it as described in ZP-835
if ($key === false && $type === IStateMachine::BACKENDSTORAGE) {
$file = $this->getFullFilePath($devid, $type, $key, $counter);
ZLog::Write(LOGLEVEL_DEBUG, sprintf("FileStateMachine->CleanStates(): Deleting 'bs' file: '%s'", $file));
unlink($file);
return;
if (file_exists($file)) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("FileStateMachine->CleanStates(): Deleting 'bs' file: '%s'", $file));
unlink($file);
return;
}
}
$matching_files = glob($this->getFullFilePath($devid, $type, $key). "*", GLOB_NOSORT);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment