Commit 7e2a03a1 authored by Sebastian Kummer's avatar Sebastian Kummer

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.

Released under the Affero GNU General Public License (AGPL) version 3.
parent e6e8da1f
......@@ -458,7 +458,8 @@ class SqlStateMachine implements IStateMachine {
$out = array();
try {
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();
}
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;
......
......@@ -772,7 +772,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