summaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-09-14 15:04:23 +0200
committerLukas Reschke <lukas@owncloud.com>2015-09-14 15:04:23 +0200
commit4a777d686bd1bffb32ab6a52d479fe3a7bb33c4f (patch)
tree2d7760baf91fec4a270fb894ac6bc71b4349533a /apps/files_external/lib
parent1369525e7f6b9676062fa6b04d012f4ec7f5e693 (diff)
parentd67251fe4c908111c542ba105798ddae2f6749c7 (diff)
downloadnextcloud-server-4a777d686bd1bffb32ab6a52d479fe3a7bb33c4f.tar.gz
nextcloud-server-4a777d686bd1bffb32ab6a52d479fe3a7bb33c4f.zip
Merge pull request #18966 from owncloud/ext-remove-numeric-id
Remove storing storage_id in mount.json
Diffstat (limited to 'apps/files_external/lib')
-rw-r--r--apps/files_external/lib/config.php67
1 files changed, 0 insertions, 67 deletions
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php
index 62932dc4028..2dc7de30a6c 100644
--- a/apps/files_external/lib/config.php
+++ b/apps/files_external/lib/config.php
@@ -81,9 +81,7 @@ class OC_Mount_Config {
* @param array $data
*/
public static function initMountPointsHook($data) {
- self::addStorageIdToConfig(null);
if ($data['user']) {
- self::addStorageIdToConfig($data['user']);
$user = \OC::$server->getUserManager()->get($data['user']);
if (!$user) {
\OC::$server->getLogger()->warning(
@@ -210,7 +208,6 @@ class OC_Mount_Config {
'users' => $storage->getApplicableUsers(),
];
$mountEntry['id'] = $storage->getId();
- // $mountEntry['storage_id'] = null; // we don't store this!
return $mountEntry;
}
@@ -310,14 +307,6 @@ class OC_Mount_Config {
$file = $config->getSystemValue('mount_file', $datadir . '/mount.json');
}
- foreach ($data as &$applicables) {
- foreach ($applicables as &$mountPoints) {
- foreach ($mountPoints as &$options) {
- self::addStorageId($options);
- }
- }
- }
-
$content = json_encode($data, JSON_PRETTY_PRINT);
@file_put_contents($file, $content);
@chmod($file, 0640);
@@ -492,60 +481,4 @@ class OC_Mount_Config {
);
return hash('md5', $data);
}
-
- /**
- * Add storage id to the storage configurations that did not have any.
- *
- * @param string $user user for which to process storage configs
- */
- private static function addStorageIdToConfig($user) {
- $config = self::readData($user);
-
- $needUpdate = false;
- foreach ($config as &$applicables) {
- foreach ($applicables as &$mountPoints) {
- foreach ($mountPoints as &$options) {
- $needUpdate |= !isset($options['storage_id']);
- }
- }
- }
-
- if ($needUpdate) {
- self::writeData($user, $config);
- }
- }
-
- /**
- * Get storage id from the numeric storage id and set
- * it into the given options argument. Only do this
- * if there was no storage id set yet.
- *
- * This might also fail if a storage wasn't fully configured yet
- * and couldn't be mounted, in which case this will simply return false.
- *
- * @param array $options storage options
- *
- * @return bool true if the storage id was added, false otherwise
- */
- private static function addStorageId(&$options) {
- if (isset($options['storage_id'])) {
- return false;
- }
-
- $service = self::$app->getContainer()->query('OCA\Files_External\Service\BackendService');
- $class = $service->getBackend($options['backend'])->getStorageClass();
- try {
- /** @var \OC\Files\Storage\Storage $storage */
- $storage = new $class($options['options']);
- // TODO: introduce StorageConfigException
- } catch (\Exception $e) {
- // storage might not be fully configured yet (ex: Dropbox)
- // note that storage instances aren't supposed to open any connections
- // in the constructor, so this exception is likely to be a config exception
- return false;
- }
-
- $options['storage_id'] = $storage->getCache()->getNumericStorageId();
- return true;
- }
}