Commit 23ac1fd3 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #8 in ZP/z-push from...

Merge pull request #8 in ZP/z-push from feature/ZP-642-improve-getstate-debug-messages-for to develop

ZP-642 #comment log bytes read from file to log message

* commit 'f11dc946':
  Separate the calls to unserialize() and file_get_contents() so that the size of the file contents can be logged in the debug message.
parents d645aa05 f11dc946
...@@ -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