/** * Remove all state data for a device of the Request::GetGETUser() * * @param string $deviceId the device id * * @access public * @return boolean * @throws SoapFault */ public function RemoveDevice($deviceId) { $deviceId = preg_replace("/[^A-Za-z0-9]/", "", $deviceId); ZLog::Write(LOGLEVEL_INFO, sprintf("WebserviceDevice::RemoveDevice('%s'): remove device state data of user '%s'", $deviceId, Request::GetGETUser())); if (!ZPushAdmin::RemoveDevice(Request::GetGETUser(), $deviceId)) { ZPush::GetTopCollector()->AnnounceInformation(ZLog::GetLastMessage(LOGLEVEL_ERROR), true); throw new SoapFault("ERROR", ZLog::GetLastMessage(LOGLEVEL_ERROR)); } ZPush::GetTopCollector()->AnnounceInformation(sprintf("Removed device id '%s'", $deviceId), true); return true; }
/** * Command "Remove device" * Remove a device of that user from the device list * * @return * @access public */ public static function CommandRemoveDevice() { $stat = ZPushAdmin::RemoveDevice(self::$user, self::$device); if (self::$user === false) { echo sprintf("State data of device '%s' removed: %s", self::$device, $stat ? 'OK' : ZLog::GetLastMessage(LOGLEVEL_ERROR)) . "\n"; } elseif (self::$device === false) { echo sprintf("State data of all devices of user '%s' removed: %s", self::$user, $stat ? 'OK' : ZLog::GetLastMessage(LOGLEVEL_ERROR)) . "\n"; } else { echo sprintf("State data of device '%s' of user '%s' removed: %s", self::$device, self::$user, $stat ? 'OK' : ZLog::GetLastMessage(LOGLEVEL_ERROR)) . "\n"; } }