/** * Command "Show users of device" * Prints informations about all users which use a device * * @return * @access public */ public static function CommandDeviceUsers() { $users = ZPushAdmin::ListUsers(self::$device); if (empty($users)) { echo "\tno user data synchronized to device\n"; } foreach ($users as $user) { echo "Synchronized by user: "******"\n"; self::printDeviceData(self::$device, $user); } }
/** * Command "Resync folder(s)" * Resyncs a folder type of a specific device/user or of all users * * @return * @access public */ public static function CommandResyncFolder() { // if no device is specified, search for all devices of a user. If user is not set, all devices are returned. if (self::$device === false) { $devicelist = ZPushAdmin::ListDevices(self::$user); if (empty($devicelist)) { echo "\tno devices/users found\n"; return true; } } else { $devicelist = array(self::$device); } foreach ($devicelist as $deviceId) { $users = ZPushAdmin::ListUsers($deviceId); foreach ($users as $user) { if (self::$user && self::$user != $user) { continue; } self::resyncFolder($deviceId, $user, self::$type); } } }
/** * Returns a list of all known devices with users and when they synchronized for the first time * * @access public * @return array */ public function ListDevicesDetails() { $devices = ZPushAdmin::ListDevices(false); $output = array(); ZLog::Write(LOGLEVEL_INFO, sprintf("WebserviceUsers::ListLastSync(): found %d devices", count($devices))); ZPush::GetTopCollector()->AnnounceInformation(sprintf("Retrieved details of %d devices and getting users", count($devices)), true); foreach ($devices as $deviceId) { $output[$deviceId] = array(); $users = ZPushAdmin::ListUsers($deviceId); foreach ($users as $user) { $output[$deviceId][$user] = ZPushAdmin::GetDeviceDetails($deviceId, $user); } } return $output; }