• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP AmazonS3类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中AmazonS3的典型用法代码示例。如果您正苦于以下问题:PHP AmazonS3类的具体用法?PHP AmazonS3怎么用?PHP AmazonS3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了AmazonS3类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: execute

 protected function execute($arguments = array(), $options = array())
 {
     $this->configuration = ProjectConfiguration::getApplicationConfiguration($options['app'], $options['env'], true);
     if (!sfConfig::get('app_sf_amazon_plugin_access_key', false)) {
         throw new sfException(sprintf('You have not set an amazon access key'));
     }
     if (!sfConfig::get('app_sf_amazon_plugin_secret_key', false)) {
         throw new sfException(sprintf('You have not set an amazon secret key'));
     }
     $s3 = new AmazonS3(sfConfig::get('app_sf_amazon_plugin_access_key'), sfConfig::get('app_sf_amazon_plugin_secret_key'));
     $this->s3_response = $s3->create_bucket($arguments['bucket'], $options['region'], $options['acl']);
     if ($this->s3_response->isOk()) {
         $this->log('Bucketed is being created...');
         /* Since AWS follows an "eventual consistency" model, sleep and poll
            until the bucket is available. */
         $exists = $s3->if_bucket_exists($arguments['bucket']);
         while (!$exists) {
             // Not yet? Sleep for 1 second, then check again
             sleep(1);
             $exists = $s3->if_bucket_exists($arguments['bucket']);
         }
         $this->logSection('Bucket+', sprintf('"%s" created successfully', $arguments['bucket']));
     } else {
         throw new sfException($this->s3_response->body->Message);
     }
 }
开发者ID:JoshuaEstes,项目名称:sfAmazonPlugin,代码行数:26,代码来源:s3CreatebucketTask.class.php


示例2: tearDown

 public function tearDown()
 {
     if ($this->instance) {
         $s3 = new AmazonS3(array('key' => $this->config['amazons3']['key'], 'secret' => $this->config['amazons3']['secret']));
         if ($s3->delete_all_objects($this->id)) {
             $s3->delete_bucket($this->id);
         }
     }
 }
开发者ID:ryanshoover,项目名称:core,代码行数:9,代码来源:amazons3.php


示例3: getFileUrl

 public function getFileUrl($remotePath)
 {
     $response = $this->_s3->update_object($this->_bucket, $remotePath, array('acl' => AmazonS3::ACL_PUBLIC));
     if (!$response->isOK()) {
         return false;
     } else {
         return $response->header['_info']['url'];
     }
 }
开发者ID:otis22,项目名称:reserve-copy-system,代码行数:9,代码来源:Amazon.php


