|
|
|
|
@ -35,6 +35,7 @@ use OC\Files\Utils\PathHelper; |
|
|
|
|
use OCP\Files\FileInfo; |
|
|
|
|
use OCP\Files\InvalidPathException; |
|
|
|
|
use OCP\Files\IRootFolder; |
|
|
|
|
use OCP\Files\Node as INode; |
|
|
|
|
use OCP\Files\NotFoundException; |
|
|
|
|
use OCP\Files\NotPermittedException; |
|
|
|
|
use OCP\Lock\LockedException; |
|
|
|
|
@ -42,7 +43,7 @@ use OCP\PreConditionNotMetException; |
|
|
|
|
use Symfony\Component\EventDispatcher\GenericEvent; |
|
|
|
|
|
|
|
|
|
// FIXME: this class really should be abstract |
|
|
|
|
class Node implements \OCP\Files\Node { |
|
|
|
|
class Node implements INode { |
|
|
|
|
/** |
|
|
|
|
* @var \OC\Files\View $view |
|
|
|
|
*/ |
|
|
|
|
@ -128,7 +129,9 @@ class Node implements \OCP\Files\Node { |
|
|
|
|
$args = !empty($args) ? $args : [$this]; |
|
|
|
|
$dispatcher = \OC::$server->getEventDispatcher(); |
|
|
|
|
foreach ($hooks as $hook) { |
|
|
|
|
$this->root->emit('\OC\Files', $hook, $args); |
|
|
|
|
if (method_exists($this->root, 'emit')) { |
|
|
|
|
$this->root->emit('\OC\Files', $hook, $args); |
|
|
|
|
} |
|
|
|
|
$dispatcher->dispatch('\OCP\Files::' . $hook, new GenericEvent($args)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -288,10 +291,7 @@ class Node implements \OCP\Files\Node { |
|
|
|
|
return $this->getFileInfo(false)->isCreatable(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @return Node |
|
|
|
|
*/ |
|
|
|
|
public function getParent() { |
|
|
|
|
public function getParent(): INode|IRootFolder { |
|
|
|
|
if ($this->parent === null) { |
|
|
|
|
$newPath = dirname($this->path); |
|
|
|
|
if ($newPath === '' || $newPath === '.' || $newPath === '/') { |
|
|
|
|
@ -400,7 +400,7 @@ class Node implements \OCP\Files\Node { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param string $targetPath |
|
|
|
|
* @return \OCP\Files\Node |
|
|
|
|
* @return INode |
|
|
|
|
* @throws InvalidPathException |
|
|
|
|
* @throws NotFoundException |
|
|
|
|
* @throws NotPermittedException if copy not allowed or failed |
|
|
|
|
@ -426,7 +426,7 @@ class Node implements \OCP\Files\Node { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param string $targetPath |
|
|
|
|
* @return \OCP\Files\Node |
|
|
|
|
* @return INode |
|
|
|
|
* @throws InvalidPathException |
|
|
|
|
* @throws NotFoundException |
|
|
|
|
* @throws NotPermittedException if move not allowed or failed |
|
|
|
|
|