webdav.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * @author Lukas Reschke <lukas@owncloud.com>
  4. * @author Roeland Jago Douma <rullzer@owncloud.com>
  5. * @author Thomas Müller <thomas.mueller@tmit.eu>
  6. *
  7. * @copyright Copyright (c) 2016, ownCloud, Inc.
  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. // no php execution timeout for webdav
  24. set_time_limit(0);
  25. // Turn off output buffering to prevent memory problems
  26. \OC_Util::obEnd();
  27. $serverFactory = new \OCA\DAV\Connector\Sabre\ServerFactory(
  28. \OC::$server->getConfig(),
  29. \OC::$server->getLogger(),
  30. \OC::$server->getDatabaseConnection(),
  31. \OC::$server->getUserSession(),
  32. \OC::$server->getMountManager(),
  33. \OC::$server->getTagManager(),
  34. \OC::$server->getRequest()
  35. );
  36. // Backends
  37. $authBackend = new \OCA\DAV\Connector\Sabre\Auth(
  38. \OC::$server->getSession(),
  39. \OC::$server->getUserSession(),
  40. 'principals/'
  41. );
  42. $requestUri = \OC::$server->getRequest()->getRequestUri();
  43. $server = $serverFactory->createServer($baseuri, $requestUri, $authBackend, function() {
  44. // use the view for the logged in user
  45. return \OC\Files\Filesystem::getView();
  46. });
  47. // And off we go!
  48. $server->exec();