/** * @param string $internalPath * @param int $time * @return array[] all propagated entries */ public function propagateChange($internalPath, $time) { $source = $this->storage->getSourcePath($internalPath); /** @var \OC\Files\Storage\Storage $storage */ list($storage, $sourceInternalPath) = \OC\Files\Filesystem::resolvePath($source); return $storage->getPropagator()->propagateChange($sourceInternalPath, $time); }
protected function formatCacheEntry($entry) { $path = $entry['path']; $entry = parent::formatCacheEntry($entry); $sharePermissions = $this->storage->getPermissions($path); if (isset($entry['permissions'])) { $entry['permissions'] &= $sharePermissions; } else { $entry['permissions'] = $sharePermissions; } $entry['uid_owner'] = $this->storage->getOwner($path); $entry['displayname_owner'] = \OC_User::getDisplayName($entry['uid_owner']); if ($path === '') { $entry['is_share_mount_point'] = true; } return $entry; }
/** * Update the cache for changes to $path * * @param string $path * @param array $cachedData */ public function update($path, $cachedData) { parent::update($path, $cachedData); // since parent::update() has already updated the size of the subdirs, // only apply the update to the owner's parent dirs // find last parent before reaching the shared storage root, // which is the actual shared dir from the owner $sepPos = strpos($path, '/'); if ($sepPos > 0) { $baseDir = substr($path, 0, $sepPos); } else { $baseDir = $path; } // find the path relative to the data dir $file = $this->storage->getFile($baseDir); $view = new \OC\Files\View('/' . $file['fileOwner']); // find the owner's storage and path /** @var \OC\Files\Storage\Storage $storage */ list($storage, $internalPath) = $view->resolvePath($file['path']); // update the parent dirs' sizes in the owner's cache $storage->getCache()->correctFolderSize(dirname($internalPath)); }
/** * Move the mount point to $target * * @param string $target the target mount point * @return bool */ public function moveMount($target) { $relTargetPath = $this->stripUserFilesPath($target); $share = $this->storage->getShare(); $result = true; try { $this->updateFileTarget($relTargetPath, $share); $this->setMountPoint($target); $this->storage->setMountPoint($relTargetPath); } catch (\Exception $e) { \OCP\Util::writeLog('file sharing', 'Could not rename mount point for shared folder "' . $this->getMountPoint() . '" to "' . $target . '"', \OCP\Util::ERROR); } return $result; }
/** * Move the mount point to $target * * @param string $target the target mount point * @return bool */ public function moveMount($target) { $relTargetPath = $this->stripUserFilesPath($target); $share = $this->storage->getShare(); $result = true; if (!empty($share['grouped'])) { foreach ($share['grouped'] as $s) { $result = $this->updateFileTarget($relTargetPath, $s) && $result; } } else { $result = $this->updateFileTarget($relTargetPath, $share) && $result; } if ($result) { $this->setMountPoint($target); $this->storage->setUniqueName(); $this->storage->setMountPoint($relTargetPath); } else { \OCP\Util::writeLog('file sharing', 'Could not rename mount point for shared folder "' . $this->getMountPoint() . '" to "' . $target . '"', \OCP\Util::ERROR); } return $result; }
/** * @param string $internalPath * @param int $time * @param int $sizeDifference */ public function propagateChange($internalPath, $time, $sizeDifference = 0) { /** @var \OC\Files\Storage\Storage $storage */ list($storage, $sourceInternalPath) = $this->storage->resolvePath($internalPath); return $storage->getPropagator()->propagateChange($sourceInternalPath, $time, $sizeDifference); }