示例#1
0
 /**
  * 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 (StorageInvalidException $e) {
         // check if it needs to be removed
         $this->checkStorageAvailability();
         throw $e;
     } catch (StorageNotAvailableException $e) {
         // check if it needs to be removed or just temp unavailable
         $this->checkStorageAvailability();
         throw $e;
     }
 }
示例#2
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;
     }
 }