LockNotAcquiredException.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Morris Jobke <hey@morrisjobke.de>
  6. * @author Owen Winkler <a_github@midnightcircus.com>
  7. * @author Robin Appelman <robin@icewind.nl>
  8. * @author Roeland Jago Douma <roeland@famdouma.nl>
  9. *
  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. /**
  26. * Public interface of ownCloud for apps to use.
  27. * Files/LockNotAcquiredException class
  28. */
  29. // use OCP namespace for all classes that are considered public.
  30. // This means that they should be used by apps instead of the internal ownCloud classes
  31. namespace OCP\Files;
  32. /**
  33. * Exception for a file that is locked
  34. * @since 7.0.0
  35. */
  36. class LockNotAcquiredException extends \Exception {
  37. /** @var string $path The path that could not be locked */
  38. public $path;
  39. /** @var integer $lockType The type of the lock that was attempted */
  40. public $lockType;
  41. /**
  42. * @since 7.0.0
  43. */
  44. public function __construct($path, $lockType, $code = 0, \Exception $previous = null) {
  45. $message = \OC::$server->getL10N('core')->t('Could not obtain lock type %d on "%s".', array($lockType, $path));
  46. parent::__construct($message, $code, $previous);
  47. }
  48. /**
  49. * custom string representation of object
  50. *
  51. * @return string
  52. * @since 7.0.0
  53. */
  54. public function __toString() {
  55. return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
  56. }
  57. }