Commit b82056bc authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-1119 Show information about shared folders in z-push-admin.

Released under the Affero GNU General Public License (AGPL) version 3.
parent cf35c690
......@@ -744,6 +744,7 @@ class ZPushAdminCLI {
* @access private
*/
static private function printDeviceData($deviceId, $user) {
global $additionalFolders;
$device = ZPushAdmin::GetDeviceDetails($deviceId, $user);
if (! $device instanceof ASDevice) {
......@@ -809,6 +810,45 @@ class ZPushAdminCLI {
}
if (!$folderinfo) $folderinfo = "None available";
// additional folders
$addFolders = array();
$sharedFolders = $device->GetAdditionalFolders();
array_walk($sharedFolders, function (&$key) { $key["origin"] = 'Shared'; });
// $additionalFolders comes directly from the config
array_walk($additionalFolders, function (&$key) { $key["origin"] = 'Configured'; });
foreach(array_merge($additionalFolders,$sharedFolders) as $df) {
$syncfolderid = $device->GetFolderIdForBackendId($df['folderid'], false, false, null);
switch($df['type']) {
case SYNC_FOLDER_TYPE_USER_APPOINTMENT:
if (KOE_GAB_NAME != "" && $name == KOE_GAB_NAME) {
$gentype = "GAB";
}
else {
$gentype = "Calendar";
}
break;
case SYNC_FOLDER_TYPE_USER_CONTACT:
$gentype = "Contact";
break;
case SYNC_FOLDER_TYPE_USER_TASK:
$gentype = "Task";
break;
case SYNC_FOLDER_TYPE_USER_NOTE:
$gentype = "Note";
break;
default:
$gentype = "Email";
break;
}
if ($device->GetFolderType($syncfolderid) == SYNC_FOLDER_TYPE_UNKNOWN) {
$df['additional'] = "(KOE patching incomplete)";
}
$df['type'] = $gentype;
$df['synched'] = ($device->GetFolderUUID($syncfolderid))?'Active':'Inactive (not yet synchronized or no permissions)';
$addFolders[] = $df;
}
$additionalTotal = !empty($addFolders) ? count($addFolders) : 'none';
echo "-----------------------------------------------------\n";
echo "DeviceId:\t\t$deviceId\n";
echo "Device type:\t\t". ($device->GetDeviceType() !== ASDevice::UNDEFINED ? $device->GetDeviceType() : "unknown") ."\n";
......@@ -860,6 +900,10 @@ class ZPushAdminCLI {
}
}
}
echo "Additional Folders:\t$additionalTotal\n";
foreach ($addFolders as $folder) {
printf("\t%s %s %s %s %s %s\n", str_pad($folder['origin'], 10), str_pad($folder['type'], 8), str_pad($folder['store'], 14), str_pad($folder['name'], 20), $folder['synched'], $folder['additional']);
}
echo "Status:\t\t\t";
switch ($device->GetWipeStatus()) {
case SYNC_PROVISION_RWSTATUS_OK:
......
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