當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Storage::deleteStorage方法代碼示例

本文整理匯總了PHP中Storage::deleteStorage方法的典型用法代碼示例。如果您正苦於以下問題:PHP Storage::deleteStorage方法的具體用法?PHP Storage::deleteStorage怎麽用?PHP Storage::deleteStorage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Storage的用法示例。


在下文中一共展示了Storage::deleteStorage方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: deleteUser

 /**
  *  @brief Delete a Mozilla Sync user.
  *
  *  DELETE https://server/pathname/version/username
  *
  *  Deletes the user account.
  *  NOTE: Requires simple authentication with the username and password associated with the account.
  *
  *  Return value:
  *  0 on success
  *
  *  Possible errors:
  *    503: there was an error removing the user
  *    404: the user does not exist in the database
  *    401: authentication failed
  *
  *  @param string $syncHash Mozilla Sync user hash of the user to be deleted.
  */
 private function deleteUser($syncHash)
 {
     if (User::isAutoCreateUser()) {
         //auto create accounts only
         Utils::changeHttpStatus(Utils::STATUS_INVALID_USER);
         Utils::writeLog("Failed to delete user " . $syncHash . ". Delete disabled");
     }
     if (User::syncUserExists($syncHash) === false) {
         Utils::changeHttpStatus(Utils::STATUS_NOT_FOUND);
         Utils::writeLog("Failed to delete user " . $syncHash . ". User does not exist.");
     }
     if (User::authenticateUser($syncHash) === false) {
         Utils::changeHttpStatus(Utils::STATUS_INVALID_USER);
         Utils::writeLog("Authentication for deleting user " . $syncHash . " failed.");
     }
     $syncId = User::syncHashToSyncId($syncHash);
     if ($syncId === false) {
         Utils::changeHttpStatus(Utils::STATUS_INVALID_USER);
         Utils::writeLog("Failed to convert user " . $syncHash . " to Sync ID.");
     }
     if (Storage::deleteStorage($syncId) === false) {
         Utils::changeHttpStatus(Utils::STATUS_MAINTENANCE);
         Utils::writeLog("Failed to delete storage for user " . $syncId . ".");
     }
     if (User::deleteUser($syncId) === false) {
         Utils::changeHttpStatus(Utils::STATUS_MAINTENANCE);
         Utils::writeLog("Failed to delete user " . $syncId . ".");
     }
     OutputData::write('0');
 }
開發者ID:mach-o,項目名稱:mozilla_sync,代碼行數:48,代碼來源:userservice.php

示例2: deleteUser

 /**
  *  @brief Detete user
  *
  *  DELETE https://server/pathname/version/username
  *
  *  Deletes the user account.
  *  NOTE: Requires simple authentication with the username and password associated with the account.
  *
  *  Return value:
  *  0 on success
  *
  *  Possible errors:
  *    503: there was an error removing the user
  *    404: the user does not exist in the database
  *    401: authentication failed
  *
  *  @param string $userName
  */
 private function deleteUser($syncUserHash)
 {
     if (User::syncUserExists($syncUserHash) == false) {
         Utils::changeHttpStatus(Utils::STATUS_NOT_FOUND);
         return true;
     }
     if (User::authenticateUser($syncUserHash) == false) {
         Utils::changeHttpStatus(Utils::STATUS_INVALID_USER);
         return true;
     }
     $userId = User::userHashToId($syncUserHash);
     if ($userId == false) {
         Utils::changeHttpStatus(Utils::STATUS_INVALID_USER);
         return true;
     }
     if (Storage::deleteStorage($userId) == false) {
         Utils::changeHttpStatus(Utils::STATUS_MAINTENANCE);
         return true;
     }
     if (User::deleteUser($userId) == false) {
         Utils::changeHttpStatus(Utils::STATUS_MAINTENANCE);
         return true;
     }
     OutputData::write('0');
     return true;
 }
開發者ID:netcon-source,項目名稱:apps,代碼行數:44,代碼來源:userservice.php

示例3: deleteStorage

 /**
  * @brief Deletes all records for the user
  *
  * HTTP request: DELETE https://server/pathname/version/username/storage
  *
  * Will return a precondition error unless an X-Confirm-Delete header is included.
  *
  * All delete requests return the timestamp of the action.
  *
  * @param integer $userId
  * @return bool true if success
  */
 private function deleteStorage($userId)
 {
     if (!isset($_SERVER['HTTP_X_CONFIRM_DELETE'])) {
         return false;
     }
     $result = Storage::deleteStorage($userId);
     if ($result == false) {
         return false;
     }
     OutputData::write(Utils::getMozillaTimestamp());
     return true;
 }
開發者ID:blablubli,項目名稱:owncloudapps,代碼行數:24,代碼來源:storageservice.php

示例4: deleteStorage

 /**
  * @brief Deletes all records for the specified user.
  *
  * HTTP request: DELETE https://server/pathname/version/username/storage
  *
  * Will return a precondition error unless an X-Confirm-Delete header is included.
  *
  * All delete requests return the timestamp of the action.
  *
  * @param integer $syncId The Sync user whose records will be deleted.
  * @return bool True on success, false otherwise.
  */
 private function deleteStorage($syncId)
 {
     // Only continue if X-Confirm-Delete header is set
     if (!isset($_SERVER['HTTP_X_CONFIRM_DELETE'])) {
         Utils::writeLog("Did not send X_CONFIRM_DELETE header when trying to delete all records for user " . $syncId . ".");
         return false;
     }
     $result = Storage::deleteStorage($syncId);
     if ($result === false) {
         Utils::writeLog("Failed to delete all records for user " . $syncId . ".");
         return false;
     }
     OutputData::write(Utils::getMozillaTimestamp());
     return true;
 }
開發者ID:mach-o,項目名稱:mozilla_sync,代碼行數:27,代碼來源:storageservice.php


注:本文中的Storage::deleteStorage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。