Skip to content

Commit

Permalink
Update the cache when renaming even if we dont emit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
icewind1991 committed Jan 28, 2015
1 parent 5514218 commit 8c9f1a9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/private/files/node/root.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public function unMount($mount) {
* @param string $path
* @throws \OCP\Files\NotFoundException
* @throws \OCP\Files\NotPermittedException
* @return string
* @return \OCP\Files\Node
*/
public function get($path) {
$path = $this->normalizePath($path);
Expand Down
24 changes: 13 additions & 11 deletions lib/private/files/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -537,16 +537,18 @@ public function rename($path1, $path2) {
if ($this->shouldEmitHooks()) {
$this->emit_file_hooks_post($exists, $path2);
}
} elseif ($this->shouldEmitHooks() && $result !== false) {
} elseif ($result !== false) {
$this->updater->rename($path1, $path2);
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_post_rename,
array(
Filesystem::signal_param_oldpath => $this->getHookPath($path1),
Filesystem::signal_param_newpath => $this->getHookPath($path2)
)
);
if ($this->shouldEmitHooks($path1) and $this->shouldEmitHooks($path2)) {
\OC_Hook::emit(
Filesystem::CLASSNAME,
Filesystem::signal_post_rename,
array(
Filesystem::signal_param_oldpath => $this->getHookPath($path1),
Filesystem::signal_param_newpath => $this->getHookPath($path2)
)
);
}
}
return $result;
} else {
Expand Down Expand Up @@ -1315,7 +1317,7 @@ private function assertPathLength($path) {
$maxLen = min(PHP_MAXPATHLEN, 4000);
// Check for the string length - performed using isset() instead of strlen()
// because isset() is about 5x-40x faster.
if(isset($path[$maxLen])) {
if (isset($path[$maxLen])) {
$pathLen = strlen($path);
throw new \OCP\Files\InvalidPathException("Path length($pathLen) exceeds max path length($maxLen): $path");
}
Expand Down Expand Up @@ -1351,7 +1353,7 @@ private function isTargetAllowed($target) {
* @return \OCP\Files\FileInfo
*/
private function getPartFileInfo($path) {
$mount = $this->getMount($path);
$mount = $this->getMount($path);
$storage = $mount->getStorage();
$internalPath = $mount->getInternalPath($this->getAbsolutePath($path));
return new FileInfo(
Expand Down

0 comments on commit 8c9f1a9

Please sign in to comment.