private static function checkUpdate($id)
 {
     $cacheItem = Cache::getById($id);
     if (is_null($cacheItem)) {
         return;
     }
     list($storageId, $internalPath) = $cacheItem;
     $mounts = Filesystem::getMountByStorageId($storageId);
     if (count($mounts) === 0) {
         //if the storage we need isn't mounted on default, try to find a user that has access to the storage
         $permissionsCache = new Permissions($storageId);
         $users = $permissionsCache->getUsers($id);
         if (count($users) === 0) {
             return;
         }
         Filesystem::initMountPoints($users[0]);
         $mounts = Filesystem::getMountByStorageId($storageId);
         if (count($mounts) === 0) {
             return;
         }
     }
     $storage = $mounts[0]->getStorage();
     $watcher = new Watcher($storage);
     $watcher->checkUpdate($internalPath);
 }
Example #2
0
 /**
  * Get the path including the storage mount point
  * @param int $id
  * @return string the path including the mount point like AmazonS3/folder/file.txt
  */
 public function getPathWithMountPoint($id)
 {
     list($storage, $internalPath) = \OC\Files\Cache\Cache::getById($id);
     $mount = \OC\Files\Filesystem::getMountByStorageId($storage);
     $mountPoint = $mount[0]->getMountPoint();
     $path = \OC\Files\Filesystem::normalizePath($mountPoint . '/' . $internalPath);
     // reformat the path to be relative e.g. /user/files/folder becomes /folder/
     $relativePath = \OCA\Encryption\Helper::stripUserFilesPath($path);
     return $relativePath;
 }