コード例 #1
0
ファイル: File.php プロジェクト: newton27/dolphin.pro
 public function copyTo(MOXMAN_Vfs_IFile $dest)
 {
     if ($this->isDirectory()) {
         $dest->mkdir();
     } else {
         $fromStream = $this->open("rb");
         $toStream = $dest->open("wb");
         while (($buff = $fromStream->read(8192)) !== "") {
             $toStream->write($buff);
         }
         $fromStream->close();
         $toStream->close();
     }
 }
コード例 #2
0
ファイル: File.php プロジェクト: newton27/dolphin.pro
 /**
  * Copies this file to the specified file instance.
  *
  * @param MCE_File $dest File to copy to.
  */
 public function copyTo(MOXMAN_Vfs_IFile $dest)
 {
     if ($this->exists() && $this->isDirectory()) {
         if (!$this->isFileOrEmptyDir()) {
             throw new MOXMAN_Exception("Copy non empty folders not supported by Azure.");
         } else {
             $dest->mkdir();
             return;
         }
     }
     if ($dest instanceof MOXMAN_Azure_File) {
         $containerUrl = MOXMAN_Util_PathUtils::combine($this->fileSystem->getContainerOption("account"), $this->fileSystem->getContainerOption("name"));
         $fromUrl = "/" . MOXMAN_Util_PathUtils::combine($containerUrl, $this->getInternalPath());
         $request = $this->getFileSystem()->createRequest(array("method" => "PUT", "path" => $dest->getInternalPath(), "headers" => array("x-ms-copy-source" => $fromUrl, "Content-Length" => 0)));
         $this->getFileSystem()->sendRequest($request);
     } else {
         $fromStream = $this->open("rb");
         $toStream = $dest->open("wb");
         while (($buff = $fromStream->read(8192)) !== "") {
             $toStream->write($buff);
         }
         $fromStream->close();
         $toStream->close();
     }
 }
コード例 #3
0
ファイル: File.php プロジェクト: newton27/dolphin.pro
 /**
  * Copies this file to the specified file instance.
  *
  * @param MCE_File $dest File to copy to.
  */
 public function copyTo(MOXMAN_Vfs_IFile $dest)
 {
     if ($this->exists() && $this->isDirectory()) {
         if (!$this->isFileOrEmptyDir()) {
             throw new MOXMAN_Exception("Copy non empty folders not supported by S3.");
         } else {
             $dest->mkdir();
             return;
         }
     }
     if ($dest instanceof MOXMAN_AmazonS3_File) {
         $fromPath = $this->getInternalPath();
         $toPath = $dest->getInternalPath();
         if ($this->isDirectory()) {
             $fromPath .= "/";
             $toPath .= "/";
         }
         $this->getFileSystem()->getClient()->copy($fromPath, $toPath);
         $dest->removeStatCache();
     } else {
         $fromStream = $this->open("rb");
         $toStream = $dest->open("wb");
         while (($buff = $fromStream->read(8192)) !== "") {
             $toStream->write($buff);
         }
         $fromStream->close();
         $toStream->close();
     }
 }