'OCP\\Federation\\ICloudIdManager' => $baseDir . '/lib/public/Federation/ICloudIdManager.php',
'OCP\\Files' => $baseDir . '/lib/public/Files.php',
'OCP\\Files\\AlreadyExistsException' => $baseDir . '/lib/public/Files/AlreadyExistsException.php',
+ 'OCP\\Files\\AppData\\IAppDataFactory' => $baseDir . '/lib/public/Files/AppData/IAppDataFactory.php',
'OCP\\Files\\Cache\\AbstractCacheEvent' => $baseDir . '/lib/public/Files/Cache/AbstractCacheEvent.php',
'OCP\\Files\\Cache\\CacheEntryInsertedEvent' => $baseDir . '/lib/public/Files/Cache/CacheEntryInsertedEvent.php',
'OCP\\Files\\Cache\\CacheEntryRemovedEvent' => $baseDir . '/lib/public/Files/Cache/CacheEntryRemovedEvent.php',
'OCP\\Federation\\ICloudIdManager' => __DIR__ . '/../../..' . '/lib/public/Federation/ICloudIdManager.php',
'OCP\\Files' => __DIR__ . '/../../..' . '/lib/public/Files.php',
'OCP\\Files\\AlreadyExistsException' => __DIR__ . '/../../..' . '/lib/public/Files/AlreadyExistsException.php',
+ 'OCP\\Files\\AppData\\IAppDataFactory' => __DIR__ . '/../../..' . '/lib/public/Files/AppData/IAppDataFactory.php',
'OCP\\Files\\Cache\\AbstractCacheEvent' => __DIR__ . '/../../..' . '/lib/public/Files/Cache/AbstractCacheEvent.php',
'OCP\\Files\\Cache\\CacheEntryInsertedEvent' => __DIR__ . '/../../..' . '/lib/public/Files/Cache/CacheEntryInsertedEvent.php',
'OCP\\Files\\Cache\\CacheEntryRemovedEvent' => __DIR__ . '/../../..' . '/lib/public/Files/Cache/CacheEntryRemovedEvent.php',
namespace OC\Files\AppData;
use OC\SystemConfig;
+use OCP\Files\AppData\IAppDataFactory;
+use OCP\Files\IAppData;
use OCP\Files\IRootFolder;
-class Factory {
+class Factory implements IAppDataFactory {
+ private IRootFolder $rootFolder;
+ private SystemConfig $config;
- /** @var IRootFolder */
- private $rootFolder;
-
- /** @var SystemConfig */
- private $config;
-
- private $folders = [];
+ /** @var array<string, IAppData> */
+ private array $folders = [];
public function __construct(IRootFolder $rootFolder,
SystemConfig $systemConfig) {
$this->config = $systemConfig;
}
- /**
- * @param string $appId
- * @return AppData
- */
- public function get(string $appId): AppData {
+ public function get(string $appId): IAppData {
if (!isset($this->folders[$appId])) {
$this->folders[$appId] = new AppData($this->rootFolder, $this->config, $appId);
}
$this->registerAlias(IMetadataManager::class, MetadataManager::class);
+ $this->registerAlias(\OCP\Files\AppData\IAppDataFactory::class, \OC\Files\AppData\Factory::class);
+
$this->connectDispatcher();
}
/**
* @return \OCP\Files\IAppData
- * @deprecated 20.0.0
+ * @deprecated 20.0.0 Use get(\OCP\Files\AppData\IAppDataFactory::class)->get($app) instead
*/
public function getAppDataDir($app) {
/** @var \OC\Files\AppData\Factory $factory */
--- /dev/null
+<?php
+
+namespace OCP\Files\AppData;
+
+use OCP\Files\IAppData;
+
+/**
+ * A factory allows you to get the AppData folder for an application.
+ *
+ * @since 25.0.0
+ */
+interface IAppDataFactory {
+
+ /**
+ * Get the AppData folder for the specified $appId
+ * @param string $appId
+ * @return IAppData
+ * @since 25.0.0
+ */
+ public function get(string $appId): IAppData;
+}