diff options
Diffstat (limited to 'lib')
28 files changed, 808 insertions, 65 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index 49801a253b9..d6c49d19b86 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -170,13 +170,13 @@ return array( 'OCP\\Dashboard\\IDashboardManager' => $baseDir . '/lib/public/Dashboard/IDashboardManager.php', 'OCP\\Dashboard\\IDashboardWidget' => $baseDir . '/lib/public/Dashboard/IDashboardWidget.php', 'OCP\\Dashboard\\IManager' => $baseDir . '/lib/public/Dashboard/IManager.php', - 'OCP\\Dashboard\\IPanel' => $baseDir . '/lib/public/Dashboard/IPanel.php', + 'OCP\\Dashboard\\IWidget' => $baseDir . '/lib/public/Dashboard/IWidget.php', 'OCP\\Dashboard\\Model\\IWidgetConfig' => $baseDir . '/lib/public/Dashboard/Model/IWidgetConfig.php', 'OCP\\Dashboard\\Model\\IWidgetRequest' => $baseDir . '/lib/public/Dashboard/Model/IWidgetRequest.php', 'OCP\\Dashboard\\Model\\WidgetSetting' => $baseDir . '/lib/public/Dashboard/Model/WidgetSetting.php', 'OCP\\Dashboard\\Model\\WidgetSetup' => $baseDir . '/lib/public/Dashboard/Model/WidgetSetup.php', 'OCP\\Dashboard\\Model\\WidgetTemplate' => $baseDir . '/lib/public/Dashboard/Model/WidgetTemplate.php', - 'OCP\\Dashboard\\RegisterPanelEvent' => $baseDir . '/lib/public/Dashboard/RegisterPanelEvent.php', + 'OCP\\Dashboard\\RegisterWidgetEvent' => $baseDir . '/lib/public/Dashboard/RegisterWidgetEvent.php', 'OCP\\Dashboard\\Service\\IEventsService' => $baseDir . '/lib/public/Dashboard/Service/IEventsService.php', 'OCP\\Dashboard\\Service\\IWidgetsService' => $baseDir . '/lib/public/Dashboard/Service/IWidgetsService.php', 'OCP\\Defaults' => $baseDir . '/lib/public/Defaults.php', @@ -230,6 +230,7 @@ return array( 'OCP\\Files\\Config\\IHomeMountProvider' => $baseDir . '/lib/public/Files/Config/IHomeMountProvider.php', 'OCP\\Files\\Config\\IMountProvider' => $baseDir . '/lib/public/Files/Config/IMountProvider.php', 'OCP\\Files\\Config\\IMountProviderCollection' => $baseDir . '/lib/public/Files/Config/IMountProviderCollection.php', + 'OCP\\Files\\Config\\IRootMountProvider' => $baseDir . '/lib/public/Files/Config/IRootMountProvider.php', 'OCP\\Files\\Config\\IUserMountCache' => $baseDir . '/lib/public/Files/Config/IUserMountCache.php', 'OCP\\Files\\EmptyFileNameException' => $baseDir . '/lib/public/Files/EmptyFileNameException.php', 'OCP\\Files\\EntityTooLargeException' => $baseDir . '/lib/public/Files/EntityTooLargeException.php', @@ -495,6 +496,9 @@ return array( 'OCP\\Template' => $baseDir . '/lib/public/Template.php', 'OCP\\User' => $baseDir . '/lib/public/User.php', 'OCP\\UserInterface' => $baseDir . '/lib/public/UserInterface.php', + 'OCP\\UserStatus\\IManager' => $baseDir . '/lib/public/UserStatus/IManager.php', + 'OCP\\UserStatus\\IProvider' => $baseDir . '/lib/public/UserStatus/IProvider.php', + 'OCP\\UserStatus\\IUserStatus' => $baseDir . '/lib/public/UserStatus/IUserStatus.php', 'OCP\\User\\Backend\\ABackend' => $baseDir . '/lib/public/User/Backend/ABackend.php', 'OCP\\User\\Backend\\ICheckPasswordBackend' => $baseDir . '/lib/public/User/Backend/ICheckPasswordBackend.php', 'OCP\\User\\Backend\\ICountUsersBackend' => $baseDir . '/lib/public/User/Backend/ICountUsersBackend.php', @@ -524,6 +528,7 @@ return array( 'OCP\\User\\Events\\UserLoggedInWithCookieEvent' => $baseDir . '/lib/public/User/Events/UserLoggedInWithCookieEvent.php', 'OCP\\User\\Events\\UserLoggedOutEvent' => $baseDir . '/lib/public/User/Events/UserLoggedOutEvent.php', 'OCP\\Util' => $baseDir . '/lib/public/Util.php', + 'OCP\\WorkflowEngine\\EntityContext\\IContextPortation' => $baseDir . '/lib/public/WorkflowEngine/EntityContext/IContextPortation.php', 'OCP\\WorkflowEngine\\EntityContext\\IDisplayName' => $baseDir . '/lib/public/WorkflowEngine/EntityContext/IDisplayName.php', 'OCP\\WorkflowEngine\\EntityContext\\IDisplayText' => $baseDir . '/lib/public/WorkflowEngine/EntityContext/IDisplayText.php', 'OCP\\WorkflowEngine\\EntityContext\\IIcon' => $baseDir . '/lib/public/WorkflowEngine/EntityContext/IIcon.php', @@ -825,6 +830,7 @@ return array( 'OC\\Core\\Command\\Maintenance\\Repair' => $baseDir . '/core/Command/Maintenance/Repair.php', 'OC\\Core\\Command\\Maintenance\\UpdateHtaccess' => $baseDir . '/core/Command/Maintenance/UpdateHtaccess.php', 'OC\\Core\\Command\\Maintenance\\UpdateTheme' => $baseDir . '/core/Command/Maintenance/UpdateTheme.php', + 'OC\\Core\\Command\\Preview\\Repair' => $baseDir . '/core/Command/Preview/Repair.php', 'OC\\Core\\Command\\Security\\ImportCertificate' => $baseDir . '/core/Command/Security/ImportCertificate.php', 'OC\\Core\\Command\\Security\\ListCertificates' => $baseDir . '/core/Command/Security/ListCertificates.php', 'OC\\Core\\Command\\Security\\RemoveCertificate' => $baseDir . '/core/Command/Security/RemoveCertificate.php', @@ -1025,6 +1031,7 @@ return array( 'OC\\Files\\Mount\\MountPoint' => $baseDir . '/lib/private/Files/Mount/MountPoint.php', 'OC\\Files\\Mount\\MoveableMount' => $baseDir . '/lib/private/Files/Mount/MoveableMount.php', 'OC\\Files\\Mount\\ObjectHomeMountProvider' => $baseDir . '/lib/private/Files/Mount/ObjectHomeMountProvider.php', + 'OC\\Files\\Mount\\ObjectStorePreviewCacheMountProvider' => $baseDir . '/lib/private/Files/Mount/ObjectStorePreviewCacheMountProvider.php', 'OC\\Files\\Node\\File' => $baseDir . '/lib/private/Files/Node/File.php', 'OC\\Files\\Node\\Folder' => $baseDir . '/lib/private/Files/Node/Folder.php', 'OC\\Files\\Node\\HookConnector' => $baseDir . '/lib/private/Files/Node/HookConnector.php', @@ -1036,6 +1043,7 @@ return array( 'OC\\Files\\Node\\Root' => $baseDir . '/lib/private/Files/Node/Root.php', 'OC\\Files\\Notify\\Change' => $baseDir . '/lib/private/Files/Notify/Change.php', 'OC\\Files\\Notify\\RenameChange' => $baseDir . '/lib/private/Files/Notify/RenameChange.php', + 'OC\\Files\\ObjectStore\\AppdataPreviewObjectStoreStorage' => $baseDir . '/lib/private/Files/ObjectStore/AppdataPreviewObjectStoreStorage.php', 'OC\\Files\\ObjectStore\\Azure' => $baseDir . '/lib/private/Files/ObjectStore/Azure.php', 'OC\\Files\\ObjectStore\\HomeObjectStoreStorage' => $baseDir . '/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php', 'OC\\Files\\ObjectStore\\Mapper' => $baseDir . '/lib/private/Files/ObjectStore/Mapper.php', @@ -1344,6 +1352,7 @@ return array( 'OC\\Updater\\ChangesMapper' => $baseDir . '/lib/private/Updater/ChangesMapper.php', 'OC\\Updater\\ChangesResult' => $baseDir . '/lib/private/Updater/ChangesResult.php', 'OC\\Updater\\VersionCheck' => $baseDir . '/lib/private/Updater/VersionCheck.php', + 'OC\\UserStatus\\Manager' => $baseDir . '/lib/private/UserStatus/Manager.php', 'OC\\User\\Backend' => $baseDir . '/lib/private/User/Backend.php', 'OC\\User\\Database' => $baseDir . '/lib/private/User/Database.php', 'OC\\User\\LoginException' => $baseDir . '/lib/private/User/LoginException.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index 0a9879e19d0..0edbf18c9a6 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -199,13 +199,13 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OCP\\Dashboard\\IDashboardManager' => __DIR__ . '/../../..' . '/lib/public/Dashboard/IDashboardManager.php', 'OCP\\Dashboard\\IDashboardWidget' => __DIR__ . '/../../..' . '/lib/public/Dashboard/IDashboardWidget.php', 'OCP\\Dashboard\\IManager' => __DIR__ . '/../../..' . '/lib/public/Dashboard/IManager.php', - 'OCP\\Dashboard\\IPanel' => __DIR__ . '/../../..' . '/lib/public/Dashboard/IPanel.php', + 'OCP\\Dashboard\\IWidget' => __DIR__ . '/../../..' . '/lib/public/Dashboard/IWidget.php', 'OCP\\Dashboard\\Model\\IWidgetConfig' => __DIR__ . '/../../..' . '/lib/public/Dashboard/Model/IWidgetConfig.php', 'OCP\\Dashboard\\Model\\IWidgetRequest' => __DIR__ . '/../../..' . '/lib/public/Dashboard/Model/IWidgetRequest.php', 'OCP\\Dashboard\\Model\\WidgetSetting' => __DIR__ . '/../../..' . '/lib/public/Dashboard/Model/WidgetSetting.php', 'OCP\\Dashboard\\Model\\WidgetSetup' => __DIR__ . '/../../..' . '/lib/public/Dashboard/Model/WidgetSetup.php', 'OCP\\Dashboard\\Model\\WidgetTemplate' => __DIR__ . '/../../..' . '/lib/public/Dashboard/Model/WidgetTemplate.php', - 'OCP\\Dashboard\\RegisterPanelEvent' => __DIR__ . '/../../..' . '/lib/public/Dashboard/RegisterPanelEvent.php', + 'OCP\\Dashboard\\RegisterWidgetEvent' => __DIR__ . '/../../..' . '/lib/public/Dashboard/RegisterWidgetEvent.php', 'OCP\\Dashboard\\Service\\IEventsService' => __DIR__ . '/../../..' . '/lib/public/Dashboard/Service/IEventsService.php', 'OCP\\Dashboard\\Service\\IWidgetsService' => __DIR__ . '/../../..' . '/lib/public/Dashboard/Service/IWidgetsService.php', 'OCP\\Defaults' => __DIR__ . '/../../..' . '/lib/public/Defaults.php', @@ -259,6 +259,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OCP\\Files\\Config\\IHomeMountProvider' => __DIR__ . '/../../..' . '/lib/public/Files/Config/IHomeMountProvider.php', 'OCP\\Files\\Config\\IMountProvider' => __DIR__ . '/../../..' . '/lib/public/Files/Config/IMountProvider.php', 'OCP\\Files\\Config\\IMountProviderCollection' => __DIR__ . '/../../..' . '/lib/public/Files/Config/IMountProviderCollection.php', + 'OCP\\Files\\Config\\IRootMountProvider' => __DIR__ . '/../../..' . '/lib/public/Files/Config/IRootMountProvider.php', 'OCP\\Files\\Config\\IUserMountCache' => __DIR__ . '/../../..' . '/lib/public/Files/Config/IUserMountCache.php', 'OCP\\Files\\EmptyFileNameException' => __DIR__ . '/../../..' . '/lib/public/Files/EmptyFileNameException.php', 'OCP\\Files\\EntityTooLargeException' => __DIR__ . '/../../..' . '/lib/public/Files/EntityTooLargeException.php', @@ -524,6 +525,9 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OCP\\Template' => __DIR__ . '/../../..' . '/lib/public/Template.php', 'OCP\\User' => __DIR__ . '/../../..' . '/lib/public/User.php', 'OCP\\UserInterface' => __DIR__ . '/../../..' . '/lib/public/UserInterface.php', + 'OCP\\UserStatus\\IManager' => __DIR__ . '/../../..' . '/lib/public/UserStatus/IManager.php', + 'OCP\\UserStatus\\IProvider' => __DIR__ . '/../../..' . '/lib/public/UserStatus/IProvider.php', + 'OCP\\UserStatus\\IUserStatus' => __DIR__ . '/../../..' . '/lib/public/UserStatus/IUserStatus.php', 'OCP\\User\\Backend\\ABackend' => __DIR__ . '/../../..' . '/lib/public/User/Backend/ABackend.php', 'OCP\\User\\Backend\\ICheckPasswordBackend' => __DIR__ . '/../../..' . '/lib/public/User/Backend/ICheckPasswordBackend.php', 'OCP\\User\\Backend\\ICountUsersBackend' => __DIR__ . '/../../..' . '/lib/public/User/Backend/ICountUsersBackend.php', @@ -553,6 +557,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OCP\\User\\Events\\UserLoggedInWithCookieEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/UserLoggedInWithCookieEvent.php', 'OCP\\User\\Events\\UserLoggedOutEvent' => __DIR__ . '/../../..' . '/lib/public/User/Events/UserLoggedOutEvent.php', 'OCP\\Util' => __DIR__ . '/../../..' . '/lib/public/Util.php', + 'OCP\\WorkflowEngine\\EntityContext\\IContextPortation' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/EntityContext/IContextPortation.php', 'OCP\\WorkflowEngine\\EntityContext\\IDisplayName' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/EntityContext/IDisplayName.php', 'OCP\\WorkflowEngine\\EntityContext\\IDisplayText' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/EntityContext/IDisplayText.php', 'OCP\\WorkflowEngine\\EntityContext\\IIcon' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/EntityContext/IIcon.php', @@ -854,6 +859,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OC\\Core\\Command\\Maintenance\\Repair' => __DIR__ . '/../../..' . '/core/Command/Maintenance/Repair.php', 'OC\\Core\\Command\\Maintenance\\UpdateHtaccess' => __DIR__ . '/../../..' . '/core/Command/Maintenance/UpdateHtaccess.php', 'OC\\Core\\Command\\Maintenance\\UpdateTheme' => __DIR__ . '/../../..' . '/core/Command/Maintenance/UpdateTheme.php', + 'OC\\Core\\Command\\Preview\\Repair' => __DIR__ . '/../../..' . '/core/Command/Preview/Repair.php', 'OC\\Core\\Command\\Security\\ImportCertificate' => __DIR__ . '/../../..' . '/core/Command/Security/ImportCertificate.php', 'OC\\Core\\Command\\Security\\ListCertificates' => __DIR__ . '/../../..' . '/core/Command/Security/ListCertificates.php', 'OC\\Core\\Command\\Security\\RemoveCertificate' => __DIR__ . '/../../..' . '/core/Command/Security/RemoveCertificate.php', @@ -1054,6 +1060,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OC\\Files\\Mount\\MountPoint' => __DIR__ . '/../../..' . '/lib/private/Files/Mount/MountPoint.php', 'OC\\Files\\Mount\\MoveableMount' => __DIR__ . '/../../..' . '/lib/private/Files/Mount/MoveableMount.php', 'OC\\Files\\Mount\\ObjectHomeMountProvider' => __DIR__ . '/../../..' . '/lib/private/Files/Mount/ObjectHomeMountProvider.php', + 'OC\\Files\\Mount\\ObjectStorePreviewCacheMountProvider' => __DIR__ . '/../../..' . '/lib/private/Files/Mount/ObjectStorePreviewCacheMountProvider.php', 'OC\\Files\\Node\\File' => __DIR__ . '/../../..' . '/lib/private/Files/Node/File.php', 'OC\\Files\\Node\\Folder' => __DIR__ . '/../../..' . '/lib/private/Files/Node/Folder.php', 'OC\\Files\\Node\\HookConnector' => __DIR__ . '/../../..' . '/lib/private/Files/Node/HookConnector.php', @@ -1065,6 +1072,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OC\\Files\\Node\\Root' => __DIR__ . '/../../..' . '/lib/private/Files/Node/Root.php', 'OC\\Files\\Notify\\Change' => __DIR__ . '/../../..' . '/lib/private/Files/Notify/Change.php', 'OC\\Files\\Notify\\RenameChange' => __DIR__ . '/../../..' . '/lib/private/Files/Notify/RenameChange.php', + 'OC\\Files\\ObjectStore\\AppdataPreviewObjectStoreStorage' => __DIR__ . '/../../..' . '/lib/private/Files/ObjectStore/AppdataPreviewObjectStoreStorage.php', 'OC\\Files\\ObjectStore\\Azure' => __DIR__ . '/../../..' . '/lib/private/Files/ObjectStore/Azure.php', 'OC\\Files\\ObjectStore\\HomeObjectStoreStorage' => __DIR__ . '/../../..' . '/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php', 'OC\\Files\\ObjectStore\\Mapper' => __DIR__ . '/../../..' . '/lib/private/Files/ObjectStore/Mapper.php', @@ -1373,6 +1381,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OC\\Updater\\ChangesMapper' => __DIR__ . '/../../..' . '/lib/private/Updater/ChangesMapper.php', 'OC\\Updater\\ChangesResult' => __DIR__ . '/../../..' . '/lib/private/Updater/ChangesResult.php', 'OC\\Updater\\VersionCheck' => __DIR__ . '/../../..' . '/lib/private/Updater/VersionCheck.php', + 'OC\\UserStatus\\Manager' => __DIR__ . '/../../..' . '/lib/private/UserStatus/Manager.php', 'OC\\User\\Backend' => __DIR__ . '/../../..' . '/lib/private/User/Backend.php', 'OC\\User\\Database' => __DIR__ . '/../../..' . '/lib/private/User/Database.php', 'OC\\User\\LoginException' => __DIR__ . '/../../..' . '/lib/private/User/LoginException.php', diff --git a/lib/private/AppFramework/Bootstrap/RegistrationContext.php b/lib/private/AppFramework/Bootstrap/RegistrationContext.php index efcf9175b97..4c37209739e 100644 --- a/lib/private/AppFramework/Bootstrap/RegistrationContext.php +++ b/lib/private/AppFramework/Bootstrap/RegistrationContext.php @@ -100,10 +100,10 @@ class RegistrationContext { ); } - public function registerDashboardPanel(string $panelClass): void { + public function registerDashboardWidget(string $widgetClass): void { $this->context->registerDashboardPanel( $this->appId, - $panelClass + $widgetClass ); } @@ -282,7 +282,7 @@ class RegistrationContext { public function delegateDashboardPanelRegistrations(array $apps, IManager $dashboardManager): void { foreach ($this->dashboardPanels as $panel) { try { - $dashboardManager->lazyRegisterPanel($panel['class']); + $dashboardManager->lazyRegisterWidget($panel['class']); } catch (Throwable $e) { $appId = $panel['appId']; $this->logger->logException($e, [ diff --git a/lib/private/Dashboard/Manager.php b/lib/private/Dashboard/Manager.php index 0c285a8b53d..fda4c8b3893 100644 --- a/lib/private/Dashboard/Manager.php +++ b/lib/private/Dashboard/Manager.php @@ -29,7 +29,7 @@ namespace OC\Dashboard; use InvalidArgumentException; use OCP\AppFramework\QueryException; use OCP\Dashboard\IManager; -use OCP\Dashboard\IPanel; +use OCP\Dashboard\IWidget; use OCP\ILogger; use OCP\IServerContainer; use Throwable; @@ -37,10 +37,10 @@ use Throwable; class Manager implements IManager { /** @var array */ - private $lazyPanels = []; + private $lazyWidgets = []; - /** @var IPanel[] */ - private $panels = []; + /** @var IWidget[] */ + private $widgets = []; /** @var IServerContainer */ private $serverContainer; @@ -49,31 +49,31 @@ class Manager implements IManager { $this->serverContainer = $serverContainer; } - private function registerPanel(IPanel $panel): void { - if (array_key_exists($panel->getId(), $this->panels)) { - throw new InvalidArgumentException('Dashboard panel with this id has already been registered'); + private function registerWidget(IWidget $widget): void { + if (array_key_exists($widget->getId(), $this->widgets)) { + throw new InvalidArgumentException('Dashboard widget with this id has already been registered'); } - $this->panels[$panel->getId()] = $panel; + $this->widgets[$widget->getId()] = $widget; } - public function lazyRegisterPanel(string $panelClass): void { - $this->lazyPanels[] = $panelClass; + public function lazyRegisterWidget(string $widgetClass): void { + $this->lazyWidgets[] = $widgetClass; } public function loadLazyPanels(): void { - $classes = $this->lazyPanels; + $classes = $this->lazyWidgets; foreach ($classes as $class) { try { - /** @var IPanel $panel */ - $panel = $this->serverContainer->query($class); + /** @var IWidget $widget */ + $widget = $this->serverContainer->query($class); } catch (QueryException $e) { /* * There is a circular dependency between the logger and the registry, so * we can not inject it. Thus the static call. */ \OC::$server->getLogger()->logException($e, [ - 'message' => 'Could not load lazy dashbaord panel: ' . $e->getMessage(), + 'message' => 'Could not load lazy dashbaord widget: ' . $e->getMessage(), 'level' => ILogger::FATAL, ]); } @@ -82,32 +82,32 @@ class Manager implements IManager { * type, so we might get a TypeError here that we should catch. */ try { - $this->registerPanel($panel); + $this->registerWidget($widget); } catch (Throwable $e) { /* * There is a circular dependency between the logger and the registry, so * we can not inject it. Thus the static call. */ \OC::$server->getLogger()->logException($e, [ - 'message' => 'Could not register lazy dashboard panel: ' . $e->getMessage(), + 'message' => 'Could not register lazy dashboard widget: ' . $e->getMessage(), 'level' => ILogger::FATAL, ]); } try { - $panel->load(); + $widget->load(); } catch (Throwable $e) { \OC::$server->getLogger()->logException($e, [ - 'message' => 'Error during dashboard panel loading: ' . $e->getMessage(), + 'message' => 'Error during dashboard widget loading: ' . $e->getMessage(), 'level' => ILogger::FATAL, ]); } } - $this->lazyPanels = []; + $this->lazyWidgets = []; } - public function getPanels(): array { + public function getWidgets(): array { $this->loadLazyPanels(); - return $this->panels; + return $this->widgets; } } diff --git a/lib/private/Files/Config/MountProviderCollection.php b/lib/private/Files/Config/MountProviderCollection.php index 34db652290f..2b57ffe6e4c 100644 --- a/lib/private/Files/Config/MountProviderCollection.php +++ b/lib/private/Files/Config/MountProviderCollection.php @@ -30,6 +30,7 @@ use OC\Hooks\EmitterTrait; use OCP\Files\Config\IHomeMountProvider; use OCP\Files\Config\IMountProvider; use OCP\Files\Config\IMountProviderCollection; +use OCP\Files\Config\IRootMountProvider; use OCP\Files\Config\IUserMountCache; use OCP\Files\Mount\IMountManager; use OCP\Files\Mount\IMountPoint; @@ -49,6 +50,9 @@ class MountProviderCollection implements IMountProviderCollection, Emitter { */ private $providers = []; + /** @var \OCP\Files\Config\IRootMountProvider[] */ + private $rootProviders = []; + /** * @var \OCP\Files\Storage\IStorageFactory */ @@ -198,4 +202,19 @@ class MountProviderCollection implements IMountProviderCollection, Emitter { public function getMountCache() { return $this->mountCache; } + + public function registerRootProvider(IRootMountProvider $provider) { + $this->rootProviders[] = $provider; + } + + public function getRootMounts(): array { + $loader = $this->loader; + $mounts = array_map(function (IRootMountProvider $provider) use ($loader) { + return $provider->getRootMounts($loader); + }, $this->rootProviders); + $mounts = array_reduce($mounts, function (array $mounts, array $providerMounts) { + return array_merge($mounts, $providerMounts); + }, []); + return $mounts; + } } diff --git a/lib/private/Files/Mount/ObjectStorePreviewCacheMountProvider.php b/lib/private/Files/Mount/ObjectStorePreviewCacheMountProvider.php new file mode 100644 index 00000000000..9bbb744bbcc --- /dev/null +++ b/lib/private/Files/Mount/ObjectStorePreviewCacheMountProvider.php @@ -0,0 +1,150 @@ +<?php + +declare(strict_types=1); +/** + * @copyright Copyright (c) 2020, Morris Jobke <hey@morrisjobke.de> + * + * @author Morris Jobke <hey@morrisjobke.de> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OC\Files\Mount; + +use OC\Files\ObjectStore\AppdataPreviewObjectStoreStorage; +use OC\Files\ObjectStore\ObjectStoreStorage; +use OC\Files\Storage\Wrapper\Jail; +use OCP\Files\Config\IRootMountProvider; +use OCP\Files\Storage\IStorageFactory; +use OCP\IConfig; +use OCP\ILogger; + +/** + * Mount provider for object store app data folder for previews + */ +class ObjectStorePreviewCacheMountProvider implements IRootMountProvider { + /** @var ILogger */ + private $logger; + /** @var IConfig */ + private $config; + + public function __construct(ILogger $logger, IConfig $config) { + $this->logger = $logger; + $this->config = $config; + } + + /** + * @return MountPoint[] + * @throws \Exception + */ + public function getRootMounts(IStorageFactory $loader): array { + if (!is_array($this->config->getSystemValue('objectstore_multibucket'))) { + return []; + } + if ($this->config->getSystemValue('objectstore.multibucket.preview-distribution', false) !== true) { + return []; + } + + $instanceId = $this->config->getSystemValueString('instanceid', ''); + $mountPoints = []; + $directoryRange = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; + $i = 0; + foreach ($directoryRange as $parent) { + foreach ($directoryRange as $child) { + $mountPoints[] = new MountPoint( + AppdataPreviewObjectStoreStorage::class, + '/appdata_' . $instanceId . '/preview/' . $parent . '/' . $child, + $this->getMultiBucketObjectStore($i), + $loader + ); + $i++; + } + } + + $rootStorageArguments = $this->getMultiBucketObjectStoreForRoot(); + $fakeRootStorage = new ObjectStoreStorage($rootStorageArguments); + $fakeRootStorageJail = new Jail([ + 'storage' => $fakeRootStorage, + 'root' => '/appdata_' . $instanceId . '/preview', + ]); + + // add a fallback location to be able to fetch existing previews from the old bucket + $mountPoints[] = new MountPoint( + $fakeRootStorageJail, + '/appdata_' . $instanceId . '/preview/old-multibucket', + null, + $loader + ); + + return $mountPoints; + } + + protected function getMultiBucketObjectStore(int $number): array { + $config = $this->config->getSystemValue('objectstore_multibucket'); + + // sanity checks + if (empty($config['class'])) { + $this->logger->error('No class given for objectstore', ['app' => 'files']); + } + if (!isset($config['arguments'])) { + $config['arguments'] = []; + } + + /* + * Use any provided bucket argument as prefix + * and add the mapping from parent/child => bucket + */ + if (!isset($config['arguments']['bucket'])) { + $config['arguments']['bucket'] = ''; + } + + $config['arguments']['bucket'] .= "-preview-$number"; + + // instantiate object store implementation + $config['arguments']['objectstore'] = new $config['class']($config['arguments']); + + $config['arguments']['internal-id'] = $number; + + return $config['arguments']; + } + + protected function getMultiBucketObjectStoreForRoot(): array { + $config = $this->config->getSystemValue('objectstore_multibucket'); + + // sanity checks + if (empty($config['class'])) { + $this->logger->error('No class given for objectstore', ['app' => 'files']); + } + if (!isset($config['arguments'])) { + $config['arguments'] = []; + } + + /* + * Use any provided bucket argument as prefix + * and add the mapping from parent/child => bucket + */ + if (!isset($config['arguments']['bucket'])) { + $config['arguments']['bucket'] = ''; + } + $config['arguments']['bucket'] .= '0'; + + // instantiate object store implementation + $config['arguments']['objectstore'] = new $config['class']($config['arguments']); + + return $config['arguments']; + } +} diff --git a/lib/private/Files/ObjectStore/AppdataPreviewObjectStoreStorage.php b/lib/private/Files/ObjectStore/AppdataPreviewObjectStoreStorage.php new file mode 100644 index 00000000000..ab6cb07cdc3 --- /dev/null +++ b/lib/private/Files/ObjectStore/AppdataPreviewObjectStoreStorage.php @@ -0,0 +1,44 @@ +<?php + +declare(strict_types=1); +/** + * @copyright Copyright (c) 2020, Morris Jobke <hey@morrisjobke.de> + * + * @author Morris Jobke <hey@morrisjobke.de> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OC\Files\ObjectStore; + +class AppdataPreviewObjectStoreStorage extends ObjectStoreStorage { + + /** @var string */ + private $internalId; + + public function __construct($params) { + if (!isset($params['internal-id'])) { + throw new \Exception('missing id in parameters'); + } + $this->internalId = (string)$params['internal-id']; + parent::__construct($params); + } + + public function getId() { + return 'object::appdata::preview:' . $this->internalId; + } +} diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index 0b636d06bde..552e996b90b 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -109,6 +109,7 @@ class Local extends \OC\Files\Storage\Common { * @var \SplFileInfo $file */ $file = $it->current(); + clearstatcache(true, $this->getSourcePath($file)); if (in_array($file->getBasename(), ['.', '..'])) { $it->next(); continue; @@ -119,6 +120,7 @@ class Local extends \OC\Files\Storage\Common { } $it->next(); } + clearstatcache(true, $this->getSourcePath($path)); return rmdir($this->getSourcePath($path)); } catch (\UnexpectedValueException $e) { return false; @@ -141,8 +143,8 @@ class Local extends \OC\Files\Storage\Common { } public function stat($path) { - clearstatcache(); $fullPath = $this->getSourcePath($path); + clearstatcache(true, $fullPath); $statResult = stat($fullPath); if (PHP_INT_SIZE === 4 && !$this->is_dir($path)) { $filesize = $this->filesize($path); @@ -157,7 +159,7 @@ class Local extends \OC\Files\Storage\Common { */ public function getMetaData($path) { $fullPath = $this->getSourcePath($path); - clearstatcache(); + clearstatcache(true, $fullPath); $stat = @stat($fullPath); if (!$stat) { return null; diff --git a/lib/private/Group/Database.php b/lib/private/Group/Database.php index 8e6181a56cd..97094c67728 100644 --- a/lib/private/Group/Database.php +++ b/lib/private/Group/Database.php @@ -348,15 +348,27 @@ class Database extends ABackend implements $this->fixDI(); $query = $this->dbConn->getQueryBuilder(); - $query->select('uid') - ->from('group_user') + $query->select('g.uid') + ->from('group_user', 'g') ->where($query->expr()->eq('gid', $query->createNamedParameter($gid))) - ->orderBy('uid', 'ASC'); + ->orderBy('g.uid', 'ASC'); if ($search !== '') { - $query->andWhere($query->expr()->like('uid', $query->createNamedParameter( - '%' . $this->dbConn->escapeLikeParameter($search) . '%' - ))); + $query->leftJoin('g', 'users', 'u', $query->expr()->eq('g.uid', 'u.uid')) + ->leftJoin('u', 'preferences', 'p', $query->expr()->andX( + $query->expr()->eq('p.userid', 'u.uid'), + $query->expr()->eq('p.appid', $query->expr()->literal('settings')), + $query->expr()->eq('p.configkey', $query->expr()->literal('email'))) + ) + // sqlite doesn't like re-using a single named parameter here + ->andWhere( + $query->expr()->orX( + $query->expr()->ilike('g.uid', $query->createNamedParameter('%' . $this->dbConn->escapeLikeParameter($search) . '%')), + $query->expr()->ilike('u.displayname', $query->createNamedParameter('%' . $this->dbConn->escapeLikeParameter($search) . '%')), + $query->expr()->ilike('p.configvalue', $query->createNamedParameter('%' . $this->dbConn->escapeLikeParameter($search) . '%')) + ) + ) + ->orderBy('u.uid_lower', 'ASC'); } if ($limit !== -1) { diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php index f7aed987d89..e47a7e5927c 100644 --- a/lib/private/Preview/Generator.php +++ b/lib/private/Preview/Generator.php @@ -192,6 +192,12 @@ class Generator { } } + // Free memory being used by the embedded image resource. Without this the image is kept in memory indefinitely. + // Garbage Collection does NOT free this memory. We have to do it ourselves. + if ($maxPreviewImage instanceof \OC_Image) { + $maxPreviewImage->destroy(); + } + return $preview; } diff --git a/lib/private/Preview/Storage/Root.php b/lib/private/Preview/Storage/Root.php index a9a72026a51..2a3367b83b7 100644 --- a/lib/private/Preview/Storage/Root.php +++ b/lib/private/Preview/Storage/Root.php @@ -1,7 +1,6 @@ <?php declare(strict_types=1); - /** * @copyright Copyright (c) 2020, Roeland Jago Douma <roeland@famdouma.nl> * @@ -33,13 +32,24 @@ use OCP\Files\NotFoundException; use OCP\Files\SimpleFS\ISimpleFolder; class Root extends AppData { + private $isMultibucketPreviewDistributionEnabled = false; public function __construct(IRootFolder $rootFolder, SystemConfig $systemConfig) { parent::__construct($rootFolder, $systemConfig, 'preview'); + + $this->isMultibucketPreviewDistributionEnabled = $systemConfig->getValue('objectstore.multibucket.preview-distribution', false) === true; } public function getFolder(string $name): ISimpleFolder { - $internalFolder = $this->getInternalFolder($name); + $internalFolder = self::getInternalFolder($name); + + if ($this->isMultibucketPreviewDistributionEnabled) { + try { + return parent::getFolder('old-multibucket/' . $internalFolder); + } catch (NotFoundException $e) { + // not in multibucket fallback + } + } try { return parent::getFolder($internalFolder); @@ -54,7 +64,7 @@ class Root extends AppData { } public function newFolder(string $name): ISimpleFolder { - $internalFolder = $this->getInternalFolder($name); + $internalFolder = self::getInternalFolder($name); return parent::newFolder($internalFolder); } @@ -66,7 +76,7 @@ class Root extends AppData { return []; } - private function getInternalFolder(string $name): string { + public static function getInternalFolder(string $name): string { return implode('/', str_split(substr(md5($name), 0, 7))) . '/' . $name; } } diff --git a/lib/private/Route/Router.php b/lib/private/Route/Router.php index de7c720f271..6de581ffa96 100644 --- a/lib/private/Route/Router.php +++ b/lib/private/Route/Router.php @@ -239,9 +239,9 @@ class Router implements IRouter { * * @param string $url The url to find * @throws \Exception - * @return void + * @return array */ - public function match($url) { + public function findMatchingRoute(string $url): array { if (substr($url, 0, 6) === '/apps/') { // empty string / 'apps' / $app / rest of the route list(, , $app,) = explode('/', $url, 4); @@ -287,6 +287,19 @@ class Router implements IRouter { } } + return $parameters; + } + + /** + * Find and execute the route matching $url + * + * @param string $url The url to find + * @throws \Exception + * @return void + */ + public function match($url) { + $parameters = $this->findMatchingRoute($url); + \OC::$server->getEventLogger()->start('run_route', 'Run route'); if (isset($parameters['caller'])) { $caller = $parameters['caller']; diff --git a/lib/private/Search/SearchComposer.php b/lib/private/Search/SearchComposer.php index 7ba6296c9de..fdac9c5612a 100644 --- a/lib/private/Search/SearchComposer.php +++ b/lib/private/Search/SearchComposer.php @@ -109,17 +109,20 @@ class SearchComposer { * Get a list of all provider IDs & Names for the consecutive calls to `search` * Sort the list by the order property * + * @param string $route the route the user is currently at + * @param array $routeParameters the parameters of the route the user is currently at + * * @return array */ - public function getProviders(): array { + public function getProviders(string $route, array $routeParameters): array { $this->loadLazyProviders(); $providers = array_values( - array_map(function (IProvider $provider) { + array_map(function (IProvider $provider) use ($route, $routeParameters) { return [ 'id' => $provider->getId(), 'name' => $provider->getName(), - 'order' => $provider->getOrder() + 'order' => $provider->getOrder($route, $routeParameters), ]; }, $this->providers) ); diff --git a/lib/private/Search/SearchQuery.php b/lib/private/Search/SearchQuery.php index 186b4ccf18f..7ba63de90ec 100644 --- a/lib/private/Search/SearchQuery.php +++ b/lib/private/Search/SearchQuery.php @@ -42,20 +42,32 @@ class SearchQuery implements ISearchQuery { /** @var int|string|null */ private $cursor; + /** @var string */ + private $route; + + /** @var array */ + private $routeParameters; + /** * @param string $term * @param int $sortOrder * @param int $limit * @param int|string|null $cursor + * @param string $route + * @param array $routeParameters */ public function __construct(string $term, int $sortOrder = ISearchQuery::SORT_DATE_DESC, int $limit = self::LIMIT_DEFAULT, - $cursor = null) { + $cursor = null, + string $route = '', + array $routeParameters = []) { $this->term = $term; $this->sortOrder = $sortOrder; $this->limit = $limit; $this->cursor = $cursor; + $this->route = $route; + $this->routeParameters = $routeParameters; } /** @@ -85,4 +97,18 @@ class SearchQuery implements ISearchQuery { public function getCursor() { return $this->cursor; } + + /** + * @inheritDoc + */ + public function getRoute(): string { + return $this->route; + } + + /** + * @inheritDoc + */ + public function getRouteParameters(): array { + return $this->routeParameters; + } } diff --git a/lib/private/Server.php b/lib/private/Server.php index 09bb7336785..8d771bec3a1 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -88,6 +88,7 @@ use OC\Files\Config\UserMountCacheListener; use OC\Files\Mount\CacheMountProvider; use OC\Files\Mount\LocalHomeMountProvider; use OC\Files\Mount\ObjectHomeMountProvider; +use OC\Files\Mount\ObjectStorePreviewCacheMountProvider; use OC\Files\Node\HookConnector; use OC\Files\Node\LazyRoot; use OC\Files\Node\Root; @@ -904,9 +905,11 @@ class Server extends ServerContainer implements IServerContainer { // builtin providers $config = $c->getConfig(); + $logger = $c->getLogger(); $manager->registerProvider(new CacheMountProvider($config)); $manager->registerHomeProvider(new LocalHomeMountProvider()); $manager->registerHomeProvider(new ObjectHomeMountProvider($config)); + $manager->registerRootProvider(new ObjectStorePreviewCacheMountProvider($logger, $config)); return $manager; }); @@ -1370,6 +1373,8 @@ class Server extends ServerContainer implements IServerContainer { $this->registerAlias(IInitialStateService::class, InitialStateService::class); + $this->registerAlias(\OCP\UserStatus\IManager::class, \OC\UserStatus\Manager::class); + $this->connectDispatcher(); } diff --git a/lib/private/UserStatus/Manager.php b/lib/private/UserStatus/Manager.php new file mode 100644 index 00000000000..c7726a88028 --- /dev/null +++ b/lib/private/UserStatus/Manager.php @@ -0,0 +1,105 @@ +<?php + +declare(strict_types=1); + +/** + * @copyright Copyright (c) 2020, Georg Ehrke + * + * @author Georg Ehrke <oc.list@georgehrke.com> + * + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + +namespace OC\UserStatus; + +use OCP\ILogger; +use OCP\IServerContainer; +use OCP\UserStatus\IManager; +use OCP\UserStatus\IProvider; +use Psr\Container\ContainerExceptionInterface; + +class Manager implements IManager { + + /** @var IServerContainer */ + private $container; + + /** @var ILogger */ + private $logger; + + /** @var null */ + private $providerClass; + + /** @var IProvider */ + private $provider; + + /** + * Manager constructor. + * + * @param IServerContainer $container + * @param ILogger $logger + */ + public function __construct(IServerContainer $container, + ILogger $logger) { + $this->container = $container; + $this->logger = $logger; + } + + /** + * @inheritDoc + */ + public function getUserStatuses(array $userIds): array { + $this->setupProvider(); + if (!$this->provider) { + return []; + } + + return $this->provider->getUserStatuses($userIds); + } + + /** + * @param string $class + * @since 20.0.0 + * @internal + */ + public function registerProvider(string $class): void { + $this->providerClass = $class; + $this->provider = null; + } + + /** + * Lazily set up provider + */ + private function setupProvider(): void { + if ($this->provider !== null) { + return; + } + if ($this->providerClass === null) { + return; + } + + try { + $provider = $this->container->get($this->providerClass); + } catch (ContainerExceptionInterface $e) { + $this->logger->logException($e, [ + 'message' => 'Could not load user-status provider dynamically: ' . $e->getMessage(), + 'level' => ILogger::ERROR, + ]); + return; + } + + $this->provider = $provider; + } +} diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index 82b7abf6c8f..fd55962447e 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -68,6 +68,7 @@ use OCP\IConfig; use OCP\IGroupManager; use OCP\ILogger; use OCP\IUser; +use OCP\IUserSession; class OC_Util { public static $scripts = []; @@ -296,6 +297,17 @@ class OC_Util { self::initLocalStorageRootFS(); } + /** @var \OCP\Files\Config\IMountProviderCollection $mountProviderCollection */ + $mountProviderCollection = \OC::$server->query(\OCP\Files\Config\IMountProviderCollection::class); + /** @var \OCP\Files\Mount\IMountPoint[] $rootMountProviders */ + $rootMountProviders = $mountProviderCollection->getRootMounts(); + + /** @var \OC\Files\Mount\Manager $mountManager */ + $mountManager = \OC\Files\Filesystem::getMountManager(); + foreach ($rootMountProviders as $rootMountProvider) { + $mountManager->addMount($rootMountProvider); + } + if ($user != '' && !\OC::$server->getUserManager()->userExists($user)) { \OC::$server->getEventLogger()->end('setup_fs'); return false; @@ -1088,6 +1100,8 @@ class OC_Util { * @suppress PhanDeprecatedFunction */ public static function getDefaultPageUrl() { + /** @var IConfig $config */ + $config = \OC::$server->get(IConfig::class); $urlGenerator = \OC::$server->getURLGenerator(); // Deny the redirect if the URL contains a @ // This prevents unvalidated redirects like ?redirect_url=:user@domain.com @@ -1099,8 +1113,16 @@ class OC_Util { $location = $urlGenerator->getAbsoluteURL($defaultPage); } else { $appId = 'files'; - $config = \OC::$server->getConfig(); - $defaultApps = explode(',', $config->getSystemValue('defaultapp', 'files')); + $defaultApps = explode(',', $config->getSystemValue('defaultapp', 'dashboard,files')); + + /** @var IUserSession $userSession */ + $userSession = \OC::$server->get(IUserSession::class); + $user = $userSession->getUser(); + if ($user) { + $userDefaultApps = explode(',', $config->getUserValue($user->getUID(), 'core', 'defaultapp')); + $defaultApps = array_filter(array_merge($userDefaultApps, $defaultApps)); + } + // find the first app that is enabled for the current user foreach ($defaultApps as $defaultApp) { $defaultApp = OC_App::cleanAppId(strip_tags($defaultApp)); diff --git a/lib/public/AppFramework/Bootstrap/IRegistrationContext.php b/lib/public/AppFramework/Bootstrap/IRegistrationContext.php index 94e3aed17e2..0acf0c038bb 100644 --- a/lib/public/AppFramework/Bootstrap/IRegistrationContext.php +++ b/lib/public/AppFramework/Bootstrap/IRegistrationContext.php @@ -59,11 +59,11 @@ interface IRegistrationContext { * Register an implementation of \OCP\Dashboard\IPanel that * will handle the implementation of a dashboard panel * - * @param string $panelClass + * @param string $widgetClass * @return void * @since 20.0.0 */ - public function registerDashboardPanel(string $panelClass): void; + public function registerDashboardWidget(string $widgetClass): void; /** * Register a service * diff --git a/lib/public/Dashboard/IManager.php b/lib/public/Dashboard/IManager.php index 985c8c7838f..81b1bb0dffe 100644 --- a/lib/public/Dashboard/IManager.php +++ b/lib/public/Dashboard/IManager.php @@ -35,15 +35,15 @@ namespace OCP\Dashboard; interface IManager { /** - * @param string $panelClass + * @param string $widgetClass * @since 20.0.0 */ - public function lazyRegisterPanel(string $panelClass): void; + public function lazyRegisterWidget(string $widgetClass): void; /** * @since 20.0.0 * - * @return IPanel[] + * @return IWidget[] */ - public function getPanels(): array; + public function getWidgets(): array; } diff --git a/lib/public/Dashboard/IPanel.php b/lib/public/Dashboard/IWidget.php index 59d88f7a7e9..42e2c7df5b2 100644 --- a/lib/public/Dashboard/IPanel.php +++ b/lib/public/Dashboard/IWidget.php @@ -27,33 +27,33 @@ declare(strict_types=1); namespace OCP\Dashboard; /** - * Interface IPanel + * Interface IWidget * * @package OCP\Dashboard * @since 20.0.0 */ -interface IPanel { +interface IWidget { /** - * @return string Unique id that identifies the panel, e.g. the app id + * @return string Unique id that identifies the widget, e.g. the app id * @since 20.0.0 */ public function getId(): string; /** - * @return string User facing title of the panel + * @return string User facing title of the widget * @since 20.0.0 */ public function getTitle(): string; /** - * @return int Initial order for panel sorting + * @return int Initial order for widget sorting * @since 20.0.0 */ public function getOrder(): int; /** - * @return string css class that displays an icon next to the panel title + * @return string css class that displays an icon next to the widget title * @since 20.0.0 */ public function getIconClass(): string; @@ -65,7 +65,7 @@ interface IPanel { public function getUrl(): ?string; /** - * Execute panel bootstrap code like loading scripts and providing initial state + * Execute widget bootstrap code like loading scripts and providing initial state * @since 20.0.0 */ public function load(): void; diff --git a/lib/public/Dashboard/RegisterPanelEvent.php b/lib/public/Dashboard/RegisterWidgetEvent.php index 2bd157127fd..0267a9e0d36 100644 --- a/lib/public/Dashboard/RegisterPanelEvent.php +++ b/lib/public/Dashboard/RegisterWidgetEvent.php @@ -40,7 +40,7 @@ use OCP\EventDispatcher\Event; * @since 20.0.0 * @deprecated 20.0.0 */ -class RegisterPanelEvent extends Event { +class RegisterWidgetEvent extends Event { private $manager; public function __construct(IManager $manager) { @@ -53,7 +53,7 @@ class RegisterPanelEvent extends Event { * @param string $panelClass * @since 20.0.0 */ - public function registerPanel(string $panelClass) { - $this->manager->lazyRegisterPanel($panelClass); + public function registerWidget(string $panelClass) { + $this->manager->lazyRegisterWidget($panelClass); } } diff --git a/lib/public/Files/Config/IRootMountProvider.php b/lib/public/Files/Config/IRootMountProvider.php new file mode 100644 index 00000000000..0f7b0eca3d4 --- /dev/null +++ b/lib/public/Files/Config/IRootMountProvider.php @@ -0,0 +1,41 @@ +<?php + +declare(strict_types=1); +/** + * @copyright Copyright (c) 2020, Morris Jobke <hey@morrisjobke.de> + * + * @author Morris Jobke <hey@morrisjobke.de> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\Files\Config; + +use OCP\Files\Storage\IStorageFactory; + +/** + * @since 20.0.0 + */ +interface IRootMountProvider { + /** + * Get all root mountpoints + * + * @return \OCP\Files\Mount\IMountPoint[] + * @since 20.0.0 + */ + public function getRootMounts(IStorageFactory $loader): array; +} diff --git a/lib/public/Search/IProvider.php b/lib/public/Search/IProvider.php index 66db62c6829..a91efa55fe1 100644 --- a/lib/public/Search/IProvider.php +++ b/lib/public/Search/IProvider.php @@ -68,11 +68,14 @@ interface IProvider { * Get the search provider order * The lower the int, the higher it will be sorted (0 will be before 10) * + * @param string $route the route the user is currently at, e.g. files.view.index + * @param array $routeParameters the parameters of the route the user is currently at, e.g. [fileId = 982, dir = "/"] + * * @return int * * @since 20.0.0 */ - public function getOrder(): int; + public function getOrder(string $route, array $routeParameters): int; /** * Find matching search entries in an app diff --git a/lib/public/Search/ISearchQuery.php b/lib/public/Search/ISearchQuery.php index 00d538050d4..f89251dd134 100644 --- a/lib/public/Search/ISearchQuery.php +++ b/lib/public/Search/ISearchQuery.php @@ -76,4 +76,16 @@ interface ISearchQuery { * @since 20.0.0 */ public function getCursor(); + + /** + * @return string + * @since 20.0.0 + */ + public function getRoute(): string; + + /** + * @return array + * @since 20.0.0 + */ + public function getRouteParameters(): array; } diff --git a/lib/public/UserStatus/IManager.php b/lib/public/UserStatus/IManager.php new file mode 100644 index 00000000000..7ef1fdf2396 --- /dev/null +++ b/lib/public/UserStatus/IManager.php @@ -0,0 +1,44 @@ +<?php + +declare(strict_types=1); + +/** + * @copyright Copyright (c) 2020, Georg Ehrke + * + * @author Georg Ehrke <oc.list@georgehrke.com> + * + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + +namespace OCP\UserStatus; + +/** + * Interface IManager + * + * @package OCP\UserStatus + * @since 20.0.0 + */ +interface IManager { + + /** + * Gets the statuses for all users in $users + * + * @param string[] $userIds + * @return IUserStatus[] + * @since 20.0.0 + */ + public function getUserStatuses(array $userIds):array; +} diff --git a/lib/public/UserStatus/IProvider.php b/lib/public/UserStatus/IProvider.php new file mode 100644 index 00000000000..10269502969 --- /dev/null +++ b/lib/public/UserStatus/IProvider.php @@ -0,0 +1,44 @@ +<?php + +declare(strict_types=1); + +/** + * @copyright Copyright (c) 2020, Georg Ehrke + * + * @author Georg Ehrke <oc.list@georgehrke.com> + * + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + +namespace OCP\UserStatus; + +/** + * Interface IManager + * + * @package OCP\UserStatus + * @since 20.0.0 + */ +interface IProvider { + + /** + * Gets the statuses for all users in $users + * + * @param string[] $userIds + * @return IUserStatus[] + * @since 20.0.0 + */ + public function getUserStatuses(array $userIds):array; +} diff --git a/lib/public/UserStatus/IUserStatus.php b/lib/public/UserStatus/IUserStatus.php new file mode 100644 index 00000000000..e892203aeca --- /dev/null +++ b/lib/public/UserStatus/IUserStatus.php @@ -0,0 +1,105 @@ +<?php + +declare(strict_types=1); + +/** + * @copyright Copyright (c) 2020, Georg Ehrke + * + * @author Georg Ehrke <oc.list@georgehrke.com> + * + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + +namespace OCP\UserStatus; + +use DateTimeImmutable; + +/** + * Interface IUserStatus + * + * @package OCP\UserStatus + * @since 20.0.0 + */ +interface IUserStatus { + + /** + * @var string + * @since 20.0.0 + */ + public const ONLINE = 'online'; + + /** + * @var string + * @since 20.0.0 + */ + public const AWAY = 'away'; + + /** + * @var string + * @since 20.0.0 + */ + public const DND = 'dnd'; + + /** + * @var string + * @since 20.0.0 + */ + public const OFFLINE = 'offline'; + + /** + * Get the user this status is connected to + * + * @return string + * @since 20.0.0 + */ + public function getUserId():string; + + /** + * Get the status + * + * It will return one of the constants defined above. + * It will never return invisible. In case a user marked + * themselves as invisible, it will return offline. + * + * @return string See IUserStatus constants + * @since 20.0.0 + */ + public function getStatus():string; + + /** + * Get a custom message provided by the user + * + * @return string|null + * @since 20.0.0 + */ + public function getMessage():?string; + + /** + * Get a custom icon provided by the user + * + * @return string|null + * @since 20.0.0 + */ + public function getIcon():?string; + + /** + * Gets the time that the custom status will be cleared at + * + * @return DateTimeImmutable|null + * @since 20.0.0 + */ + public function getClearAt():?DateTimeImmutable; +} diff --git a/lib/public/WorkflowEngine/EntityContext/IContextPortation.php b/lib/public/WorkflowEngine/EntityContext/IContextPortation.php new file mode 100644 index 00000000000..9c63fb048c3 --- /dev/null +++ b/lib/public/WorkflowEngine/EntityContext/IContextPortation.php @@ -0,0 +1,59 @@ +<?php + +declare(strict_types=1); +/** + * @copyright Copyright (c) 2020 Arthur Schiwon <blizzz@arthur-schiwon.de> + * + * @author Arthur Schiwon <blizzz@arthur-schiwon.de> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it w ill be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCP\WorkflowEngine\EntityContext; + +/** + * Interface IContextPortation + * + * Occasionally an IEntity needs to be reused not in the same, but a new + * request. As IEntities receive custom context information during a flow + * cycle, sometimes it might be necessary to export context identifiers to + * be able to recreate the state at a later point. For example: handling + * translations in a notification INotifier. + * + * @package OCP\WorkflowEngine\EntityContext + * + * @since 20.0.0 + */ +interface IContextPortation { + + /** + * All relevant context identifiers that are needed to restore the state + * of an entity shall be returned with this method. The resulting array + * must be JSON-serializable. + * + * @since 20.0.0 + */ + public function exportContextIDs(): array; + + /** + * This method receives the array as returned by `exportContextIDs()` in + * order to restore the state of the IEntity if necessary. + * + * @since 20.0.0 + */ + public function importContextIDs(array $contextIDs): void; +} |