Commit 4bda5a06 authored by sebastian's avatar sebastian

ZP-574 #comment also clean up states with broken semantics

git-svn-id: https://z-push.org/svn/z-push/trunk@1962 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 7bf75211
...@@ -383,6 +383,7 @@ class FileStateMachine implements IStateMachine { ...@@ -383,6 +383,7 @@ class FileStateMachine implements IStateMachine {
* @return array(mixed) * @return array(mixed)
*/ */
public function GetAllStatesForDevice($devid) { public function GetAllStatesForDevice($devid) {
$types = array(IStateMachine::DEVICEDATA, IStateMachine::FOLDERDATA, IStateMachine::FAILSAVE, IStateMachine::HIERARCHY, IStateMachine::BACKENDSTORAGE);
$out = array(); $out = array();
$devdir = $this->getDirectoryForDevice($devid) . "/$devid-"; $devdir = $this->getDirectoryForDevice($devid) . "/$devid-";
...@@ -392,8 +393,9 @@ class FileStateMachine implements IStateMachine { ...@@ -392,8 +393,9 @@ class FileStateMachine implements IStateMachine {
$state = array('type' => false, 'counter' => false, 'uuid' => false); $state = array('type' => false, 'counter' => false, 'uuid' => false);
if (isset($parts[0]) && $parts[0] == IStateMachine::DEVICEDATA) // part 0 could be "devicedata" or another type in broken states
$state['type'] = IStateMachine::DEVICEDATA; if (isset($parts[0]) && in_array($parts[0], $types))
$state['type'] = $parts[0];
if (isset($parts[0]) && strlen($parts[0]) == 8 && if (isset($parts[0]) && strlen($parts[0]) == 8 &&
isset($parts[1]) && strlen($parts[1]) == 4 && isset($parts[1]) && strlen($parts[1]) == 4 &&
...@@ -411,7 +413,7 @@ class FileStateMachine implements IStateMachine { ...@@ -411,7 +413,7 @@ class FileStateMachine implements IStateMachine {
if (is_int($parts[5])) if (is_int($parts[5]))
$state['counter'] = $parts[5]; $state['counter'] = $parts[5];
else if (in_array($parts[5], array(IStateMachine::FOLDERDATA, IStateMachine::FAILSAVE, IStateMachine::HIERARCHY, IStateMachine::BACKENDSTORAGE))) else if (in_array($parts[5], $types))
$state['type'] = $parts[5]; $state['type'] = $parts[5];
} }
if (isset($parts[6]) && is_numeric($parts[6])) if (isset($parts[6]) && is_numeric($parts[6]))
......
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