You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

personal.php 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * @author Joas Schilling <nickvergessen@owncloud.com>
  4. * @author Lukas Reschke <lukas@owncloud.com>
  5. * @author Michael Gapczynski <GapczynskiM@gmail.com>
  6. * @author Morris Jobke <hey@morrisjobke.de>
  7. * @author Vincent Petry <pvince81@owncloud.com>
  8. *
  9. * @copyright Copyright (c) 2015, ownCloud, Inc.
  10. * @license AGPL-3.0
  11. *
  12. * This code is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License, version 3,
  14. * as published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License, version 3,
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>
  23. *
  24. */
  25. OCP\Util::addScript('files_external', 'settings');
  26. OCP\Util::addStyle('files_external', 'settings');
  27. $backends = OC_Mount_Config::getPersonalBackends();
  28. $mounts = OC_Mount_Config::getPersonalMountPoints();
  29. $hasId = true;
  30. foreach ($mounts as $mount) {
  31. if (!isset($mount['id'])) {
  32. // some mount points are missing ids
  33. $hasId = false;
  34. break;
  35. }
  36. }
  37. if (!$hasId) {
  38. $service = new \OCA\Files_external\Service\UserStoragesService(\OC::$server->getUserSession());
  39. // this will trigger the new storage code which will automatically
  40. // generate storage config ids
  41. $service->getAllStorages();
  42. // re-read updated config
  43. $mounts = OC_Mount_Config::getPersonalMountPoints();
  44. // TODO: use the new storage config format in the template
  45. }
  46. $tmpl = new OCP\Template('files_external', 'settings');
  47. $tmpl->assign('isAdminPage', false);
  48. $tmpl->assign('mounts', $mounts);
  49. $tmpl->assign('dependencies', OC_Mount_Config::checkDependencies());
  50. $tmpl->assign('backends', $backends);
  51. return $tmpl->fetchPage();