locknotacquiredexception.php 1.8 KB

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