示例4: deleteBucket

 public static function deleteBucket($app)
 {
     $user_storage_s3 = Doctrine::getTable('GcrUserStorageS3')->findOneByAppId($app->getShortName());
     if ($user_storage_s3) {
         $account = GcrUserStorageS3Table::getAccount($app);
         define('AWS_KEY', $account->getAccessKeyId());
         define('AWS_SECRET_KEY', $account->getSecretAccessKey());
         gcr::loadSdk('aws');
         $api = new AmazonS3();
         $api->delete_bucket($user_storage_s3->getBucketName(), true);
         $user_storage_s3->delete();
     }
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:13,代码来源:GcrUserStorageS3Table.class.php


示例5: delete_xid

function delete_xid($db, $xid)
{
    $data = $db->Raw("SELECT server, link FROM userdb_uploads WHERE xid='{$xid}'");
    $server = $data[0]['server'];
    $link = $data[0]['link'];
    if ($server == 's3') {
        $s3 = new AmazonS3();
        $s3->delete_object('fb-music', $link);
    } else {
        $split = split("/", $data[0]['link']);
        $link = "/var/www/music/users/" . $split[4] . "/" . $split[5] . "/" . $split[6];
        unlink($link);
    }
    $db->Raw("DELETE FROM userdb_uploads WHERE xid='{$xid}'");
}
开发者ID:sjlu,项目名称:fb-music-app,代码行数:15,代码来源:maintenance.php


示例6: moveObject

 /**
  * Move a file or folder to a specific location
  *
  * @param string $from The location to move from
  * @param string $to The location to move to
  * @param string $point
  * @return boolean
  */
 public function moveObject($from, $to, $point = 'append')
 {
     $this->xpdo->lexicon->load('source');
     $success = false;
     if (substr(strrev($from), 0, 1) == '/') {
         $this->xpdo->error->message = $this->xpdo->lexicon('s3_no_move_folder', array('from' => $from));
         return $success;
     }
     if (!$this->driver->if_object_exists($this->bucket, $from)) {
         $this->xpdo->error->message = $this->xpdo->lexicon('file_err_ns') . ': ' . $from;
         return $success;
     }
     if ($to != '/') {
         if (!$this->driver->if_object_exists($this->bucket, $to)) {
             $this->xpdo->error->message = $this->xpdo->lexicon('file_err_ns') . ': ' . $to;
             return $success;
         }
         $toPath = rtrim($to, '/') . '/' . basename($from);
     } else {
         $toPath = basename($from);
     }
     $response = $this->driver->copy_object(array('bucket' => $this->bucket, 'filename' => $from), array('bucket' => $this->bucket, 'filename' => $toPath), array('acl' => AmazonS3::ACL_PUBLIC));
     $success = $response->isOK();
     if ($success) {
         $deleteResponse = $this->driver->delete_object($this->bucket, $from);
         $success = $deleteResponse->isOK();
     } else {
         $this->xpdo->error->message = $this->xpdo->lexicon('file_folder_err_rename') . ': ' . $to . ' -> ' . $from;
     }
     return $success;
 }
开发者ID:nervlin4444,项目名称:modx-cms,代码行数:39,代码来源:mods3mediasource.class.php


示例7: s3

 /**
  * Gets s3 object
  *
  * @param  boolean   $debug return error message instead of script stop
  * @return \AmazonS3 s3 object
  */
 public function s3($debug = false)
 {
     // This is workaround to composer autoloader
     if (!class_exists('CFLoader')) {
         throw new ClassNotFoundException('Amazon: autoload failed');
     }
     if (empty($this->_s3)) {
         \CFCredentials::set(array('@default' => array('key' => $this->getOption('key'), 'secret' => $this->getOption('secret'))));
         $this->_s3 = new \AmazonS3();
         $this->_s3->use_ssl = false;
         $this->_buckets = fn_array_combine($this->_s3->get_bucket_list(), true);
     }
     $message = '';
     $bucket = $this->getOption('bucket');
     if (empty($this->_buckets[$bucket])) {
         $res = $this->_s3->create_bucket($bucket, $this->getOption('region'));
         if ($res->isOK()) {
             $res = $this->_s3->create_cors_config($bucket, array('cors_rule' => array(array('allowed_origin' => '*', 'allowed_method' => 'GET'))));
             if ($res->isOK()) {
                 $this->_buckets[$bucket] = true;
             } else {
                 $message = (string) $res->body->Message;
             }
         } else {
             $message = (string) $res->body->Message;
         }
     }
     if (!empty($message)) {
         if ($debug == true) {
             return $message;
         }
         throw new ExternalException('Amazon: ' . $message);
     }
     return $this->_s3;
 }
开发者ID:ambient-lounge,项目名称:site,代码行数:41,代码来源:Amazon.php


示例8: testRemove

 /**
  * @covers mychaelstyle\storage\providers\AmazonS3::remove
  * @covers mychaelstyle\storage\providers\AmazonS3::__mergePutOptions
  * @covers mychaelstyle\storage\providers\AmazonS3::__formatUri
  * @depends testPut
  */
 public function testRemove()
 {
     if ($this->markIncompleteIfNoNetwork()) {
         return true;
     }
     // remove
     $this->object->remove($this->uri);
 }
开发者ID:mychaelstyle,项目名称:php-utils,代码行数:14,代码来源:AmazonS3Test.php


示例9: execute

 protected function execute($arguments = array(), $options = array())
 {
     $this->configuration = ProjectConfiguration::getApplicationConfiguration($options['app'], $options['env'], true);
     if (!sfConfig::get('app_sf_amazon_plugin_access_key', false)) {
         throw new sfException(sprintf('You have not set an amazon access key'));
     }
     if (!sfConfig::get('app_sf_amazon_plugin_secret_key', false)) {
         throw new sfException(sprintf('You have not set an amazon secret key'));
     }
     $s3 = new AmazonS3(sfConfig::get('app_sf_amazon_plugin_access_key'), sfConfig::get('app_sf_amazon_plugin_secret_key'));
     $response = $s3->delete_bucket($arguments['bucket'], $options['force']);
     if ($response->isOk()) {
         $this->logSection('Bucket-', sprintf('"%s" bucket has been deleted', $arguments['bucket']));
     } else {
         throw new sfException($this->body->Message);
     }
 }
开发者ID:JoshuaEstes,项目名称:sfAmazonPlugin,代码行数:17,代码来源:s3DeletebucketTask.class.php


示例10: execute

 protected function execute($arguments = array(), $options = array())
 {
     $this->configuration = ProjectConfiguration::getApplicationConfiguration($options['app'], $options['env'], true);
     // initialize the database connection
     //    $databaseManager = new sfDatabaseManager($this->configuration);
     //    $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     if (!sfConfig::get('app_sf_amazon_plugin_access_key', false)) {
         throw new sfException(sprintf('You have not set an amazon access key'));
     }
     if (!sfConfig::get('app_sf_amazon_plugin_secret_key', false)) {
         throw new sfException(sprintf('You have not set an amazon secret key'));
     }
     $s3 = new AmazonS3(sfConfig::get('app_sf_amazon_plugin_access_key'), sfConfig::get('app_sf_amazon_plugin_secret_key'));
     $response = $s3->list_buckets();
     if (!isset($response->body->Buckets->Bucket)) {
         throw new sfException($response->body->Message);
     }
     foreach ($response->body->Buckets->Bucket as $bucket) {
         $this->logSection(sprintf('%s', $bucket->Name), sprintf('created at "%s"', $bucket->Name, $bucket->CreationDate));
     }
 }
