mirror of
https://github.com/nextcloud/server.git
synced 2026-06-29 12:24:50 +02:00
0b9e592796
Move this to the private implementation in OC, so that using IRootFolder in apps doesn't require dummy stubs. This will create a new psalm warnings for users of this method but considering that this is deprecated for a long time and that it still works at runtime, this shouldn't cause any issue. Signed-off-by: Carl Schwan <carlschwan@kde.org>
78 lines
2.0 KiB
PHP
78 lines
2.0 KiB
PHP
<?php
|
|
|
|
/**
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
namespace OC\Files\Node;
|
|
|
|
use OC\Hooks\Emitter;
|
|
use OCP\Files\Cache\ICacheEntry;
|
|
use OCP\Files\IRootFolder;
|
|
use OCP\Files\Mount\IMountPoint;
|
|
use OCP\Files\Node as INode;
|
|
|
|
/**
|
|
* Class LazyRoot
|
|
*
|
|
* This is a lazy wrapper around the root. So only
|
|
* once it is needed this will get initialized.
|
|
*
|
|
* @package OC\Files\Node
|
|
*/
|
|
class LazyRoot extends LazyFolder implements IRootFolder, Emitter {
|
|
public function __construct(\Closure $folderClosure, array $data = []) {
|
|
parent::__construct($this, $folderClosure, $data);
|
|
}
|
|
|
|
#[\Override]
|
|
protected function getRootFolder(): IRootFolder {
|
|
$folder = $this->getRealFolder();
|
|
if (!$folder instanceof IRootFolder) {
|
|
throw new \Exception('Lazy root folder closure didn\'t return a root folder');
|
|
}
|
|
return $folder;
|
|
}
|
|
|
|
#[\Override]
|
|
public function getUserFolder($userId) {
|
|
return $this->__call(__FUNCTION__, func_get_args());
|
|
}
|
|
|
|
#[\Override]
|
|
public function getByIdInPath(int $id, string $path) {
|
|
return $this->__call(__FUNCTION__, func_get_args());
|
|
}
|
|
|
|
#[\Override]
|
|
public function getFirstNodeByIdInPath(int $id, string $path): ?INode {
|
|
return $this->__call(__FUNCTION__, func_get_args());
|
|
}
|
|
|
|
#[\Override]
|
|
public function getNodeFromCacheEntryAndMount(ICacheEntry $cacheEntry, IMountPoint $mountPoint): INode {
|
|
return $this->getRootFolder()->getNodeFromCacheEntryAndMount($cacheEntry, $mountPoint);
|
|
}
|
|
|
|
#[\Override]
|
|
public function getAppDataDirectoryName(): string {
|
|
return $this->__call(__FUNCTION__, func_get_args());
|
|
}
|
|
|
|
public function emit($scope, $method, $arguments = []) {
|
|
$this->__call(__FUNCTION__, func_get_args());
|
|
}
|
|
|
|
#[\Override]
|
|
public function listen($scope, $method, callable $callback) {
|
|
$this->__call(__FUNCTION__, func_get_args());
|
|
}
|
|
|
|
#[\Override]
|
|
public function removeListener($scope = null, $method = null, ?callable $callback = null) {
|
|
$this->__call(__FUNCTION__, func_get_args());
|
|
}
|
|
}
|