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/personal.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/personal.php')
-rw-r--r-- | apps/files_external/personal.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/apps/files_external/personal.php b/apps/files_external/personal.php index a279163ff70..8b435442259 100644 --- a/apps/files_external/personal.php +++ b/apps/files_external/personal.php @@ -24,9 +24,29 @@ OCP\Util::addScript('files_external', 'settings'); OCP\Util::addStyle('files_external', 'settings'); $backends = OC_Mount_Config::getPersonalBackends(); +$mounts = OC_Mount_Config::getPersonalMountPoints(); +$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\UserStoragesService(\OC::$server->getUserSession()); + // this will trigger the new storage code which will automatically + // generate storage config ids + $service->getAllStorages(); + // re-read updated config + $mounts = OC_Mount_Config::getPersonalMountPoints(); + // TODO: use the new storage config format in the template +} + $tmpl = new OCP\Template('files_external', 'settings'); $tmpl->assign('isAdminPage', false); -$tmpl->assign('mounts', OC_Mount_Config::getPersonalMountPoints()); +$tmpl->assign('mounts', $mounts); $tmpl->assign('dependencies', OC_Mount_Config::checkDependencies()); $tmpl->assign('backends', $backends); return $tmpl->fetchPage(); |