开发者ID:JoshuaEstes,项目名称:sfAmazonPlugin,代码行数:21,代码来源:s3ListbucketsTask.class.php


示例11: testSignature

 /**
  * testSetDate
  *
  * @return void
  * @author Rob Mcvey
  **/
 public function testSignature()
 {
     $this->AmazonS3->setDate('Sun, 22 Sep 2013 14:43:04 GMT');
     $stringToSign = "PUT" . "\n";
     $stringToSign .= "aUIOL+kLNYqj1ZPXnf8+yw==" . "\n";
     $stringToSign .= "image/png" . "\n";
     $stringToSign .= "Sun, 22 Sep 2013 14:43:04 GMT";
     $stringToSign .= "\n";
     $stringToSign .= "x-amz-acl:public-read" . "\n";
     $stringToSign .= "x-amz-meta-reviewedby:[email protected]" . "\n";
     $stringToSign .= "/bucket/copify.png";
     $signature = $this->AmazonS3->signature($stringToSign);
     $this->assertEqual('gbcL98O77pVLUSdcSIz4RCAots4=', $signature);
     $this->AmazonS3 = new AmazonS3(array('bang', 'fizz', 'lulz'));
     $signature = $this->AmazonS3->signature($stringToSign);
     $this->assertEqual('dF2swNTRWEs9LiMxdxiVeWPwCR0=', $signature);
 }
开发者ID:eltonrodrigues,项目名称:cakephp-amazon-s3,代码行数:23,代码来源:AmazonS3Test.php


示例12: _testS3Bucket

 function _testS3Bucket()
 {
     $AmazonS3 = new AmazonS3("", "");
     $res = $AmazonS3->ListBuckets();
     $this->assertTrue(is_array($res->Bucket), "ListBuckets returned array");
     $res = $AmazonS3->CreateBucket("MySQLDumps");
     $this->assertTrue($res, "Bucket successfull created");
     $res = $AmazonS3->CreateObject("fonts/test.ttf", "offload-public", "/tmp/PhotoEditService.wsdl", "plain/text");
     $this->assertTrue($res, "Object successfull created");
     $res = $AmazonS3->DownloadObject("fonts/test.ttf", "offload-public");
     $this->assertTrue($res, "Object successfull downloaded");
     $res = $AmazonS3->DeleteObject("fonts/test.ttf", "offload-public");
     $this->assertTrue($res, "Object successfull removed");
 }
开发者ID:jasherai,项目名称:libwebta,代码行数:14,代码来源:tests.php


