@@ -48,6 +48,9 @@ discard block |
||
| 48 | 48 | $this->stack = $stack; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | + /** |
|
| 52 | + * @param double $time |
|
| 53 | + */ |
|
| 51 | 54 | public function end($time) { |
| 52 | 55 | $this->end = $time; |
| 53 | 56 | } |
@@ -67,7 +70,7 @@ discard block |
||
| 67 | 70 | } |
| 68 | 71 | |
| 69 | 72 | /** |
| 70 | - * @return float |
|
| 73 | + * @return integer |
|
| 71 | 74 | */ |
| 72 | 75 | public function getStart() { |
| 73 | 76 | return $this->start; |
@@ -26,65 +26,65 @@ |
||
| 26 | 26 | use OCP\Diagnostics\IQuery; |
| 27 | 27 | |
| 28 | 28 | class Query implements IQuery { |
| 29 | - private $sql; |
|
| 29 | + private $sql; |
|
| 30 | 30 | |
| 31 | - private $params; |
|
| 31 | + private $params; |
|
| 32 | 32 | |
| 33 | - private $start; |
|
| 33 | + private $start; |
|
| 34 | 34 | |
| 35 | - private $end; |
|
| 35 | + private $end; |
|
| 36 | 36 | |
| 37 | - private $stack; |
|
| 37 | + private $stack; |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @param string $sql |
|
| 41 | - * @param array $params |
|
| 42 | - * @param int $start |
|
| 43 | - */ |
|
| 44 | - public function __construct($sql, $params, $start, array $stack) { |
|
| 45 | - $this->sql = $sql; |
|
| 46 | - $this->params = $params; |
|
| 47 | - $this->start = $start; |
|
| 48 | - $this->stack = $stack; |
|
| 49 | - } |
|
| 39 | + /** |
|
| 40 | + * @param string $sql |
|
| 41 | + * @param array $params |
|
| 42 | + * @param int $start |
|
| 43 | + */ |
|
| 44 | + public function __construct($sql, $params, $start, array $stack) { |
|
| 45 | + $this->sql = $sql; |
|
| 46 | + $this->params = $params; |
|
| 47 | + $this->start = $start; |
|
| 48 | + $this->stack = $stack; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - public function end($time) { |
|
| 52 | - $this->end = $time; |
|
| 53 | - } |
|
| 51 | + public function end($time) { |
|
| 52 | + $this->end = $time; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * @return array |
|
| 57 | - */ |
|
| 58 | - public function getParams() { |
|
| 59 | - return $this->params; |
|
| 60 | - } |
|
| 55 | + /** |
|
| 56 | + * @return array |
|
| 57 | + */ |
|
| 58 | + public function getParams() { |
|
| 59 | + return $this->params; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * @return string |
|
| 64 | - */ |
|
| 65 | - public function getSql() { |
|
| 66 | - return $this->sql; |
|
| 67 | - } |
|
| 62 | + /** |
|
| 63 | + * @return string |
|
| 64 | + */ |
|
| 65 | + public function getSql() { |
|
| 66 | + return $this->sql; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * @return float |
|
| 71 | - */ |
|
| 72 | - public function getStart() { |
|
| 73 | - return $this->start; |
|
| 74 | - } |
|
| 69 | + /** |
|
| 70 | + * @return float |
|
| 71 | + */ |
|
| 72 | + public function getStart() { |
|
| 73 | + return $this->start; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * @return float |
|
| 78 | - */ |
|
| 79 | - public function getDuration() { |
|
| 80 | - return $this->end - $this->start; |
|
| 81 | - } |
|
| 76 | + /** |
|
| 77 | + * @return float |
|
| 78 | + */ |
|
| 79 | + public function getDuration() { |
|
| 80 | + return $this->end - $this->start; |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - public function getStartTime() { |
|
| 84 | - return $this->start; |
|
| 85 | - } |
|
| 83 | + public function getStartTime() { |
|
| 84 | + return $this->start; |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - public function getStacktrace() { |
|
| 88 | - return $this->stack; |
|
| 89 | - } |
|
| 87 | + public function getStacktrace() { |
|
| 88 | + return $this->stack; |
|
| 89 | + } |
|
| 90 | 90 | } |
@@ -35,55 +35,55 @@ |
||
| 35 | 35 | * @since 8.0.0 |
| 36 | 36 | */ |
| 37 | 37 | interface IEventLogger { |
| 38 | - /** |
|
| 39 | - * Mark the start of an event setting its ID $id and providing event description $description. |
|
| 40 | - * |
|
| 41 | - * @param string $id |
|
| 42 | - * @param string $description |
|
| 43 | - * @since 8.0.0 |
|
| 44 | - */ |
|
| 45 | - public function start($id, $description); |
|
| 38 | + /** |
|
| 39 | + * Mark the start of an event setting its ID $id and providing event description $description. |
|
| 40 | + * |
|
| 41 | + * @param string $id |
|
| 42 | + * @param string $description |
|
| 43 | + * @since 8.0.0 |
|
| 44 | + */ |
|
| 45 | + public function start($id, $description); |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Mark the end of an event with specific ID $id, marked by start() method. |
|
| 49 | - * Ending event should store \OCP\Diagnostics\IEvent to |
|
| 50 | - * be returned with getEvents() method. |
|
| 51 | - * |
|
| 52 | - * @param string $id |
|
| 53 | - * @since 8.0.0 |
|
| 54 | - */ |
|
| 55 | - public function end($id); |
|
| 47 | + /** |
|
| 48 | + * Mark the end of an event with specific ID $id, marked by start() method. |
|
| 49 | + * Ending event should store \OCP\Diagnostics\IEvent to |
|
| 50 | + * be returned with getEvents() method. |
|
| 51 | + * |
|
| 52 | + * @param string $id |
|
| 53 | + * @since 8.0.0 |
|
| 54 | + */ |
|
| 55 | + public function end($id); |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * Mark the start and the end of an event with specific ID $id and description $description, |
|
| 59 | - * explicitly marking start and end of the event, represented by $start and $end timestamps. |
|
| 60 | - * Logging event should store \OCP\Diagnostics\IEvent to |
|
| 61 | - * be returned with getEvents() method. |
|
| 62 | - * |
|
| 63 | - * @param string $id |
|
| 64 | - * @param string $description |
|
| 65 | - * @param float $start |
|
| 66 | - * @param float $end |
|
| 67 | - * @since 8.0.0 |
|
| 68 | - */ |
|
| 69 | - public function log($id, $description, $start, $end); |
|
| 57 | + /** |
|
| 58 | + * Mark the start and the end of an event with specific ID $id and description $description, |
|
| 59 | + * explicitly marking start and end of the event, represented by $start and $end timestamps. |
|
| 60 | + * Logging event should store \OCP\Diagnostics\IEvent to |
|
| 61 | + * be returned with getEvents() method. |
|
| 62 | + * |
|
| 63 | + * @param string $id |
|
| 64 | + * @param string $description |
|
| 65 | + * @param float $start |
|
| 66 | + * @param float $end |
|
| 67 | + * @since 8.0.0 |
|
| 68 | + */ |
|
| 69 | + public function log($id, $description, $start, $end); |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * This method should return all \OCP\Diagnostics\IEvent objects stored using |
|
| 73 | - * start()/end() or log() methods |
|
| 74 | - * |
|
| 75 | - * @return \OCP\Diagnostics\IEvent[] |
|
| 76 | - * @since 8.0.0 |
|
| 77 | - */ |
|
| 78 | - public function getEvents(); |
|
| 71 | + /** |
|
| 72 | + * This method should return all \OCP\Diagnostics\IEvent objects stored using |
|
| 73 | + * start()/end() or log() methods |
|
| 74 | + * |
|
| 75 | + * @return \OCP\Diagnostics\IEvent[] |
|
| 76 | + * @since 8.0.0 |
|
| 77 | + */ |
|
| 78 | + public function getEvents(); |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * Activate the module for the duration of the request. Deactivated module |
|
| 82 | - * does not create and store \OCP\Diagnostics\IEvent objects. |
|
| 83 | - * Only activated module should create and store objects to be |
|
| 84 | - * returned with getEvents() call. |
|
| 85 | - * |
|
| 86 | - * @since 12.0.0 |
|
| 87 | - */ |
|
| 88 | - public function activate(); |
|
| 80 | + /** |
|
| 81 | + * Activate the module for the duration of the request. Deactivated module |
|
| 82 | + * does not create and store \OCP\Diagnostics\IEvent objects. |
|
| 83 | + * Only activated module should create and store objects to be |
|
| 84 | + * returned with getEvents() call. |
|
| 85 | + * |
|
| 86 | + * @since 12.0.0 |
|
| 87 | + */ |
|
| 88 | + public function activate(); |
|
| 89 | 89 | } |
@@ -30,38 +30,38 @@ |
||
| 30 | 30 | * @since 8.0.0 |
| 31 | 31 | */ |
| 32 | 32 | interface IQuery { |
| 33 | - /** |
|
| 34 | - * @return string |
|
| 35 | - * @since 8.0.0 |
|
| 36 | - */ |
|
| 37 | - public function getSql(); |
|
| 33 | + /** |
|
| 34 | + * @return string |
|
| 35 | + * @since 8.0.0 |
|
| 36 | + */ |
|
| 37 | + public function getSql(); |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @return array |
|
| 41 | - * @since 8.0.0 |
|
| 42 | - */ |
|
| 43 | - public function getParams(); |
|
| 39 | + /** |
|
| 40 | + * @return array |
|
| 41 | + * @since 8.0.0 |
|
| 42 | + */ |
|
| 43 | + public function getParams(); |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @return float |
|
| 47 | - * @since 8.0.0 |
|
| 48 | - */ |
|
| 49 | - public function getDuration(); |
|
| 45 | + /** |
|
| 46 | + * @return float |
|
| 47 | + * @since 8.0.0 |
|
| 48 | + */ |
|
| 49 | + public function getDuration(); |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @return float |
|
| 53 | - * @since 11.0.0 |
|
| 54 | - */ |
|
| 55 | - public function getStartTime(); |
|
| 51 | + /** |
|
| 52 | + * @return float |
|
| 53 | + * @since 11.0.0 |
|
| 54 | + */ |
|
| 55 | + public function getStartTime(); |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * @return array |
|
| 59 | - * @since 11.0.0 |
|
| 60 | - */ |
|
| 61 | - public function getStacktrace(); |
|
| 62 | - /** |
|
| 63 | - * @return array |
|
| 64 | - * @since 12.0.0 |
|
| 65 | - */ |
|
| 66 | - public function getStart(); |
|
| 57 | + /** |
|
| 58 | + * @return array |
|
| 59 | + * @since 11.0.0 |
|
| 60 | + */ |
|
| 61 | + public function getStacktrace(); |
|
| 62 | + /** |
|
| 63 | + * @return array |
|
| 64 | + * @since 12.0.0 |
|
| 65 | + */ |
|
| 66 | + public function getStart(); |
|
| 67 | 67 | } |
@@ -28,56 +28,56 @@ |
||
| 28 | 28 | use OCP\Diagnostics\IEventLogger; |
| 29 | 29 | |
| 30 | 30 | class EventLogger implements IEventLogger { |
| 31 | - /** |
|
| 32 | - * @var \OC\Diagnostics\Event[] |
|
| 33 | - */ |
|
| 34 | - private $events = []; |
|
| 31 | + /** |
|
| 32 | + * @var \OC\Diagnostics\Event[] |
|
| 33 | + */ |
|
| 34 | + private $events = []; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @var bool - Module needs to be activated by some app |
|
| 38 | - */ |
|
| 39 | - private $activated = false; |
|
| 36 | + /** |
|
| 37 | + * @var bool - Module needs to be activated by some app |
|
| 38 | + */ |
|
| 39 | + private $activated = false; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @inheritdoc |
|
| 43 | - */ |
|
| 44 | - public function start($id, $description) { |
|
| 45 | - if ($this->activated){ |
|
| 46 | - $this->events[$id] = new Event($id, $description, microtime(true)); |
|
| 47 | - } |
|
| 48 | - } |
|
| 41 | + /** |
|
| 42 | + * @inheritdoc |
|
| 43 | + */ |
|
| 44 | + public function start($id, $description) { |
|
| 45 | + if ($this->activated){ |
|
| 46 | + $this->events[$id] = new Event($id, $description, microtime(true)); |
|
| 47 | + } |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @inheritdoc |
|
| 52 | - */ |
|
| 53 | - public function end($id) { |
|
| 54 | - if ($this->activated && isset($this->events[$id])) { |
|
| 55 | - $timing = $this->events[$id]; |
|
| 56 | - $timing->end(microtime(true)); |
|
| 57 | - } |
|
| 58 | - } |
|
| 50 | + /** |
|
| 51 | + * @inheritdoc |
|
| 52 | + */ |
|
| 53 | + public function end($id) { |
|
| 54 | + if ($this->activated && isset($this->events[$id])) { |
|
| 55 | + $timing = $this->events[$id]; |
|
| 56 | + $timing->end(microtime(true)); |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @inheritdoc |
|
| 62 | - */ |
|
| 63 | - public function log($id, $description, $start, $end) { |
|
| 64 | - if ($this->activated) { |
|
| 65 | - $this->events[$id] = new Event($id, $description, $start); |
|
| 66 | - $this->events[$id]->end($end); |
|
| 67 | - } |
|
| 68 | - } |
|
| 60 | + /** |
|
| 61 | + * @inheritdoc |
|
| 62 | + */ |
|
| 63 | + public function log($id, $description, $start, $end) { |
|
| 64 | + if ($this->activated) { |
|
| 65 | + $this->events[$id] = new Event($id, $description, $start); |
|
| 66 | + $this->events[$id]->end($end); |
|
| 67 | + } |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * @inheritdoc |
|
| 72 | - */ |
|
| 73 | - public function getEvents() { |
|
| 74 | - return $this->events; |
|
| 75 | - } |
|
| 70 | + /** |
|
| 71 | + * @inheritdoc |
|
| 72 | + */ |
|
| 73 | + public function getEvents() { |
|
| 74 | + return $this->events; |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * @inheritdoc |
|
| 79 | - */ |
|
| 80 | - public function activate() { |
|
| 81 | - $this->activated = true; |
|
| 82 | - } |
|
| 77 | + /** |
|
| 78 | + * @inheritdoc |
|
| 79 | + */ |
|
| 80 | + public function activate() { |
|
| 81 | + $this->activated = true; |
|
| 82 | + } |
|
| 83 | 83 | } |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | * @inheritdoc |
| 43 | 43 | */ |
| 44 | 44 | public function start($id, $description) { |
| 45 | - if ($this->activated){ |
|
| 45 | + if ($this->activated) { |
|
| 46 | 46 | $this->events[$id] = new Event($id, $description, microtime(true)); |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -118,17 +118,17 @@ discard block |
||
| 118 | 118 | protected function attachListener($mount) { |
| 119 | 119 | $scanner = $mount->getStorage()->getScanner(); |
| 120 | 120 | $emitter = $this; |
| 121 | - $scanner->listen('\OC\Files\Cache\Scanner', 'scanFile', function ($path) use ($mount, $emitter) { |
|
| 122 | - $emitter->emit('\OC\Files\Utils\Scanner', 'scanFile', array($mount->getMountPoint() . $path)); |
|
| 121 | + $scanner->listen('\OC\Files\Cache\Scanner', 'scanFile', function($path) use ($mount, $emitter) { |
|
| 122 | + $emitter->emit('\OC\Files\Utils\Scanner', 'scanFile', array($mount->getMountPoint().$path)); |
|
| 123 | 123 | }); |
| 124 | - $scanner->listen('\OC\Files\Cache\Scanner', 'scanFolder', function ($path) use ($mount, $emitter) { |
|
| 125 | - $emitter->emit('\OC\Files\Utils\Scanner', 'scanFolder', array($mount->getMountPoint() . $path)); |
|
| 124 | + $scanner->listen('\OC\Files\Cache\Scanner', 'scanFolder', function($path) use ($mount, $emitter) { |
|
| 125 | + $emitter->emit('\OC\Files\Utils\Scanner', 'scanFolder', array($mount->getMountPoint().$path)); |
|
| 126 | 126 | }); |
| 127 | - $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFile', function ($path) use ($mount, $emitter) { |
|
| 128 | - $emitter->emit('\OC\Files\Utils\Scanner', 'postScanFile', array($mount->getMountPoint() . $path)); |
|
| 127 | + $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFile', function($path) use ($mount, $emitter) { |
|
| 128 | + $emitter->emit('\OC\Files\Utils\Scanner', 'postScanFile', array($mount->getMountPoint().$path)); |
|
| 129 | 129 | }); |
| 130 | - $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFolder', function ($path) use ($mount, $emitter) { |
|
| 131 | - $emitter->emit('\OC\Files\Utils\Scanner', 'postScanFolder', array($mount->getMountPoint() . $path)); |
|
| 130 | + $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFolder', function($path) use ($mount, $emitter) { |
|
| 131 | + $emitter->emit('\OC\Files\Utils\Scanner', 'postScanFolder', array($mount->getMountPoint().$path)); |
|
| 132 | 132 | }); |
| 133 | 133 | } |
| 134 | 134 | |
@@ -160,13 +160,13 @@ discard block |
||
| 160 | 160 | $scanner = $storage->getScanner(); |
| 161 | 161 | $this->attachListener($mount); |
| 162 | 162 | |
| 163 | - $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', function ($path) use ($storage) { |
|
| 163 | + $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', function($path) use ($storage) { |
|
| 164 | 164 | $this->triggerPropagator($storage, $path); |
| 165 | 165 | }); |
| 166 | - $scanner->listen('\OC\Files\Cache\Scanner', 'updateCache', function ($path) use ($storage) { |
|
| 166 | + $scanner->listen('\OC\Files\Cache\Scanner', 'updateCache', function($path) use ($storage) { |
|
| 167 | 167 | $this->triggerPropagator($storage, $path); |
| 168 | 168 | }); |
| 169 | - $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function ($path) use ($storage) { |
|
| 169 | + $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function($path) use ($storage) { |
|
| 170 | 170 | $this->triggerPropagator($storage, $path); |
| 171 | 171 | }); |
| 172 | 172 | |
@@ -219,13 +219,13 @@ discard block |
||
| 219 | 219 | $scanner->setUseTransactions(false); |
| 220 | 220 | $this->attachListener($mount); |
| 221 | 221 | |
| 222 | - $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', function ($path) use ($storage) { |
|
| 222 | + $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', function($path) use ($storage) { |
|
| 223 | 223 | $this->postProcessEntry($storage, $path); |
| 224 | 224 | }); |
| 225 | - $scanner->listen('\OC\Files\Cache\Scanner', 'updateCache', function ($path) use ($storage) { |
|
| 225 | + $scanner->listen('\OC\Files\Cache\Scanner', 'updateCache', function($path) use ($storage) { |
|
| 226 | 226 | $this->postProcessEntry($storage, $path); |
| 227 | 227 | }); |
| 228 | - $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function ($path) use ($storage) { |
|
| 228 | + $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function($path) use ($storage) { |
|
| 229 | 229 | $this->postProcessEntry($storage, $path); |
| 230 | 230 | }); |
| 231 | 231 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | } |
| 248 | 248 | $propagator->commitBatch(); |
| 249 | 249 | } catch (StorageNotAvailableException $e) { |
| 250 | - $this->logger->error('Storage ' . $storage->getId() . ' not available'); |
|
| 250 | + $this->logger->error('Storage '.$storage->getId().' not available'); |
|
| 251 | 251 | $this->logger->logException($e); |
| 252 | 252 | $this->emit('\OC\Files\Utils\Scanner', 'StorageNotAvailable', [$e]); |
| 253 | 253 | } |
@@ -182,6 +182,7 @@ |
||
| 182 | 182 | |
| 183 | 183 | /** |
| 184 | 184 | * @param string $dir |
| 185 | + * @param boolean $recursive |
|
| 185 | 186 | * @throws \OC\ForbiddenException |
| 186 | 187 | * @throws \OCP\Files\NotFoundException |
| 187 | 188 | */ |
@@ -50,233 +50,233 @@ |
||
| 50 | 50 | * @package OC\Files\Utils |
| 51 | 51 | */ |
| 52 | 52 | class Scanner extends PublicEmitter { |
| 53 | - const MAX_ENTRIES_TO_COMMIT = 10000; |
|
| 53 | + const MAX_ENTRIES_TO_COMMIT = 10000; |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * @var string $user |
|
| 57 | - */ |
|
| 58 | - private $user; |
|
| 55 | + /** |
|
| 56 | + * @var string $user |
|
| 57 | + */ |
|
| 58 | + private $user; |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @var \OCP\IDBConnection |
|
| 62 | - */ |
|
| 63 | - protected $db; |
|
| 60 | + /** |
|
| 61 | + * @var \OCP\IDBConnection |
|
| 62 | + */ |
|
| 63 | + protected $db; |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * @var ILogger |
|
| 67 | - */ |
|
| 68 | - protected $logger; |
|
| 65 | + /** |
|
| 66 | + * @var ILogger |
|
| 67 | + */ |
|
| 68 | + protected $logger; |
|
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * Whether to use a DB transaction |
|
| 72 | - * |
|
| 73 | - * @var bool |
|
| 74 | - */ |
|
| 75 | - protected $useTransaction; |
|
| 70 | + /** |
|
| 71 | + * Whether to use a DB transaction |
|
| 72 | + * |
|
| 73 | + * @var bool |
|
| 74 | + */ |
|
| 75 | + protected $useTransaction; |
|
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * Number of entries scanned to commit |
|
| 79 | - * |
|
| 80 | - * @var int |
|
| 81 | - */ |
|
| 82 | - protected $entriesToCommit; |
|
| 77 | + /** |
|
| 78 | + * Number of entries scanned to commit |
|
| 79 | + * |
|
| 80 | + * @var int |
|
| 81 | + */ |
|
| 82 | + protected $entriesToCommit; |
|
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * @param string $user |
|
| 86 | - * @param \OCP\IDBConnection $db |
|
| 87 | - * @param ILogger $logger |
|
| 88 | - */ |
|
| 89 | - public function __construct($user, $db, ILogger $logger) { |
|
| 90 | - $this->logger = $logger; |
|
| 91 | - $this->user = $user; |
|
| 92 | - $this->db = $db; |
|
| 93 | - // when DB locking is used, no DB transactions will be used |
|
| 94 | - $this->useTransaction = !(\OC::$server->getLockingProvider() instanceof DBLockingProvider); |
|
| 95 | - } |
|
| 84 | + /** |
|
| 85 | + * @param string $user |
|
| 86 | + * @param \OCP\IDBConnection $db |
|
| 87 | + * @param ILogger $logger |
|
| 88 | + */ |
|
| 89 | + public function __construct($user, $db, ILogger $logger) { |
|
| 90 | + $this->logger = $logger; |
|
| 91 | + $this->user = $user; |
|
| 92 | + $this->db = $db; |
|
| 93 | + // when DB locking is used, no DB transactions will be used |
|
| 94 | + $this->useTransaction = !(\OC::$server->getLockingProvider() instanceof DBLockingProvider); |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * get all storages for $dir |
|
| 99 | - * |
|
| 100 | - * @param string $dir |
|
| 101 | - * @return \OC\Files\Mount\MountPoint[] |
|
| 102 | - */ |
|
| 103 | - protected function getMounts($dir) { |
|
| 104 | - //TODO: move to the node based fileapi once that's done |
|
| 105 | - \OC_Util::tearDownFS(); |
|
| 106 | - \OC_Util::setupFS($this->user); |
|
| 97 | + /** |
|
| 98 | + * get all storages for $dir |
|
| 99 | + * |
|
| 100 | + * @param string $dir |
|
| 101 | + * @return \OC\Files\Mount\MountPoint[] |
|
| 102 | + */ |
|
| 103 | + protected function getMounts($dir) { |
|
| 104 | + //TODO: move to the node based fileapi once that's done |
|
| 105 | + \OC_Util::tearDownFS(); |
|
| 106 | + \OC_Util::setupFS($this->user); |
|
| 107 | 107 | |
| 108 | - $mountManager = Filesystem::getMountManager(); |
|
| 109 | - $mounts = $mountManager->findIn($dir); |
|
| 110 | - $mounts[] = $mountManager->find($dir); |
|
| 111 | - $mounts = array_reverse($mounts); //start with the mount of $dir |
|
| 108 | + $mountManager = Filesystem::getMountManager(); |
|
| 109 | + $mounts = $mountManager->findIn($dir); |
|
| 110 | + $mounts[] = $mountManager->find($dir); |
|
| 111 | + $mounts = array_reverse($mounts); //start with the mount of $dir |
|
| 112 | 112 | |
| 113 | - return $mounts; |
|
| 114 | - } |
|
| 113 | + return $mounts; |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | - /** |
|
| 117 | - * attach listeners to the scanner |
|
| 118 | - * |
|
| 119 | - * @param \OC\Files\Mount\MountPoint $mount |
|
| 120 | - */ |
|
| 121 | - protected function attachListener($mount) { |
|
| 122 | - $scanner = $mount->getStorage()->getScanner(); |
|
| 123 | - $emitter = $this; |
|
| 124 | - $scanner->listen('\OC\Files\Cache\Scanner', 'scanFile', function ($path) use ($mount, $emitter) { |
|
| 125 | - $emitter->emit('\OC\Files\Utils\Scanner', 'scanFile', array($mount->getMountPoint() . $path)); |
|
| 126 | - }); |
|
| 127 | - $scanner->listen('\OC\Files\Cache\Scanner', 'scanFolder', function ($path) use ($mount, $emitter) { |
|
| 128 | - $emitter->emit('\OC\Files\Utils\Scanner', 'scanFolder', array($mount->getMountPoint() . $path)); |
|
| 129 | - }); |
|
| 130 | - $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFile', function ($path) use ($mount, $emitter) { |
|
| 131 | - $emitter->emit('\OC\Files\Utils\Scanner', 'postScanFile', array($mount->getMountPoint() . $path)); |
|
| 132 | - }); |
|
| 133 | - $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFolder', function ($path) use ($mount, $emitter) { |
|
| 134 | - $emitter->emit('\OC\Files\Utils\Scanner', 'postScanFolder', array($mount->getMountPoint() . $path)); |
|
| 135 | - }); |
|
| 136 | - } |
|
| 116 | + /** |
|
| 117 | + * attach listeners to the scanner |
|
| 118 | + * |
|
| 119 | + * @param \OC\Files\Mount\MountPoint $mount |
|
| 120 | + */ |
|
| 121 | + protected function attachListener($mount) { |
|
| 122 | + $scanner = $mount->getStorage()->getScanner(); |
|
| 123 | + $emitter = $this; |
|
| 124 | + $scanner->listen('\OC\Files\Cache\Scanner', 'scanFile', function ($path) use ($mount, $emitter) { |
|
| 125 | + $emitter->emit('\OC\Files\Utils\Scanner', 'scanFile', array($mount->getMountPoint() . $path)); |
|
| 126 | + }); |
|
| 127 | + $scanner->listen('\OC\Files\Cache\Scanner', 'scanFolder', function ($path) use ($mount, $emitter) { |
|
| 128 | + $emitter->emit('\OC\Files\Utils\Scanner', 'scanFolder', array($mount->getMountPoint() . $path)); |
|
| 129 | + }); |
|
| 130 | + $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFile', function ($path) use ($mount, $emitter) { |
|
| 131 | + $emitter->emit('\OC\Files\Utils\Scanner', 'postScanFile', array($mount->getMountPoint() . $path)); |
|
| 132 | + }); |
|
| 133 | + $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFolder', function ($path) use ($mount, $emitter) { |
|
| 134 | + $emitter->emit('\OC\Files\Utils\Scanner', 'postScanFolder', array($mount->getMountPoint() . $path)); |
|
| 135 | + }); |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | - /** |
|
| 139 | - * @param string $dir |
|
| 140 | - */ |
|
| 141 | - public function backgroundScan($dir) { |
|
| 142 | - $mounts = $this->getMounts($dir); |
|
| 143 | - foreach ($mounts as $mount) { |
|
| 144 | - $storage = $mount->getStorage(); |
|
| 145 | - if (is_null($storage)) { |
|
| 146 | - continue; |
|
| 147 | - } |
|
| 138 | + /** |
|
| 139 | + * @param string $dir |
|
| 140 | + */ |
|
| 141 | + public function backgroundScan($dir) { |
|
| 142 | + $mounts = $this->getMounts($dir); |
|
| 143 | + foreach ($mounts as $mount) { |
|
| 144 | + $storage = $mount->getStorage(); |
|
| 145 | + if (is_null($storage)) { |
|
| 146 | + continue; |
|
| 147 | + } |
|
| 148 | 148 | |
| 149 | - // don't bother scanning failed storages (shortcut for same result) |
|
| 150 | - if ($storage->instanceOfStorage(FailedStorage::class)) { |
|
| 151 | - continue; |
|
| 152 | - } |
|
| 149 | + // don't bother scanning failed storages (shortcut for same result) |
|
| 150 | + if ($storage->instanceOfStorage(FailedStorage::class)) { |
|
| 151 | + continue; |
|
| 152 | + } |
|
| 153 | 153 | |
| 154 | - // don't scan the root storage |
|
| 155 | - if ($storage->instanceOfStorage('\OC\Files\Storage\Local') && $mount->getMountPoint() === '/') { |
|
| 156 | - continue; |
|
| 157 | - } |
|
| 154 | + // don't scan the root storage |
|
| 155 | + if ($storage->instanceOfStorage('\OC\Files\Storage\Local') && $mount->getMountPoint() === '/') { |
|
| 156 | + continue; |
|
| 157 | + } |
|
| 158 | 158 | |
| 159 | - // don't scan received local shares, these can be scanned when scanning the owner's storage |
|
| 160 | - if ($storage->instanceOfStorage(SharedStorage::class)) { |
|
| 161 | - continue; |
|
| 162 | - } |
|
| 163 | - $scanner = $storage->getScanner(); |
|
| 164 | - $this->attachListener($mount); |
|
| 159 | + // don't scan received local shares, these can be scanned when scanning the owner's storage |
|
| 160 | + if ($storage->instanceOfStorage(SharedStorage::class)) { |
|
| 161 | + continue; |
|
| 162 | + } |
|
| 163 | + $scanner = $storage->getScanner(); |
|
| 164 | + $this->attachListener($mount); |
|
| 165 | 165 | |
| 166 | - $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', function ($path) use ($storage) { |
|
| 167 | - $this->triggerPropagator($storage, $path); |
|
| 168 | - }); |
|
| 169 | - $scanner->listen('\OC\Files\Cache\Scanner', 'updateCache', function ($path) use ($storage) { |
|
| 170 | - $this->triggerPropagator($storage, $path); |
|
| 171 | - }); |
|
| 172 | - $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function ($path) use ($storage) { |
|
| 173 | - $this->triggerPropagator($storage, $path); |
|
| 174 | - }); |
|
| 166 | + $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', function ($path) use ($storage) { |
|
| 167 | + $this->triggerPropagator($storage, $path); |
|
| 168 | + }); |
|
| 169 | + $scanner->listen('\OC\Files\Cache\Scanner', 'updateCache', function ($path) use ($storage) { |
|
| 170 | + $this->triggerPropagator($storage, $path); |
|
| 171 | + }); |
|
| 172 | + $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function ($path) use ($storage) { |
|
| 173 | + $this->triggerPropagator($storage, $path); |
|
| 174 | + }); |
|
| 175 | 175 | |
| 176 | - $propagator = $storage->getPropagator(); |
|
| 177 | - $propagator->beginBatch(); |
|
| 178 | - $scanner->backgroundScan(); |
|
| 179 | - $propagator->commitBatch(); |
|
| 180 | - } |
|
| 181 | - } |
|
| 176 | + $propagator = $storage->getPropagator(); |
|
| 177 | + $propagator->beginBatch(); |
|
| 178 | + $scanner->backgroundScan(); |
|
| 179 | + $propagator->commitBatch(); |
|
| 180 | + } |
|
| 181 | + } |
|
| 182 | 182 | |
| 183 | - /** |
|
| 184 | - * @param string $dir |
|
| 185 | - * @throws \OC\ForbiddenException |
|
| 186 | - * @throws \OCP\Files\NotFoundException |
|
| 187 | - */ |
|
| 188 | - public function scan($dir = '', $recursive = \OC\Files\Cache\Scanner::SCAN_RECURSIVE) { |
|
| 189 | - if (!Filesystem::isValidPath($dir)) { |
|
| 190 | - throw new \InvalidArgumentException('Invalid path to scan'); |
|
| 191 | - } |
|
| 192 | - $mounts = $this->getMounts($dir); |
|
| 193 | - foreach ($mounts as $mount) { |
|
| 194 | - $storage = $mount->getStorage(); |
|
| 195 | - if (is_null($storage)) { |
|
| 196 | - continue; |
|
| 197 | - } |
|
| 183 | + /** |
|
| 184 | + * @param string $dir |
|
| 185 | + * @throws \OC\ForbiddenException |
|
| 186 | + * @throws \OCP\Files\NotFoundException |
|
| 187 | + */ |
|
| 188 | + public function scan($dir = '', $recursive = \OC\Files\Cache\Scanner::SCAN_RECURSIVE) { |
|
| 189 | + if (!Filesystem::isValidPath($dir)) { |
|
| 190 | + throw new \InvalidArgumentException('Invalid path to scan'); |
|
| 191 | + } |
|
| 192 | + $mounts = $this->getMounts($dir); |
|
| 193 | + foreach ($mounts as $mount) { |
|
| 194 | + $storage = $mount->getStorage(); |
|
| 195 | + if (is_null($storage)) { |
|
| 196 | + continue; |
|
| 197 | + } |
|
| 198 | 198 | |
| 199 | - // don't bother scanning failed storages (shortcut for same result) |
|
| 200 | - if ($storage->instanceOfStorage(FailedStorage::class)) { |
|
| 201 | - continue; |
|
| 202 | - } |
|
| 199 | + // don't bother scanning failed storages (shortcut for same result) |
|
| 200 | + if ($storage->instanceOfStorage(FailedStorage::class)) { |
|
| 201 | + continue; |
|
| 202 | + } |
|
| 203 | 203 | |
| 204 | - // if the home storage isn't writable then the scanner is run as the wrong user |
|
| 205 | - if ($storage->instanceOfStorage('\OC\Files\Storage\Home') and |
|
| 206 | - (!$storage->isCreatable('') or !$storage->isCreatable('files')) |
|
| 207 | - ) { |
|
| 208 | - if ($storage->file_exists('') or $storage->getCache()->inCache('')) { |
|
| 209 | - throw new ForbiddenException(); |
|
| 210 | - } else {// if the root exists in neither the cache nor the storage the user isn't setup yet |
|
| 211 | - break; |
|
| 212 | - } |
|
| 204 | + // if the home storage isn't writable then the scanner is run as the wrong user |
|
| 205 | + if ($storage->instanceOfStorage('\OC\Files\Storage\Home') and |
|
| 206 | + (!$storage->isCreatable('') or !$storage->isCreatable('files')) |
|
| 207 | + ) { |
|
| 208 | + if ($storage->file_exists('') or $storage->getCache()->inCache('')) { |
|
| 209 | + throw new ForbiddenException(); |
|
| 210 | + } else {// if the root exists in neither the cache nor the storage the user isn't setup yet |
|
| 211 | + break; |
|
| 212 | + } |
|
| 213 | 213 | |
| 214 | - } |
|
| 214 | + } |
|
| 215 | 215 | |
| 216 | - // don't scan received local shares, these can be scanned when scanning the owner's storage |
|
| 217 | - if ($storage->instanceOfStorage(SharedStorage::class)) { |
|
| 218 | - continue; |
|
| 219 | - } |
|
| 220 | - $relativePath = $mount->getInternalPath($dir); |
|
| 221 | - $scanner = $storage->getScanner(); |
|
| 222 | - $scanner->setUseTransactions(false); |
|
| 223 | - $this->attachListener($mount); |
|
| 216 | + // don't scan received local shares, these can be scanned when scanning the owner's storage |
|
| 217 | + if ($storage->instanceOfStorage(SharedStorage::class)) { |
|
| 218 | + continue; |
|
| 219 | + } |
|
| 220 | + $relativePath = $mount->getInternalPath($dir); |
|
| 221 | + $scanner = $storage->getScanner(); |
|
| 222 | + $scanner->setUseTransactions(false); |
|
| 223 | + $this->attachListener($mount); |
|
| 224 | 224 | |
| 225 | - $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', function ($path) use ($storage) { |
|
| 226 | - $this->postProcessEntry($storage, $path); |
|
| 227 | - }); |
|
| 228 | - $scanner->listen('\OC\Files\Cache\Scanner', 'updateCache', function ($path) use ($storage) { |
|
| 229 | - $this->postProcessEntry($storage, $path); |
|
| 230 | - }); |
|
| 231 | - $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function ($path) use ($storage) { |
|
| 232 | - $this->postProcessEntry($storage, $path); |
|
| 233 | - }); |
|
| 225 | + $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', function ($path) use ($storage) { |
|
| 226 | + $this->postProcessEntry($storage, $path); |
|
| 227 | + }); |
|
| 228 | + $scanner->listen('\OC\Files\Cache\Scanner', 'updateCache', function ($path) use ($storage) { |
|
| 229 | + $this->postProcessEntry($storage, $path); |
|
| 230 | + }); |
|
| 231 | + $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function ($path) use ($storage) { |
|
| 232 | + $this->postProcessEntry($storage, $path); |
|
| 233 | + }); |
|
| 234 | 234 | |
| 235 | - if (!$storage->file_exists($relativePath)) { |
|
| 236 | - throw new NotFoundException($dir); |
|
| 237 | - } |
|
| 235 | + if (!$storage->file_exists($relativePath)) { |
|
| 236 | + throw new NotFoundException($dir); |
|
| 237 | + } |
|
| 238 | 238 | |
| 239 | - if ($this->useTransaction) { |
|
| 240 | - $this->db->beginTransaction(); |
|
| 241 | - } |
|
| 242 | - try { |
|
| 243 | - $propagator = $storage->getPropagator(); |
|
| 244 | - $propagator->beginBatch(); |
|
| 245 | - $scanner->scan($relativePath, $recursive, \OC\Files\Cache\Scanner::REUSE_ETAG | \OC\Files\Cache\Scanner::REUSE_SIZE); |
|
| 246 | - $cache = $storage->getCache(); |
|
| 247 | - if ($cache instanceof Cache) { |
|
| 248 | - // only re-calculate for the root folder we scanned, anything below that is taken care of by the scanner |
|
| 249 | - $cache->correctFolderSize($relativePath); |
|
| 250 | - } |
|
| 251 | - $propagator->commitBatch(); |
|
| 252 | - } catch (StorageNotAvailableException $e) { |
|
| 253 | - $this->logger->error('Storage ' . $storage->getId() . ' not available'); |
|
| 254 | - $this->logger->logException($e); |
|
| 255 | - $this->emit('\OC\Files\Utils\Scanner', 'StorageNotAvailable', [$e]); |
|
| 256 | - } |
|
| 257 | - if ($this->useTransaction) { |
|
| 258 | - $this->db->commit(); |
|
| 259 | - } |
|
| 260 | - } |
|
| 261 | - } |
|
| 239 | + if ($this->useTransaction) { |
|
| 240 | + $this->db->beginTransaction(); |
|
| 241 | + } |
|
| 242 | + try { |
|
| 243 | + $propagator = $storage->getPropagator(); |
|
| 244 | + $propagator->beginBatch(); |
|
| 245 | + $scanner->scan($relativePath, $recursive, \OC\Files\Cache\Scanner::REUSE_ETAG | \OC\Files\Cache\Scanner::REUSE_SIZE); |
|
| 246 | + $cache = $storage->getCache(); |
|
| 247 | + if ($cache instanceof Cache) { |
|
| 248 | + // only re-calculate for the root folder we scanned, anything below that is taken care of by the scanner |
|
| 249 | + $cache->correctFolderSize($relativePath); |
|
| 250 | + } |
|
| 251 | + $propagator->commitBatch(); |
|
| 252 | + } catch (StorageNotAvailableException $e) { |
|
| 253 | + $this->logger->error('Storage ' . $storage->getId() . ' not available'); |
|
| 254 | + $this->logger->logException($e); |
|
| 255 | + $this->emit('\OC\Files\Utils\Scanner', 'StorageNotAvailable', [$e]); |
|
| 256 | + } |
|
| 257 | + if ($this->useTransaction) { |
|
| 258 | + $this->db->commit(); |
|
| 259 | + } |
|
| 260 | + } |
|
| 261 | + } |
|
| 262 | 262 | |
| 263 | - private function triggerPropagator(IStorage $storage, $internalPath) { |
|
| 264 | - $storage->getPropagator()->propagateChange($internalPath, time()); |
|
| 265 | - } |
|
| 263 | + private function triggerPropagator(IStorage $storage, $internalPath) { |
|
| 264 | + $storage->getPropagator()->propagateChange($internalPath, time()); |
|
| 265 | + } |
|
| 266 | 266 | |
| 267 | - private function postProcessEntry(IStorage $storage, $internalPath) { |
|
| 268 | - $this->triggerPropagator($storage, $internalPath); |
|
| 269 | - if ($this->useTransaction) { |
|
| 270 | - $this->entriesToCommit++; |
|
| 271 | - if ($this->entriesToCommit >= self::MAX_ENTRIES_TO_COMMIT) { |
|
| 272 | - $propagator = $storage->getPropagator(); |
|
| 273 | - $this->entriesToCommit = 0; |
|
| 274 | - $this->db->commit(); |
|
| 275 | - $propagator->commitBatch(); |
|
| 276 | - $this->db->beginTransaction(); |
|
| 277 | - $propagator->beginBatch(); |
|
| 278 | - } |
|
| 279 | - } |
|
| 280 | - } |
|
| 267 | + private function postProcessEntry(IStorage $storage, $internalPath) { |
|
| 268 | + $this->triggerPropagator($storage, $internalPath); |
|
| 269 | + if ($this->useTransaction) { |
|
| 270 | + $this->entriesToCommit++; |
|
| 271 | + if ($this->entriesToCommit >= self::MAX_ENTRIES_TO_COMMIT) { |
|
| 272 | + $propagator = $storage->getPropagator(); |
|
| 273 | + $this->entriesToCommit = 0; |
|
| 274 | + $this->db->commit(); |
|
| 275 | + $propagator->commitBatch(); |
|
| 276 | + $this->db->beginTransaction(); |
|
| 277 | + $propagator->beginBatch(); |
|
| 278 | + } |
|
| 279 | + } |
|
| 280 | + } |
|
| 281 | 281 | } |
| 282 | 282 | |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | use OC\Files\Mount\MountPoint; |
| 25 | 25 | |
| 26 | 26 | class ExternalMountPoint extends MountPoint { |
| 27 | - public function getMountType() { |
|
| 28 | - return 'external'; |
|
| 29 | - } |
|
| 27 | + public function getMountType() { |
|
| 28 | + return 'external'; |
|
| 29 | + } |
|
| 30 | 30 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | if (isset($info['transferid'])) { |
| 91 | 91 | // getNodePath is called for multiple nodes within a chunk |
| 92 | 92 | // upload call |
| 93 | - $path = $dir . '/' . $info['name']; |
|
| 93 | + $path = $dir.'/'.$info['name']; |
|
| 94 | 94 | $path = ltrim($path, '/'); |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | } catch (StorageNotAvailableException $e) { |
| 162 | 162 | throw new \Sabre\DAV\Exception\ServiceUnavailable('Storage is temporarily not available'); |
| 163 | 163 | } catch (StorageInvalidException $e) { |
| 164 | - throw new \Sabre\DAV\Exception\NotFound('Storage ' . $path . ' is invalid'); |
|
| 164 | + throw new \Sabre\DAV\Exception\NotFound('Storage '.$path.' is invalid'); |
|
| 165 | 165 | } catch (LockedException $e) { |
| 166 | 166 | throw new \Sabre\DAV\Exception\Locked(); |
| 167 | 167 | } catch (ForbiddenException $e) { |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | if (!$info) { |
| 173 | - throw new \Sabre\DAV\Exception\NotFound('File with name ' . $path . ' could not be located'); |
|
| 173 | + throw new \Sabre\DAV\Exception\NotFound('File with name '.$path.' could not be located'); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | if ($info->getType() === 'dir') { |
@@ -42,204 +42,204 @@ |
||
| 42 | 42 | |
| 43 | 43 | class ObjectTree extends CachingTree { |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @var \OC\Files\View |
|
| 47 | - */ |
|
| 48 | - protected $fileView; |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * @var \OCP\Files\Mount\IMountManager |
|
| 52 | - */ |
|
| 53 | - protected $mountManager; |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * Creates the object |
|
| 57 | - */ |
|
| 58 | - public function __construct() { |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * @param \Sabre\DAV\INode $rootNode |
|
| 63 | - * @param \OC\Files\View $view |
|
| 64 | - * @param \OCP\Files\Mount\IMountManager $mountManager |
|
| 65 | - */ |
|
| 66 | - public function init(\Sabre\DAV\INode $rootNode, \OC\Files\View $view, \OCP\Files\Mount\IMountManager $mountManager) { |
|
| 67 | - $this->rootNode = $rootNode; |
|
| 68 | - $this->fileView = $view; |
|
| 69 | - $this->mountManager = $mountManager; |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - /** |
|
| 73 | - * If the given path is a chunked file name, converts it |
|
| 74 | - * to the real file name. Only applies if the OC-CHUNKED header |
|
| 75 | - * is present. |
|
| 76 | - * |
|
| 77 | - * @param string $path chunk file path to convert |
|
| 78 | - * |
|
| 79 | - * @return string path to real file |
|
| 80 | - */ |
|
| 81 | - private function resolveChunkFile($path) { |
|
| 82 | - if (isset($_SERVER['HTTP_OC_CHUNKED'])) { |
|
| 83 | - // resolve to real file name to find the proper node |
|
| 84 | - list($dir, $name) = \Sabre\Uri\split($path); |
|
| 85 | - if ($dir === '/' || $dir === '.') { |
|
| 86 | - $dir = ''; |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - $info = \OC_FileChunking::decodeName($name); |
|
| 90 | - // only replace path if it was really the chunked file |
|
| 91 | - if (isset($info['transferid'])) { |
|
| 92 | - // getNodePath is called for multiple nodes within a chunk |
|
| 93 | - // upload call |
|
| 94 | - $path = $dir . '/' . $info['name']; |
|
| 95 | - $path = ltrim($path, '/'); |
|
| 96 | - } |
|
| 97 | - } |
|
| 98 | - return $path; |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - /** |
|
| 102 | - * Returns the INode object for the requested path |
|
| 103 | - * |
|
| 104 | - * @param string $path |
|
| 105 | - * @return \Sabre\DAV\INode |
|
| 106 | - * @throws InvalidPath |
|
| 107 | - * @throws \Sabre\DAV\Exception\Locked |
|
| 108 | - * @throws \Sabre\DAV\Exception\NotFound |
|
| 109 | - * @throws \Sabre\DAV\Exception\ServiceUnavailable |
|
| 110 | - */ |
|
| 111 | - public function getNodeForPath($path) { |
|
| 112 | - if (!$this->fileView) { |
|
| 113 | - throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup'); |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - $path = trim($path, '/'); |
|
| 117 | - |
|
| 118 | - if (isset($this->cache[$path])) { |
|
| 119 | - return $this->cache[$path]; |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - if ($path) { |
|
| 123 | - try { |
|
| 124 | - $this->fileView->verifyPath($path, basename($path)); |
|
| 125 | - } catch (\OCP\Files\InvalidPathException $ex) { |
|
| 126 | - throw new InvalidPath($ex->getMessage()); |
|
| 127 | - } |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - // Is it the root node? |
|
| 131 | - if (!strlen($path)) { |
|
| 132 | - return $this->rootNode; |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - if (pathinfo($path, PATHINFO_EXTENSION) === 'part') { |
|
| 136 | - // read from storage |
|
| 137 | - $absPath = $this->fileView->getAbsolutePath($path); |
|
| 138 | - $mount = $this->fileView->getMount($path); |
|
| 139 | - $storage = $mount->getStorage(); |
|
| 140 | - $internalPath = $mount->getInternalPath($absPath); |
|
| 141 | - if ($storage && $storage->file_exists($internalPath)) { |
|
| 142 | - /** |
|
| 143 | - * @var \OC\Files\Storage\Storage $storage |
|
| 144 | - */ |
|
| 145 | - // get data directly |
|
| 146 | - $data = $storage->getMetaData($internalPath); |
|
| 147 | - $info = new FileInfo($absPath, $storage, $internalPath, $data, $mount); |
|
| 148 | - } else { |
|
| 149 | - $info = null; |
|
| 150 | - } |
|
| 151 | - } else { |
|
| 152 | - // resolve chunk file name to real name, if applicable |
|
| 153 | - $path = $this->resolveChunkFile($path); |
|
| 154 | - |
|
| 155 | - // read from cache |
|
| 156 | - try { |
|
| 157 | - $info = $this->fileView->getFileInfo($path); |
|
| 158 | - |
|
| 159 | - if ($info instanceof \OCP\Files\FileInfo && $info->getStorage()->instanceOfStorage(FailedStorage::class)) { |
|
| 160 | - throw new StorageNotAvailableException(); |
|
| 161 | - } |
|
| 162 | - } catch (StorageNotAvailableException $e) { |
|
| 163 | - throw new \Sabre\DAV\Exception\ServiceUnavailable('Storage is temporarily not available'); |
|
| 164 | - } catch (StorageInvalidException $e) { |
|
| 165 | - throw new \Sabre\DAV\Exception\NotFound('Storage ' . $path . ' is invalid'); |
|
| 166 | - } catch (LockedException $e) { |
|
| 167 | - throw new \Sabre\DAV\Exception\Locked(); |
|
| 168 | - } catch (ForbiddenException $e) { |
|
| 169 | - throw new \Sabre\DAV\Exception\Forbidden(); |
|
| 170 | - } |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - if (!$info) { |
|
| 174 | - throw new \Sabre\DAV\Exception\NotFound('File with name ' . $path . ' could not be located'); |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - if ($info->getType() === 'dir') { |
|
| 178 | - $node = new \OCA\DAV\Connector\Sabre\Directory($this->fileView, $info, $this); |
|
| 179 | - } else { |
|
| 180 | - $node = new \OCA\DAV\Connector\Sabre\File($this->fileView, $info); |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - $this->cache[$path] = $node; |
|
| 184 | - return $node; |
|
| 185 | - |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - /** |
|
| 189 | - * Copies a file or directory. |
|
| 190 | - * |
|
| 191 | - * This method must work recursively and delete the destination |
|
| 192 | - * if it exists |
|
| 193 | - * |
|
| 194 | - * @param string $source |
|
| 195 | - * @param string $destination |
|
| 196 | - * @throws FileLocked |
|
| 197 | - * @throws Forbidden |
|
| 198 | - * @throws InvalidPath |
|
| 199 | - * @throws \Exception |
|
| 200 | - * @throws \Sabre\DAV\Exception\Forbidden |
|
| 201 | - * @throws \Sabre\DAV\Exception\Locked |
|
| 202 | - * @throws \Sabre\DAV\Exception\NotFound |
|
| 203 | - * @throws \Sabre\DAV\Exception\ServiceUnavailable |
|
| 204 | - * @return void |
|
| 205 | - */ |
|
| 206 | - public function copy($source, $destination) { |
|
| 207 | - if (!$this->fileView) { |
|
| 208 | - throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup'); |
|
| 209 | - } |
|
| 210 | - |
|
| 211 | - |
|
| 212 | - $info = $this->fileView->getFileInfo(dirname($destination)); |
|
| 213 | - if ($this->fileView->file_exists($destination)) { |
|
| 214 | - $destinationPermission = $info && $info->isUpdateable(); |
|
| 215 | - } else { |
|
| 216 | - $destinationPermission = $info && $info->isCreatable(); |
|
| 217 | - } |
|
| 218 | - if (!$destinationPermission) { |
|
| 219 | - throw new Forbidden('No permissions to copy object.'); |
|
| 220 | - } |
|
| 221 | - |
|
| 222 | - // this will trigger existence check |
|
| 223 | - $this->getNodeForPath($source); |
|
| 224 | - |
|
| 225 | - list($destinationDir, $destinationName) = \Sabre\Uri\split($destination); |
|
| 226 | - try { |
|
| 227 | - $this->fileView->verifyPath($destinationDir, $destinationName); |
|
| 228 | - } catch (\OCP\Files\InvalidPathException $ex) { |
|
| 229 | - throw new InvalidPath($ex->getMessage()); |
|
| 230 | - } |
|
| 231 | - |
|
| 232 | - try { |
|
| 233 | - $this->fileView->copy($source, $destination); |
|
| 234 | - } catch (StorageNotAvailableException $e) { |
|
| 235 | - throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage()); |
|
| 236 | - } catch (ForbiddenException $ex) { |
|
| 237 | - throw new Forbidden($ex->getMessage(), $ex->getRetry()); |
|
| 238 | - } catch (LockedException $e) { |
|
| 239 | - throw new FileLocked($e->getMessage(), $e->getCode(), $e); |
|
| 240 | - } |
|
| 241 | - |
|
| 242 | - list($destinationDir,) = \Sabre\Uri\split($destination); |
|
| 243 | - $this->markDirty($destinationDir); |
|
| 244 | - } |
|
| 45 | + /** |
|
| 46 | + * @var \OC\Files\View |
|
| 47 | + */ |
|
| 48 | + protected $fileView; |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * @var \OCP\Files\Mount\IMountManager |
|
| 52 | + */ |
|
| 53 | + protected $mountManager; |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * Creates the object |
|
| 57 | + */ |
|
| 58 | + public function __construct() { |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * @param \Sabre\DAV\INode $rootNode |
|
| 63 | + * @param \OC\Files\View $view |
|
| 64 | + * @param \OCP\Files\Mount\IMountManager $mountManager |
|
| 65 | + */ |
|
| 66 | + public function init(\Sabre\DAV\INode $rootNode, \OC\Files\View $view, \OCP\Files\Mount\IMountManager $mountManager) { |
|
| 67 | + $this->rootNode = $rootNode; |
|
| 68 | + $this->fileView = $view; |
|
| 69 | + $this->mountManager = $mountManager; |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + /** |
|
| 73 | + * If the given path is a chunked file name, converts it |
|
| 74 | + * to the real file name. Only applies if the OC-CHUNKED header |
|
| 75 | + * is present. |
|
| 76 | + * |
|
| 77 | + * @param string $path chunk file path to convert |
|
| 78 | + * |
|
| 79 | + * @return string path to real file |
|
| 80 | + */ |
|
| 81 | + private function resolveChunkFile($path) { |
|
| 82 | + if (isset($_SERVER['HTTP_OC_CHUNKED'])) { |
|
| 83 | + // resolve to real file name to find the proper node |
|
| 84 | + list($dir, $name) = \Sabre\Uri\split($path); |
|
| 85 | + if ($dir === '/' || $dir === '.') { |
|
| 86 | + $dir = ''; |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + $info = \OC_FileChunking::decodeName($name); |
|
| 90 | + // only replace path if it was really the chunked file |
|
| 91 | + if (isset($info['transferid'])) { |
|
| 92 | + // getNodePath is called for multiple nodes within a chunk |
|
| 93 | + // upload call |
|
| 94 | + $path = $dir . '/' . $info['name']; |
|
| 95 | + $path = ltrim($path, '/'); |
|
| 96 | + } |
|
| 97 | + } |
|
| 98 | + return $path; |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + /** |
|
| 102 | + * Returns the INode object for the requested path |
|
| 103 | + * |
|
| 104 | + * @param string $path |
|
| 105 | + * @return \Sabre\DAV\INode |
|
| 106 | + * @throws InvalidPath |
|
| 107 | + * @throws \Sabre\DAV\Exception\Locked |
|
| 108 | + * @throws \Sabre\DAV\Exception\NotFound |
|
| 109 | + * @throws \Sabre\DAV\Exception\ServiceUnavailable |
|
| 110 | + */ |
|
| 111 | + public function getNodeForPath($path) { |
|
| 112 | + if (!$this->fileView) { |
|
| 113 | + throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup'); |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + $path = trim($path, '/'); |
|
| 117 | + |
|
| 118 | + if (isset($this->cache[$path])) { |
|
| 119 | + return $this->cache[$path]; |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + if ($path) { |
|
| 123 | + try { |
|
| 124 | + $this->fileView->verifyPath($path, basename($path)); |
|
| 125 | + } catch (\OCP\Files\InvalidPathException $ex) { |
|
| 126 | + throw new InvalidPath($ex->getMessage()); |
|
| 127 | + } |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + // Is it the root node? |
|
| 131 | + if (!strlen($path)) { |
|
| 132 | + return $this->rootNode; |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + if (pathinfo($path, PATHINFO_EXTENSION) === 'part') { |
|
| 136 | + // read from storage |
|
| 137 | + $absPath = $this->fileView->getAbsolutePath($path); |
|
| 138 | + $mount = $this->fileView->getMount($path); |
|
| 139 | + $storage = $mount->getStorage(); |
|
| 140 | + $internalPath = $mount->getInternalPath($absPath); |
|
| 141 | + if ($storage && $storage->file_exists($internalPath)) { |
|
| 142 | + /** |
|
| 143 | + * @var \OC\Files\Storage\Storage $storage |
|
| 144 | + */ |
|
| 145 | + // get data directly |
|
| 146 | + $data = $storage->getMetaData($internalPath); |
|
| 147 | + $info = new FileInfo($absPath, $storage, $internalPath, $data, $mount); |
|
| 148 | + } else { |
|
| 149 | + $info = null; |
|
| 150 | + } |
|
| 151 | + } else { |
|
| 152 | + // resolve chunk file name to real name, if applicable |
|
| 153 | + $path = $this->resolveChunkFile($path); |
|
| 154 | + |
|
| 155 | + // read from cache |
|
| 156 | + try { |
|
| 157 | + $info = $this->fileView->getFileInfo($path); |
|
| 158 | + |
|
| 159 | + if ($info instanceof \OCP\Files\FileInfo && $info->getStorage()->instanceOfStorage(FailedStorage::class)) { |
|
| 160 | + throw new StorageNotAvailableException(); |
|
| 161 | + } |
|
| 162 | + } catch (StorageNotAvailableException $e) { |
|
| 163 | + throw new \Sabre\DAV\Exception\ServiceUnavailable('Storage is temporarily not available'); |
|
| 164 | + } catch (StorageInvalidException $e) { |
|
| 165 | + throw new \Sabre\DAV\Exception\NotFound('Storage ' . $path . ' is invalid'); |
|
| 166 | + } catch (LockedException $e) { |
|
| 167 | + throw new \Sabre\DAV\Exception\Locked(); |
|
| 168 | + } catch (ForbiddenException $e) { |
|
| 169 | + throw new \Sabre\DAV\Exception\Forbidden(); |
|
| 170 | + } |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + if (!$info) { |
|
| 174 | + throw new \Sabre\DAV\Exception\NotFound('File with name ' . $path . ' could not be located'); |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + if ($info->getType() === 'dir') { |
|
| 178 | + $node = new \OCA\DAV\Connector\Sabre\Directory($this->fileView, $info, $this); |
|
| 179 | + } else { |
|
| 180 | + $node = new \OCA\DAV\Connector\Sabre\File($this->fileView, $info); |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + $this->cache[$path] = $node; |
|
| 184 | + return $node; |
|
| 185 | + |
|
| 186 | + } |
|
| 187 | + |
|
| 188 | + /** |
|
| 189 | + * Copies a file or directory. |
|
| 190 | + * |
|
| 191 | + * This method must work recursively and delete the destination |
|
| 192 | + * if it exists |
|
| 193 | + * |
|
| 194 | + * @param string $source |
|
| 195 | + * @param string $destination |
|
| 196 | + * @throws FileLocked |
|
| 197 | + * @throws Forbidden |
|
| 198 | + * @throws InvalidPath |
|
| 199 | + * @throws \Exception |
|
| 200 | + * @throws \Sabre\DAV\Exception\Forbidden |
|
| 201 | + * @throws \Sabre\DAV\Exception\Locked |
|
| 202 | + * @throws \Sabre\DAV\Exception\NotFound |
|
| 203 | + * @throws \Sabre\DAV\Exception\ServiceUnavailable |
|
| 204 | + * @return void |
|
| 205 | + */ |
|
| 206 | + public function copy($source, $destination) { |
|
| 207 | + if (!$this->fileView) { |
|
| 208 | + throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup'); |
|
| 209 | + } |
|
| 210 | + |
|
| 211 | + |
|
| 212 | + $info = $this->fileView->getFileInfo(dirname($destination)); |
|
| 213 | + if ($this->fileView->file_exists($destination)) { |
|
| 214 | + $destinationPermission = $info && $info->isUpdateable(); |
|
| 215 | + } else { |
|
| 216 | + $destinationPermission = $info && $info->isCreatable(); |
|
| 217 | + } |
|
| 218 | + if (!$destinationPermission) { |
|
| 219 | + throw new Forbidden('No permissions to copy object.'); |
|
| 220 | + } |
|
| 221 | + |
|
| 222 | + // this will trigger existence check |
|
| 223 | + $this->getNodeForPath($source); |
|
| 224 | + |
|
| 225 | + list($destinationDir, $destinationName) = \Sabre\Uri\split($destination); |
|
| 226 | + try { |
|
| 227 | + $this->fileView->verifyPath($destinationDir, $destinationName); |
|
| 228 | + } catch (\OCP\Files\InvalidPathException $ex) { |
|
| 229 | + throw new InvalidPath($ex->getMessage()); |
|
| 230 | + } |
|
| 231 | + |
|
| 232 | + try { |
|
| 233 | + $this->fileView->copy($source, $destination); |
|
| 234 | + } catch (StorageNotAvailableException $e) { |
|
| 235 | + throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage()); |
|
| 236 | + } catch (ForbiddenException $ex) { |
|
| 237 | + throw new Forbidden($ex->getMessage(), $ex->getRetry()); |
|
| 238 | + } catch (LockedException $e) { |
|
| 239 | + throw new FileLocked($e->getMessage(), $e->getCode(), $e); |
|
| 240 | + } |
|
| 241 | + |
|
| 242 | + list($destinationDir,) = \Sabre\Uri\split($destination); |
|
| 243 | + $this->markDirty($destinationDir); |
|
| 244 | + } |
|
| 245 | 245 | } |
@@ -23,24 +23,24 @@ |
||
| 23 | 23 | |
| 24 | 24 | class SocialSharingBundle extends Bundle { |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * {@inheritDoc} |
|
| 28 | - */ |
|
| 29 | - public function getName() { |
|
| 30 | - return (string)$this->l10n->t('Social sharing bundle'); |
|
| 31 | - } |
|
| 26 | + /** |
|
| 27 | + * {@inheritDoc} |
|
| 28 | + */ |
|
| 29 | + public function getName() { |
|
| 30 | + return (string)$this->l10n->t('Social sharing bundle'); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * {@inheritDoc} |
|
| 35 | - */ |
|
| 36 | - public function getAppIdentifiers() { |
|
| 37 | - return [ |
|
| 38 | - 'socialsharing_twitter', |
|
| 39 | - 'socialsharing_googleplus', |
|
| 40 | - 'socialsharing_facebook', |
|
| 41 | - 'socialsharing_email', |
|
| 42 | - 'socialsharing_diaspora', |
|
| 43 | - ]; |
|
| 44 | - } |
|
| 33 | + /** |
|
| 34 | + * {@inheritDoc} |
|
| 35 | + */ |
|
| 36 | + public function getAppIdentifiers() { |
|
| 37 | + return [ |
|
| 38 | + 'socialsharing_twitter', |
|
| 39 | + 'socialsharing_googleplus', |
|
| 40 | + 'socialsharing_facebook', |
|
| 41 | + 'socialsharing_email', |
|
| 42 | + 'socialsharing_diaspora', |
|
| 43 | + ]; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | 46 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | * {@inheritDoc} |
| 28 | 28 | */ |
| 29 | 29 | public function getName() { |
| 30 | - return (string)$this->l10n->t('Social sharing bundle'); |
|
| 30 | + return (string) $this->l10n->t('Social sharing bundle'); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -29,103 +29,103 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | interface IMountPoint { |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * get complete path to the mount point |
|
| 34 | - * |
|
| 35 | - * @return string |
|
| 36 | - * @since 8.0.0 |
|
| 37 | - */ |
|
| 38 | - public function getMountPoint(); |
|
| 32 | + /** |
|
| 33 | + * get complete path to the mount point |
|
| 34 | + * |
|
| 35 | + * @return string |
|
| 36 | + * @since 8.0.0 |
|
| 37 | + */ |
|
| 38 | + public function getMountPoint(); |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * Set the mountpoint |
|
| 42 | - * |
|
| 43 | - * @param string $mountPoint new mount point |
|
| 44 | - * @since 8.0.0 |
|
| 45 | - */ |
|
| 46 | - public function setMountPoint($mountPoint); |
|
| 40 | + /** |
|
| 41 | + * Set the mountpoint |
|
| 42 | + * |
|
| 43 | + * @param string $mountPoint new mount point |
|
| 44 | + * @since 8.0.0 |
|
| 45 | + */ |
|
| 46 | + public function setMountPoint($mountPoint); |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Get the storage that is mounted |
|
| 50 | - * |
|
| 51 | - * @return \OC\Files\Storage\Storage |
|
| 52 | - * @since 8.0.0 |
|
| 53 | - */ |
|
| 54 | - public function getStorage(); |
|
| 48 | + /** |
|
| 49 | + * Get the storage that is mounted |
|
| 50 | + * |
|
| 51 | + * @return \OC\Files\Storage\Storage |
|
| 52 | + * @since 8.0.0 |
|
| 53 | + */ |
|
| 54 | + public function getStorage(); |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Get the id of the storages |
|
| 58 | - * |
|
| 59 | - * @return string |
|
| 60 | - * @since 8.0.0 |
|
| 61 | - */ |
|
| 62 | - public function getStorageId(); |
|
| 56 | + /** |
|
| 57 | + * Get the id of the storages |
|
| 58 | + * |
|
| 59 | + * @return string |
|
| 60 | + * @since 8.0.0 |
|
| 61 | + */ |
|
| 62 | + public function getStorageId(); |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Get the id of the storages |
|
| 66 | - * |
|
| 67 | - * @return int |
|
| 68 | - * @since 9.1.0 |
|
| 69 | - */ |
|
| 70 | - public function getNumericStorageId(); |
|
| 64 | + /** |
|
| 65 | + * Get the id of the storages |
|
| 66 | + * |
|
| 67 | + * @return int |
|
| 68 | + * @since 9.1.0 |
|
| 69 | + */ |
|
| 70 | + public function getNumericStorageId(); |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * Get the path relative to the mountpoint |
|
| 74 | - * |
|
| 75 | - * @param string $path absolute path to a file or folder |
|
| 76 | - * @return string |
|
| 77 | - * @since 8.0.0 |
|
| 78 | - */ |
|
| 79 | - public function getInternalPath($path); |
|
| 72 | + /** |
|
| 73 | + * Get the path relative to the mountpoint |
|
| 74 | + * |
|
| 75 | + * @param string $path absolute path to a file or folder |
|
| 76 | + * @return string |
|
| 77 | + * @since 8.0.0 |
|
| 78 | + */ |
|
| 79 | + public function getInternalPath($path); |
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Apply a storage wrapper to the mounted storage |
|
| 83 | - * |
|
| 84 | - * @param callable $wrapper |
|
| 85 | - * @since 8.0.0 |
|
| 86 | - */ |
|
| 87 | - public function wrapStorage($wrapper); |
|
| 81 | + /** |
|
| 82 | + * Apply a storage wrapper to the mounted storage |
|
| 83 | + * |
|
| 84 | + * @param callable $wrapper |
|
| 85 | + * @since 8.0.0 |
|
| 86 | + */ |
|
| 87 | + public function wrapStorage($wrapper); |
|
| 88 | 88 | |
| 89 | - /** |
|
| 90 | - * Get a mount option |
|
| 91 | - * |
|
| 92 | - * @param string $name Name of the mount option to get |
|
| 93 | - * @param mixed $default Default value for the mount option |
|
| 94 | - * @return mixed |
|
| 95 | - * @since 8.0.0 |
|
| 96 | - */ |
|
| 97 | - public function getOption($name, $default); |
|
| 89 | + /** |
|
| 90 | + * Get a mount option |
|
| 91 | + * |
|
| 92 | + * @param string $name Name of the mount option to get |
|
| 93 | + * @param mixed $default Default value for the mount option |
|
| 94 | + * @return mixed |
|
| 95 | + * @since 8.0.0 |
|
| 96 | + */ |
|
| 97 | + public function getOption($name, $default); |
|
| 98 | 98 | |
| 99 | - /** |
|
| 100 | - * Get all options for the mount |
|
| 101 | - * |
|
| 102 | - * @return array |
|
| 103 | - * @since 8.1.0 |
|
| 104 | - */ |
|
| 105 | - public function getOptions(); |
|
| 99 | + /** |
|
| 100 | + * Get all options for the mount |
|
| 101 | + * |
|
| 102 | + * @return array |
|
| 103 | + * @since 8.1.0 |
|
| 104 | + */ |
|
| 105 | + public function getOptions(); |
|
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * Get the file id of the root of the storage |
|
| 109 | - * |
|
| 110 | - * @return int |
|
| 111 | - * @since 9.1.0 |
|
| 112 | - */ |
|
| 113 | - public function getStorageRootId(); |
|
| 107 | + /** |
|
| 108 | + * Get the file id of the root of the storage |
|
| 109 | + * |
|
| 110 | + * @return int |
|
| 111 | + * @since 9.1.0 |
|
| 112 | + */ |
|
| 113 | + public function getStorageRootId(); |
|
| 114 | 114 | |
| 115 | - /** |
|
| 116 | - * Get the id of the configured mount |
|
| 117 | - * |
|
| 118 | - * @return int|null mount id or null if not applicable |
|
| 119 | - * @since 9.1.0 |
|
| 120 | - */ |
|
| 121 | - public function getMountId(); |
|
| 115 | + /** |
|
| 116 | + * Get the id of the configured mount |
|
| 117 | + * |
|
| 118 | + * @return int|null mount id or null if not applicable |
|
| 119 | + * @since 9.1.0 |
|
| 120 | + */ |
|
| 121 | + public function getMountId(); |
|
| 122 | 122 | |
| 123 | - /** |
|
| 124 | - * Get the type of mount point, used to distinguish things like shares and external storages |
|
| 125 | - * in the web interface |
|
| 126 | - * |
|
| 127 | - * @return string |
|
| 128 | - * @since 12.0.0 |
|
| 129 | - */ |
|
| 130 | - public function getMountType(); |
|
| 123 | + /** |
|
| 124 | + * Get the type of mount point, used to distinguish things like shares and external storages |
|
| 125 | + * in the web interface |
|
| 126 | + * |
|
| 127 | + * @return string |
|
| 128 | + * @since 12.0.0 |
|
| 129 | + */ |
|
| 130 | + public function getMountType(); |
|
| 131 | 131 | } |