Esempio n. 1
0
 /**
  * 画像をS3へアップロードする
  *
  * @return void
  **/
 private function _upload()
 {
     if (IS_EC2 === false) {
         return;
     }
     $upload_path = str_replace(ROOT . '/public_html/', '', $this->download_path);
     $this->S3->upload($this->download_path, $upload_path);
 }
Esempio n. 2
0
 /**
  * 指定パスのファイルをS3の指定パスへアップロードする
  *
  * @param  string $from_path
  * @param  string $to_path
  * @return void
  **/
 private function _uploadConents($from_path, $to_path)
 {
     if (IS_EC2 === false) {
         return false;
     }
     try {
         $this->S3->upload($from_path, $to_path);
     } catch (\Exception $e) {
         Logger::addLog($from_path . ' -> ' . $to_path);
         Logger::addLog('S3へのアップロードに失敗した' . PHP_EOL);
     }
 }
Esempio n. 3
0
 /**
  * S3に対象ディレクトリを同期する
  *
  * @param  string $target_directory
  * @return void
  */
 private function _sync($target_directory)
 {
     foreach (glob($target_directory . '*') as $path) {
         $file = str_replace(ROOT . '/public_html/', '', $path);
         if (in_array($file, $this->exclude_files)) {
             continue;
         }
         if (is_dir($path)) {
             $path .= '/';
             $this->_sync($path);
         } else {
             $this->s3->upload($path, $file);
         }
     }
 }
Esempio n. 4
0
 /**
  * セットアップ
  *
  * @return void
  **/
 public function setUp()
 {
     $this->manager = new ImageManager();
     $this->S3 = $this->getMock('Midnight\\Aws\\S3', array('upload'));
     $this->S3->expects($this->any())->method('upload')->will($this->returnValue(true));
 }