diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-03-16 12:18:01 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-03-16 12:18:01 +0100 |
commit | 72632ad402bd905107db836ed0f9bfae825d6c52 (patch) | |
tree | 509bb82f2db24bb5d27bd4dea2b926f68ff8dddc /apps/files_external/settings.php | |
parent | fb4cf532533d99abfd1b4f40ef6319d484f6ef85 (diff) | |
download | nextcloud-server-72632ad402bd905107db836ed0f9bfae825d6c52.tar.gz nextcloud-server-72632ad402bd905107db836ed0f9bfae825d6c52.zip |
Generate storage config ids when missing
When reading in old mount.json files, they do not contain config ids.
Since these are needed to be able to use the UI and the new service
classes, these will be generated automatically.
The config grouping is based on a config hash.
Diffstat (limited to 'apps/files_external/settings.php')
-rw-r--r-- | apps/files_external/settings.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/apps/files_external/settings.php b/apps/files_external/settings.php index dec329e82a2..3144e1a2ab6 100644 --- a/apps/files_external/settings.php +++ b/apps/files_external/settings.php @@ -42,9 +42,29 @@ foreach ($backends as $class => $backend) } } +$mounts = OC_Mount_Config::getSystemMountPoints(); +$hasId = true; +foreach ($mounts as $mount) { + if (!isset($mount['id'])) { + // some mount points are missing ids + $hasId = false; + break; + } +} + +if (!$hasId) { + $service = new \OCA\Files_external\Service\GlobalStoragesService(); + // this will trigger the new storage code which will automatically + // generate storage config ids + $service->getAllStorages(); + // re-read updated config + $mounts = OC_Mount_Config::getSystemMountPoints(); + // TODO: use the new storage config format in the template +} + $tmpl = new OCP\Template('files_external', 'settings'); $tmpl->assign('isAdminPage', true); -$tmpl->assign('mounts', OC_Mount_Config::getSystemMountPoints()); +$tmpl->assign('mounts', $mounts); $tmpl->assign('backends', $backends); $tmpl->assign('personal_backends', $personal_backends); $tmpl->assign('dependencies', OC_Mount_Config::checkDependencies()); |