add rename hook for propagation

This commit is contained in:
Robin Appelman 2015-04-17 13:31:22 +02:00
parent 77fbb4125b
commit 526ea3fcba
2 changed files with 16 additions and 0 deletions

View File

@ -37,6 +37,21 @@ class ChangeWatcher {
}
}
public function renameHook($params) {
$path1 = $params['oldpath'];
$path2 = $params['newpath'];
$fullPath1 = $this->baseView->getAbsolutePath($path1);
$fullPath2 = $this->baseView->getAbsolutePath($path2);
$mount1 = $this->baseView->getMount($path1);
$mount2 = $this->baseView->getMount($path2);
if ($mount1 instanceof SharedMount) {
$this->propagateForOwner($mount1->getShare(), $mount1->getInternalPath($fullPath1), $mount1->getOwnerPropagator());
}
if ($mount1 !== $mount2 and $mount2 instanceof SharedMount) {
$this->propagateForOwner($mount2->getShare(), $mount2->getInternalPath($fullPath2), $mount2->getOwnerPropagator());
}
}
/**
* @param array $share
* @param string $internalPath

View File

@ -109,5 +109,6 @@ class PropagationManager {
$this->listenToOwnerChanges($user->getUID(), $user->getUID());
\OC_Hook::connect('OC_Filesystem', 'write', $watcher, 'writeHook');
\OC_Hook::connect('OC_Filesystem', 'delete', $watcher, 'writeHook');
\OC_Hook::connect('OC_Filesystem', 'rename', $watcher, 'renameHook');
}
}