コード例 #1
0
ファイル: S3.php プロジェクト: nboss/respond
 public static function DeployDirectory($site, $local_dir, $keyPrefix)
 {
     // create AWS client
     $client = Aws\S3\S3Client::factory(array('key' => S3_KEY, 'secret' => S3_SECRET, 'region' => S3_LOCATION));
     $bucket = $site['Bucket'];
     // create a bucket if it doesn't already exist
     S3::CreateBucket($bucket);
     // set permissions
     $options = array('params' => array('ACL' => 'public-read'), 'concurrency' => 20, 'debug' => true);
     // sync folders, #ref: http://blogs.aws.amazon.com/php/post/Tx2W9JAA7RXVOXA/Syncing-Data-with-Amazon-S3
     $client->uploadDirectory($local_dir, $bucket, $site['FriendlyId'] . '/' . $keyPrefix, $options);
 }