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.

76 lines
1.9 KiB

3 years ago
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Björn Schießle <bjoern@schiessle.org>
  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 OC\Encryption;
  24. use OC\Files\Filesystem;
  25. use OC\Files\View;
  26. class HookManager {
  27. /**
  28. * @var Update
  29. */
  30. private static $updater;
  31. public static function postShared($params) {
  32. self::getUpdate()->postShared($params);
  33. }
  34. public static function postUnshared($params) {
  35. self::getUpdate()->postUnshared($params);
  36. }
  37. public static function postRename($params) {
  38. self::getUpdate()->postRename($params);
  39. }
  40. public static function postRestore($params) {
  41. self::getUpdate()->postRestore($params);
  42. }
  43. /**
  44. * @return Update
  45. */
  46. private static function getUpdate() {
  47. if (is_null(self::$updater)) {
  48. $user = \OC::$server->getUserSession()->getUser();
  49. $uid = '';
  50. if ($user) {
  51. $uid = $user->getUID();
  52. }
  53. self::$updater = new Update(
  54. new View(),
  55. new Util(
  56. new View(),
  57. \OC::$server->getUserManager(),
  58. \OC::$server->getGroupManager(),
  59. \OC::$server->getConfig()),
  60. Filesystem::getMountManager(),
  61. \OC::$server->getEncryptionManager(),
  62. \OC::$server->getEncryptionFilesHelper(),
  63. $uid
  64. );
  65. }
  66. return self::$updater;
  67. }
  68. }