示例13: _testS3Bucket

 function _testS3Bucket()
 {
     $AmazonS3 = new AmazonS3("0EJNVE9QFYY3TD554T02", "VOtWnbI2PmsqKOqDNVVgfLVsEnGD/6miiYDY552S");
     $res = $AmazonS3->ListBuckets();
     $this->assertTrue(is_array($res->Bucket), "ListBuckets returned array");
     $res = $AmazonS3->CreateBucket("MySQLDumps");
     $this->assertTrue($res, "Bucket successfull created");
     $res = $AmazonS3->CreateObject("fonts/test.ttf", "offload-public", "/tmp/PhotoEditService.wsdl", "plain/text");
     $this->assertTrue($res, "Object successfull created");
     $res = $AmazonS3->DownloadObject("fonts/test.ttf", "offload-public");
     $this->assertTrue($res, "Object successfull downloaded");
     $res = $AmazonS3->DeleteObject("fonts/test.ttf", "offload-public");
     $this->assertTrue($res, "Object successfull removed");
 }
开发者ID:rakesh-mohanta,项目名称:scalr,代码行数:14,代码来源:tests.php


示例14: error_reporting

 * v1. 22 June 2012
 *
 * what this script does?
 *
 * add caching  headers to an existing object
 *
 */
require_once "sdk-1.5.7/sdk.class.php";
error_reporting(-1);
$config = parse_ini_file("aws.ini");
$awsKey = $config["aws.key"];
$awsSecret = $config["aws.secret"];
$bucket = "test.indigloo";
$name = "garbage_bin_wallpaper.jpg";
$options = array("key" => $awsKey, "secret" => $awsSecret, "default_cache_config" => '', "certificate_authority" => true);
$s3 = new AmazonS3($options);
$exists = $s3->if_bucket_exists($bucket);
if (!$exists) {
    printf("S3 bucket %s does not exists \n", $bucket);
    exit;
}
$mime = NULL;
$response = $s3->get_object_metadata($bucket, $name);
//get content-type of existing object
if ($response) {
    $mime = $response["ContentType"];
}
if (empty($mime)) {
    printf("No mime found for object \n");
    exit;
}
开发者ID:rjha,项目名称:sc,代码行数:31,代码来源:s3-caching-headers.php


