コード例 #1
0
ファイル: owncloud.php プロジェクト: olucao/owncloud-core
 public function __construct($params)
 {
     // extract context path from host if specified
     // (owncloud install path on host)
     $host = $params['host'];
     $contextPath = '';
     $hostSlashPos = strpos($host, '/');
     if ($hostSlashPos !== false) {
         $contextPath = substr($host, $hostSlashPos);
         $host = substr($host, 0, $hostSlashPos);
     }
     if (substr($contextPath, 1) !== '/') {
         $contextPath .= '/';
     }
     if (isset($params['root'])) {
         $root = $params['root'];
         if (substr($root, 1) !== '/') {
             $root = '/' . $root;
         }
     } else {
         $root = '/';
     }
     $params['host'] = $host;
     $params['root'] = $contextPath . self::OC_URL_SUFFIX . $root;
     parent::__construct($params);
 }
コード例 #2
0
ファイル: owncloud.php プロジェクト: evanjt/core
 public function __construct($params)
 {
     // extract context path from host if specified
     // (owncloud install path on host)
     $host = $params['host'];
     // strip protocol
     if (substr($host, 0, 8) == "https://") {
         $host = substr($host, 8);
         $params['secure'] = true;
     } else {
         if (substr($host, 0, 7) == "http://") {
             $host = substr($host, 7);
             $params['secure'] = false;
         }
     }
     $contextPath = '';
     $hostSlashPos = strpos($host, '/');
     if ($hostSlashPos !== false) {
         $contextPath = substr($host, $hostSlashPos);
         $host = substr($host, 0, $hostSlashPos);
     }
     if (substr($contextPath, -1) !== '/') {
         $contextPath .= '/';
     }
     if (isset($params['root'])) {
         $root = $params['root'];
         if (substr($root, 0, 1) !== '/') {
             $root = '/' . $root;
         }
     } else {
         $root = '/';
     }
     $params['host'] = $host;
     $params['root'] = $contextPath . self::OC_URL_SUFFIX . $root;
     parent::__construct($params);
 }
コード例 #3
0
ファイル: storage.php プロジェクト: lchen01/STEdwards
 public function file_exists($path)
 {
     if ($path === '') {
         return true;
     } else {
         return parent::file_exists($path);
     }
 }
コード例 #4
0
ファイル: storage.php プロジェクト: Romua1d/core
 /**
  * check if a file or folder has been updated since $time
  *
  * @param string $path
  * @param int $time
  * @throws \OCP\Files\StorageNotAvailableException
  * @throws \OCP\Files\StorageInvalidException
  * @return bool
  */
 public function hasUpdated($path, $time)
 {
     // since for owncloud webdav servers we can rely on etag propagation we only need to check the root of the storage
     // because of that we only do one check for the entire storage per request
     if ($this->updateChecked) {
         return false;
     }
     $this->updateChecked = true;
     try {
         return parent::hasUpdated('', $time);
     } catch (StorageNotAvailableException $e) {
         // see if we can find out why the share is unavailable\
         try {
             $this->getShareInfo();
         } catch (NotFoundException $shareException) {
             // a 404 can either mean that the share no longer exists or there is no ownCloud on the remote
             if ($this->testRemote()) {
                 // valid ownCloud instance means that the public share no longer exists
                 // since this is permanent (re-sharing the file will create a new token)
                 // we remove the invalid storage
                 $this->manager->removeShare($this->mountPoint);
                 $this->manager->getMountManager()->removeMount($this->mountPoint);
                 throw new StorageInvalidException();
             } else {
                 // ownCloud instance is gone, likely to be a temporary server configuration error
                 throw $e;
             }
         } catch (\Exception $shareException) {
             // todo, maybe handle 403 better and ask the user for a new password
             throw $e;
         }
         throw $e;
     }
 }