Commit f11dc946 authored by Vincent Sherwood's avatar Vincent Sherwood

Separate the calls to unserialize() and file_get_contents() so that the size...

Separate the calls to unserialize() and file_get_contents() so that the size of the file contents can be logged in the debug message.
parent 119acfdc
...@@ -126,10 +126,11 @@ class FileStateMachine implements IStateMachine { ...@@ -126,10 +126,11 @@ class FileStateMachine implements IStateMachine {
// Read current sync state // Read current sync state
$filename = $this->getFullFilePath($devid, $type, $key, $counter); $filename = $this->getFullFilePath($devid, $type, $key, $counter);
ZLog::Write(LOGLEVEL_DEBUG, sprintf("FileStateMachine->GetState() on file: '%s'", $filename));
if(file_exists($filename)) { if(file_exists($filename)) {
return unserialize(file_get_contents($filename)); $contents = file_get_contents($filename);
$bytes = strlen($contents);
ZLog::Write(LOGLEVEL_DEBUG, sprintf("FileStateMachine->GetState() read '%d' bytes from file: '%s'", $bytes, $filename ));
return unserialize($contents);
} }
// throw an exception on all other states, but not FAILSAVE as it's most of the times not there by default // throw an exception on all other states, but not FAILSAVE as it's most of the times not there by default
else if ($type !== IStateMachine::FAILSAVE) else if ($type !== IStateMachine::FAILSAVE)
......
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