示例15: process_remote_copy

 function process_remote_copy($destination_type, $file, $settings)
 {
     pb_backupbuddy::status('details', 'Copying remote `' . $destination_type . '` file `' . $file . '` down to local.');
     pb_backupbuddy::set_greedy_script_limits();
     if (!class_exists('backupbuddy_core')) {
         require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
     }
     // Determine destination filename.
     $destination_file = backupbuddy_core::getBackupDirectory() . basename($file);
     if (file_exists($destination_file)) {
         $destination_file = str_replace('backup-', 'backup_copy_' . pb_backupbuddy::random_string(5) . '-', $destination_file);
     }
     pb_backupbuddy::status('details', 'Filename of resulting local copy: `' . $destination_file . '`.');
     if ($destination_type == 'stash2') {
         require_once ABSPATH . 'wp-admin/includes/file.php';
         pb_backupbuddy::status('details', 'About to begin downloading from URL.');
         $download = download_url($url);
         pb_backupbuddy::status('details', 'Download process complete.');
         if (is_wp_error($download)) {
             $error = 'Error #832989323: Unable to download file `' . $file . '` from URL: `' . $url . '`. Details: `' . $download->get_error_message() . '`.';
             pb_backupbuddy::status('error', $error);
             pb_backupbuddy::alert($error);
             return false;
         } else {
             if (false === copy($download, $destination_file)) {
                 $error = 'Error #3329383: Unable to copy file from `' . $download . '` to `' . $destination_file . '`.';
                 pb_backupbuddy::status('error', $error);
                 pb_backupbuddy::alert($error);
                 @unlink($download);
                 return false;
             } else {
                 pb_backupbuddy::status('details', 'File saved to `' . $destination_file . '`.');
                 @unlink($download);
                 return true;
             }
         }
     }
     // end stash2.
     if ($destination_type == 'stash') {
         $itxapi_username = $settings['itxapi_username'];
         $itxapi_password = $settings['itxapi_password'];
         // Load required files.
         pb_backupbuddy::status('details', 'Load Stash files.');
         require_once pb_backupbuddy::plugin_path() . '/destinations/stash/init.php';
         require_once dirname(dirname(__FILE__)) . '/destinations/_s3lib/aws-sdk/sdk.class.php';
         require_once pb_backupbuddy::plugin_path() . '/destinations/stash/lib/class.itx_helper.php';
         // Talk with the Stash API to get access to do things.
         pb_backupbuddy::status('details', 'Authenticating Stash for remote copy to local.');
         $stash = new ITXAPI_Helper(pb_backupbuddy_destination_stash::ITXAPI_KEY, pb_backupbuddy_destination_stash::ITXAPI_URL, $itxapi_username, $itxapi_password);
         $manage_url = $stash->get_manage_url();
         $request = new RequestCore($manage_url);
         $response = $request->send_request(true);
         // Validate response.
         if (!$response->isOK()) {
             $error = 'Request for management credentials failed.';
             pb_backupbuddy::status('error', $error);
             pb_backupbuddy::alert($error);
             return false;
         }
         if (!($manage_data = json_decode($response->body, true))) {
             $error = 'Did not get valid JSON response.';
             pb_backupbuddy::status('error', $error);
             pb_backupbuddy::alert($error);
             return false;
         }
         if (isset($manage_data['error'])) {
             $error = 'Error: ' . implode(' - ', $manage_data['error']);
             pb_backupbuddy::status('error', $error);
             pb_backupbuddy::alert($error);
             return false;
         }
         // Connect to S3.
         pb_backupbuddy::status('details', 'Instantiating S3 object.');
         $s3 = new AmazonS3($manage_data['credentials']);
         pb_backupbuddy::status('details', 'About to get Stash object `' . $file . '`...');
         try {
             $response = $s3->get_object($manage_data['bucket'], $manage_data['subkey'] . pb_backupbuddy_destination_stash::get_remote_path() . $file, array('fileDownload' => $destination_file));
         } catch (Exception $e) {
             pb_backupbuddy::status('error', 'Error #5443984: ' . $e->getMessage());
             error_log('err:' . $e->getMessage());
             return false;
         }
         if ($response->isOK()) {
             pb_backupbuddy::status('details', 'Stash copy to local success.');
             return true;
         } else {
             pb_backupbuddy::status('error', 'Error #894597845. Stash copy to local FAILURE. Details: `' . print_r($response, true) . '`.');
             return false;
         }
     } elseif ($destination_type == 'gdrive') {
         die('Not implemented here.');
         require_once pb_backupbuddy::plugin_path() . '/destinations/gdrive/init.php';
         $settings = array_merge(pb_backupbuddy_destination_gdrive::$default_settings, $settings);
         if (true === pb_backupbuddy_destination_gdrive::getFile($settings, $file, $destination_file)) {
             // success
             pb_backupbuddy::status('details', 'Google Drive copy to local success.');
             return true;
         } else {
             // fail
             pb_backupbuddy::status('details', 'Error #2332903. Google Drive copy to local FAILURE.');
//.........这里部分代码省略.........
开发者ID:elephantcode,项目名称:elephantcode,代码行数:101,代码来源:cron.php


示例16: AmazonS3

<?php

// Inizializzo la classe AmazonS3
$s3 = new AmazonS3();
// Creo un bucket per la memorizzazione di un file
$response = $s3->create_bucket('my-bucket', AmazonS3::REGION_US_E1);
if (!$response->isOK()) {
    die('Errore durante la creazione del bucket');
}
$data = file_get_contents('/my/local/dir/picture.jpg');
$response = $s3->create_object('my-bucket', 'picture.jpg', array('body' => $data));
if (!$response->isOK()) {
    die('Errore durante la memorizzazione del file');
}
echo "Il file è stato memorizzato con successo";
开发者ID:GrUSP,项目名称:php_best_practices,代码行数:15,代码来源:amazon_s3.php


示例17: error_reporting

#!/usr/bin/php
<?php 
/*
 * list_bucket_objects_raw.php
 *
 * Display the raw bucket data returned by list_objects
 *
 * Copyright 2009-2010 Amazon.com, Inc. or its affiliates. All Rights
 * Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"). You
 * may not use this file except in compliance with the License. A copy
 * of the License is located at
 *
 *       http://aws.amazon.com/apache2.0/
 *
 * or in the "license.txt" file accompanying this file. This file is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
 * OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the
 * License.
 */
error_reporting(E_ALL);
require_once 'sdk.class.php';
require_once 'include/book.inc.php';
// Create the S3 access object
$s3 = new AmazonS3();
// List the bucket
$res = $s3->list_objects(BOOK_BUCKET);
// Display the resulting object tree
print_r($res);
开发者ID:websider,项目名称:amazon-web-services,代码行数:31,代码来源:list_bucket_objects_raw.php


示例18: mysql_connect

$region = "";
if (!empty($authToken) && !empty($deviceID)) {
    $conn = mysql_connect(DB_HOST, DB_USERNAME, DB_PASSWORD) or die("Error:Couldn't connect to server");
    $db = mysql_select_db(DB_DBNAME, $conn) or die("Error:Couldn't select database");
    $query = "SELECT * FROM users WHERE authToken = '{$authToken}'";
    $result = mysql_query($query) or die("Error:Query Failed-1");
    if (mysql_num_rows($result) == 1) {
        $row = mysql_fetch_array($result);
        $username = $row["email"];
        $region = $row["region"];
    } else {
        die("Error: Incorrect authToken");
    }
    mysql_close($conn);
    $newFileName = md5($username . $deviceID) . "_";
    $s3 = new AmazonS3();
    $bucket = 'com.sanchitkarve.tb.usor';
    $response = $s3->get_object_list($bucket);
    $userFiles = array();
    $foundFiles = false;
    foreach ($response as $item) {
        if (startsWith($item, $newFileName)) {
            $userfiles[] = $item;
            $foundFiles = true;
        }
    }
    // create cloudfront link if possible
    $urls = "";
    //print_r($response);
    if ($foundFiles) {
        foreach ($userfiles as $uitem) {
开发者ID:nikunjkacha,项目名称:ThalliumBackup-Cloud,代码行数:31,代码来源:download.php


示例19: test

 public static function test($settings)
 {
     $remote_path = self::get_remote_path($settings['directory']);
     // Has leading and trailng slashes.
     // Try sending a file.
     $test_result = self::send($settings, dirname(__FILE__) . '/icon.png', true);
     // 3rd param true forces clearing of any current uploads.
     // S3 object for managing files.
     $manage_data = pb_backupbuddy_destination_stash::get_manage_data($settings);
     $s3_manage = new AmazonS3($manage_data['credentials']);
     if ($settings['ssl'] == 0) {
         @$s3_manage->disable_ssl(true);
     }
     // Delete sent file.
     $response = $s3_manage->delete_object($manage_data['bucket'], $manage_data['subkey'] . $remote_path . 'icon.png');
     if (!$response->isOK()) {
         pb_backupbuddy::status('details', 'Unable to delete test Stash file `' . $buname . '`. Details: `' . print_r($response, true) . '`.');
     }
     delete_transient('pb_backupbuddy_stashquota_' . $settings['itxapi_username']);
     // Delete quota transient since it probably has changed now.
     return $test_result;
 }
开发者ID:CherylMuniz,项目名称:fashion,代码行数:22,代码来源:init.php


示例20: get_amazons3_backup_bwd_comp

 function get_amazons3_backup_bwd_comp($args)
 {
     if ($this->iwp_mmb_function_exists('curl_init')) {
         require_once $GLOBALS['iwp_mmb_plugin_dir'] . '/lib/amazon_s3_bwd_comp/sdk.class.php';
         extract($args);
         $temp = '';
         try {
             CFCredentials::set(array('development' => array('key' => trim($as3_access_key), 'secret' => trim(str_replace(' ', '+', $as3_secure_key)), 'default_cache_config' => '', 'certificate_authority' => true), '@default' => 'development'));
             $s3 = new AmazonS3();
             if ($as3_site_folder == true) {
                 if (!empty($as3_directory)) {
                     $as3_directory .= '/' . $this->site_name;
                 } else {
                     $as3_directory = $this->site_name;
                 }
             }
             if (empty($as3_directory)) {
                 $single_as3_file = $backup_file;
             } else {
                 $single_as3_file = $as3_directory . '/' . $backup_file;
             }
             //$temp = ABSPATH . 'iwp_temp_backup.zip';
             $temp = wp_tempnam('iwp_temp_backup.zip');
             $s3->get_object($as3_bucket, $single_as3_file, array("fileDownload" => $temp));
         } catch (Exception $e) {
             return false;
         }
         return $temp;
     } else {
         return array('error' => 1);
     }
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:32,代码来源:backup.class.multicall.php



注:本文中的AmazonS3类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Amazon_EC2_Interface类代码示例发布时间:2022-05-23
下一篇:
PHP Am_Request类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap