Commit fee7ee6e authored by Sebastian Kummer's avatar Sebastian Kummer

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

Merge pull request #257 in ZP/z-push from bugfix/ZP-941-on-remove-via-z-push-admin-the-devicedata to develop

* commit '7e2a03a1':
  ZP-941 GetAllDevices(false) needs to find devices with potentially obsolete states -> select on states table instead of users table, fixed warnings using z-push-admin.
parents 90905177 7e2a03a1
...@@ -457,8 +457,9 @@ class SqlStateMachine implements IStateMachine { ...@@ -457,8 +457,9 @@ class SqlStateMachine implements IStateMachine {
$record = null; $record = null;
$out = array(); $out = array();
try { try {
if ($username === false) { if ($username === false) {
$sql = "SELECT DISTINCT(device_id) FROM users ORDER BY device_id"; // we also need to find potentially obsolete states that have no link to the users table anymore
$sql = "SELECT DISTINCT(device_id) FROM states ORDER BY device_id";
$params = array(); $params = array();
} }
else { else {
......
...@@ -724,6 +724,9 @@ class ASDevice extends StateObject { ...@@ -724,6 +724,9 @@ class ASDevice extends StateObject {
if (is_array($this->backend2folderidCache)) { if (is_array($this->backend2folderidCache)) {
return true; return true;
} }
if (!is_array($this->contentData)) {
return false;
}
foreach ($this->contentData as $folderid => $data) { foreach ($this->contentData as $folderid => $data) {
if (isset($data[self::FOLDERBACKENDID])) { if (isset($data[self::FOLDERBACKENDID])) {
return true; return true;
......
...@@ -771,7 +771,8 @@ class ZPushAdminCLI { ...@@ -771,7 +771,8 @@ class ZPushAdminCLI {
if ($device->GetFolderUUID($folderid)) { if ($device->GetFolderUUID($folderid)) {
$synchedFolders++; $synchedFolders++;
$type = $device->GetFolderType($folderid); $type = $device->GetFolderType($folderid);
$name = $device->GetHierarchyCache()->GetFolder($folderid)->displayname; $folder = $device->GetHierarchyCache()->GetFolder($folderid);
$name = $folder ? $folder->displayname : "unknown";
switch($type) { switch($type) {
case SYNC_FOLDER_TYPE_APPOINTMENT: case SYNC_FOLDER_TYPE_APPOINTMENT:
case SYNC_FOLDER_TYPE_USER_APPOINTMENT: case SYNC_FOLDER_TYPE_USER_APPOINTMENT:
......
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