Beispiel #1
0
 /**
  * Returns bucket object for backup operation.
  *
  * @param string $operation
  * @param string $check_word
  * @param string $file_name
  * @return CBitrixCloudBackupBucket
  * @throws CBitrixCloudException
  */
 private function _getBucket($operation, $check_word, $file_name)
 {
     if (!CModule::IncludeModule('clouds')) {
         throw new CBitrixCloudException("Module clouds not installed.");
     }
     $web_service = new CBitrixCloudBackupWebService();
     if ($operation === "write") {
         $obXML = $web_service->actionWriteFile($check_word, $file_name);
     } else {
         $obXML = $web_service->actionReadFile($check_word, $file_name);
     }
     $bucket_name = is_object($node = $obXML->SelectNodes("/control/bucket/bucket_name")) ? $node->textContent() : "";
     $bucket_location = is_object($node = $obXML->SelectNodes("/control/bucket/bucket_location")) ? $node->textContent() : "";
     $prefix = is_object($node = $obXML->SelectNodes("/control/bucket/prefix")) ? $node->textContent() : "";
     $access_key = is_object($node = $obXML->SelectNodes("/control/bucket/access_key")) ? $node->textContent() : "";
     $secret_key = is_object($node = $obXML->SelectNodes("/control/bucket/secret_key")) ? $node->textContent() : "";
     $session_token = is_object($node = $obXML->SelectNodes("/control/bucket/session_token")) ? $node->textContent() : "";
     $file_name = is_object($node = $obXML->SelectNodes("/control/bucket/file_name")) ? $node->textContent() : "";
     return new CBitrixCloudBackupBucket($bucket_name, $prefix, $access_key, $secret_key, $session_token, $check_word, $file_name, $bucket_location);
 }