コード例 #1
0
ファイル: Hubic.php プロジェクト: perrich/hubicWebApp
 public function filetype($path)
 {
     $path = $this->normalizePath($path);
     if ($this->doesObjectExist($path)) {
         $object = $this->container->getPartialObject($path);
         return $this->getFileType($object);
     }
 }
コード例 #2
0
 public function filetype($path)
 {
     $path = $this->normalizePath($path);
     if ($this->doesObjectExist($path)) {
         $object = $this->container->getPartialObject($path);
         if ($object->getContentType() == 'application/directory') {
             return 'dir';
         } elseif ($object->getContentType() == 'httpd/unix-directory') {
             return 'dir';
         } else {
             return 'file';
         }
     }
 }
コード例 #3
0
ファイル: swift.php プロジェクト: pinoniq/core
 public function copy($path1, $path2)
 {
     $path1 = $this->normalizePath($path1);
     $path2 = $this->normalizePath($path2);
     $fileType = $this->filetype($path1);
     if ($fileType === 'file') {
         // make way
         $this->unlink($path2);
         try {
             $source = $this->container->getPartialObject($path1);
             $source->copy($this->bucket . '/' . $path2);
         } catch (ClientErrorResponseException $e) {
             \OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
             return false;
         }
     } else {
         if ($fileType === 'dir') {
             // make way
             $this->unlink($path2);
             try {
                 $source = $this->container->getPartialObject($path1 . '/');
                 $source->copy($this->bucket . '/' . $path2 . '/');
             } catch (ClientErrorResponseException $e) {
                 \OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
                 return false;
             }
             $dh = $this->opendir($path1);
             while ($file = readdir($dh)) {
                 if ($file === '.' || $file === '..') {
                     continue;
                 }
                 $source = $path1 . '/' . $file;
                 $target = $path2 . '/' . $file;
                 $this->copy($source, $target);
             }
         } else {
             //file does not exist
             return false;
         }
     }
     return true;
 }
コード例 #4
0
ファイル: RackspaceAdapter.php プロジェクト: jiiis/ptn
 /**
  * Get the metadata of an object.
  *
  * @param string $path
  *
  * @return DataObject
  */
 protected function getPartialObject($path)
 {
     $location = $this->applyPathPrefix($path);
     return $this->container->getPartialObject($location);
 }
コード例 #5
0
 /**
  * @param BaseContainer $container Parent container
  * @param               $name      Name of object
  */
 public function __construct(RendererInterface $renderer, BaseContainer $container, $name)
 {
     $this->renderer = $renderer;
     $this->dataObject = $container->getPartialObject($name);
 }