From 72632ad402bd905107db836ed0f9bfae825d6c52 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 16 Mar 2015 12:18:01 +0100 Subject: 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. --- apps/files_external/personal.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'apps/files_external/personal.php') 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(); -- cgit v1.2.3