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 {
$record = null;
$out = array();
try {
if ($username === false) {
$sql = "SELECT DISTINCT(device_id) FROM users ORDER BY device_id";
if ($username === false) {
// 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();
}
else {
......
......@@ -724,6 +724,9 @@ class ASDevice extends StateObject {
if (is_array($this->backend2folderidCache)) {
return true;
}
if (!is_array($this->contentData)) {
return false;
}
foreach ($this->contentData as $folderid => $data) {
if (isset($data[self::FOLDERBACKENDID])) {
return true;
......
......@@ -771,7 +771,8 @@ class ZPushAdminCLI {
if ($device->GetFolderUUID($folderid)) {
$synchedFolders++;
$type = $device->GetFolderType($folderid);
$name = $device->GetHierarchyCache()->GetFolder($folderid)->displayname;
$folder = $device->GetHierarchyCache()->GetFolder($folderid);
$name = $folder ? $folder->displayname : "unknown";
switch($type) {
case SYNC_FOLDER_TYPE_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