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.

75 lines
1.9 KiB

10 years ago
  1. <?php
  2. /**
  3. * @author Björn Schießle <schiessle@owncloud.com>
  4. * @author Thomas Müller <thomas.mueller@tmit.eu>
  5. *
  6. * @copyright Copyright (c) 2016, ownCloud, Inc.
  7. * @license AGPL-3.0
  8. *
  9. * This code is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License, version 3,
  11. * as published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Affero General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License, version 3,
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>
  20. *
  21. */
  22. namespace OC\Encryption;
  23. use OC\Files\Filesystem;
  24. use OC\Files\View;
  25. class HookManager {
  26. /**
  27. * @var Update
  28. */
  29. private static $updater;
  30. public static function postShared($params) {
  31. self::getUpdate()->postShared($params);
  32. }
  33. public static function postUnshared($params) {
  34. self::getUpdate()->postUnshared($params);
  35. }
  36. public static function postRename($params) {
  37. self::getUpdate()->postRename($params);
  38. }
  39. public static function postRestore($params) {
  40. self::getUpdate()->postRestore($params);
  41. }
  42. /**
  43. * @return Update
  44. */
  45. private static function getUpdate() {
  46. if (is_null(self::$updater)) {
  47. $user = \OC::$server->getUserSession()->getUser();
  48. $uid = '';
  49. if ($user) {
  50. $uid = $user->getUID();
  51. }
  52. self::$updater = new Update(
  53. new View(),
  54. new Util(
  55. new View(),
  56. \OC::$server->getUserManager(),
  57. \OC::$server->getGroupManager(),
  58. \OC::$server->getConfig()),
  59. Filesystem::getMountManager(),
  60. \OC::$server->getEncryptionManager(),
  61. \OC::$server->getEncryptionFilesHelper(),
  62. $uid
  63. );
  64. }
  65. return self::$updater;
  66. }
  67. }