Application.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Lukas Reschke <lukas@statuscode.ch>
  6. * @author Thomas Müller <thomas.mueller@tmit.eu>
  7. *
  8. * @license AGPL-3.0
  9. *
  10. * This code is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License, version 3,
  12. * as published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License, version 3,
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>
  21. *
  22. */
  23. namespace OCA\UpdateNotification\AppInfo;
  24. use OC\AppFramework\Utility\TimeFactory;
  25. use OC\Updater;
  26. use OCA\UpdateNotification\Controller\AdminController;
  27. use OCA\UpdateNotification\UpdateChecker;
  28. use OCP\AppFramework\App;
  29. use OCP\AppFramework\IAppContainer;
  30. class Application extends App {
  31. public function __construct (array $urlParams = array()) {
  32. parent::__construct('updatenotification', $urlParams);
  33. $container = $this->getContainer();
  34. $container->registerService('AdminController', function(IAppContainer $c) {
  35. $updater = new \OC\Updater\VersionCheck(
  36. \OC::$server->getHTTPClientService(),
  37. \OC::$server->getConfig()
  38. );
  39. return new AdminController(
  40. $c->query('AppName'),
  41. $c->query('Request'),
  42. $c->getServer()->getJobList(),
  43. $c->getServer()->getSecureRandom(),
  44. $c->getServer()->getConfig(),
  45. new TimeFactory(),
  46. $c->getServer()->getL10N($c->query('AppName')),
  47. new UpdateChecker($updater),
  48. $c->getServer()->getDateTimeFormatter()
  49. );
  50. });
  51. }
  52. }