sharedstorage.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  1. <?php
  2. /**
  3. * @author Bart Visscher <bartv@thisnet.nl>
  4. * @author Björn Schießle <schiessle@owncloud.com>
  5. * @author Joas Schilling <nickvergessen@owncloud.com>
  6. * @author Michael Gapczynski <GapczynskiM@gmail.com>
  7. * @author Morris Jobke <hey@morrisjobke.de>
  8. * @author Robin Appelman <icewind@owncloud.com>
  9. * @author Robin McCorkell <rmccorkell@karoshi.org.uk>
  10. * @author Roeland Jago Douma <roeland@famdouma.nl>
  11. * @author scambra <sergio@entrecables.com>
  12. * @author Vincent Petry <pvince81@owncloud.com>
  13. *
  14. * @copyright Copyright (c) 2015, ownCloud, Inc.
  15. * @license AGPL-3.0
  16. *
  17. * This code is free software: you can redistribute it and/or modify
  18. * it under the terms of the GNU Affero General Public License, version 3,
  19. * as published by the Free Software Foundation.
  20. *
  21. * This program is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. * GNU Affero General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU Affero General Public License, version 3,
  27. * along with this program. If not, see <http://www.gnu.org/licenses/>
  28. *
  29. */
  30. namespace OC\Files\Storage;
  31. use OC\Files\Filesystem;
  32. use OCA\Files_Sharing\ISharedStorage;
  33. use OCA\Files_Sharing\Propagator;
  34. use OCA\Files_Sharing\SharedMount;
  35. use OCP\Lock\ILockingProvider;
  36. /**
  37. * Convert target path to source path and pass the function call to the correct storage provider
  38. */
  39. class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
  40. private $share; // the shared resource
  41. private $files = array();
  42. private static $isInitialized = array();
  43. /**
  44. * @var \OC\Files\View
  45. */
  46. private $ownerView;
  47. public function __construct($arguments) {
  48. $this->share = $arguments['share'];
  49. $this->ownerView = $arguments['ownerView'];
  50. }
  51. /**
  52. * get id of the mount point
  53. *
  54. * @return string
  55. */
  56. public function getId() {
  57. return 'shared::' . $this->getMountPoint();
  58. }
  59. /**
  60. * get file cache of the shared item source
  61. *
  62. * @return int
  63. */
  64. public function getSourceId() {
  65. return (int)$this->share['file_source'];
  66. }
  67. /**
  68. * Get the source file path, permissions, and owner for a shared file
  69. *
  70. * @param string $target Shared target file path
  71. * @return array Returns array with the keys path, permissions, and owner or false if not found
  72. */
  73. public function getFile($target) {
  74. if (!isset($this->files[$target])) {
  75. // Check for partial files
  76. if (pathinfo($target, PATHINFO_EXTENSION) === 'part') {
  77. $source = \OC_Share_Backend_File::getSource(substr($target, 0, -5), $this->getShare());
  78. if ($source) {
  79. $source['path'] .= '.part';
  80. // All partial files have delete permission
  81. $source['permissions'] |= \OCP\Constants::PERMISSION_DELETE;
  82. }
  83. } else {
  84. $source = \OC_Share_Backend_File::getSource($target, $this->getShare());
  85. }
  86. $this->files[$target] = $source;
  87. }
  88. return $this->files[$target];
  89. }
  90. /**
  91. * Get the source file path for a shared file
  92. *
  93. * @param string $target Shared target file path
  94. * @return string|false source file path or false if not found
  95. */
  96. public function getSourcePath($target) {
  97. $source = $this->getFile($target);
  98. if ($source) {
  99. if (!isset($source['fullPath'])) {
  100. \OC\Files\Filesystem::initMountPoints($source['fileOwner']);
  101. $mount = \OC\Files\Filesystem::getMountByNumericId($source['storage']);
  102. if (is_array($mount) && !empty($mount)) {
  103. $this->files[$target]['fullPath'] = $mount[key($mount)]->getMountPoint() . $source['path'];
  104. } else {
  105. $this->files[$target]['fullPath'] = false;
  106. \OCP\Util::writeLog('files_sharing', "Unable to get mount for shared storage '" . $source['storage'] . "' user '" . $source['fileOwner'] . "'", \OCP\Util::ERROR);
  107. }
  108. }
  109. return $this->files[$target]['fullPath'];
  110. }
  111. return false;
  112. }
  113. /**
  114. * Get the permissions granted for a shared file
  115. *
  116. * @param string $target Shared target file path
  117. * @return int CRUDS permissions granted
  118. */
  119. public function getPermissions($target = '') {
  120. $permissions = $this->share['permissions'];
  121. // part files and the mount point always have delete permissions
  122. if ($target === '' || pathinfo($target, PATHINFO_EXTENSION) === 'part') {
  123. $permissions |= \OCP\Constants::PERMISSION_DELETE;
  124. }
  125. if (\OCP\Util::isSharingDisabledForUser()) {
  126. $permissions &= ~\OCP\Constants::PERMISSION_SHARE;
  127. }
  128. return $permissions;
  129. }
  130. public function mkdir($path) {
  131. if ($path == '' || $path == '/' || !$this->isCreatable(dirname($path))) {
  132. return false;
  133. } else if ($source = $this->getSourcePath($path)) {
  134. list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
  135. return $storage->mkdir($internalPath);
  136. }
  137. return false;
  138. }
  139. /**
  140. * Delete the directory if DELETE permission is granted
  141. *
  142. * @param string $path
  143. * @return boolean
  144. */
  145. public function rmdir($path) {
  146. // never delete a share mount point
  147. if (empty($path)) {
  148. return false;
  149. }
  150. if (($source = $this->getSourcePath($path)) && $this->isDeletable($path)) {
  151. list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
  152. return $storage->rmdir($internalPath);
  153. }
  154. return false;
  155. }
  156. public function opendir($path) {
  157. $source = $this->getSourcePath($path);
  158. list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
  159. return $storage->opendir($internalPath);
  160. }
  161. public function is_dir($path) {
  162. $source = $this->getSourcePath($path);
  163. list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
  164. return $storage->is_dir($internalPath);
  165. }
  166. public function is_file($path) {
  167. if ($source = $this->getSourcePath($path)) {
  168. list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
  169. return $storage->is_file($internalPath);
  170. }
  171. return false;
  172. }
  173. public function stat($path) {
  174. if ($path == '' || $path == '/') {
  175. $stat['size'] = $this->filesize($path);
  176. $stat['mtime'] = $this->filemtime($path);
  177. return $stat;
  178. } else if ($source = $this->getSourcePath($path)) {
  179. list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
  180. return $storage->stat($internalPath);
  181. }
  182. return false;
  183. }
  184. public function filetype($path) {
  185. if ($path == '' || $path == '/') {
  186. return 'dir';
  187. } else if ($source = $this->getSourcePath($path)) {
  188. list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
  189. return $storage->filetype($internalPath);
  190. }
  191. return false;
  192. }
  193. public function filesize($path) {
  194. $source = $this->getSourcePath($path);
  195. list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
  196. return $storage->filesize($internalPath);
  197. }
  198. public function isCreatable($path) {
  199. return ($this->getPermissions($path) & \OCP\Constants::PERMISSION_CREATE);
  200. }
  201. public function isReadable($path) {
  202. $isReadable = false;
  203. if ($source = $this->getSourcePath($path)) {
  204. list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
  205. $isReadable = $storage->isReadable($internalPath);
  206. }
  207. return $isReadable && $this->file_exists($path);
  208. }
  209. public function isUpdatable($path) {
  210. return ($this->getPermissions($path) & \OCP\Constants::PERMISSION_UPDATE);
  211. }
  212. public function isDeletable($path) {
  213. return ($this->getPermissions($path) & \OCP\Constants::PERMISSION_DELETE);
  214. }
  215. public function isSharable($path) {
  216. if (\OCP\Util::isSharingDisabledForUser()) {
  217. return false;
  218. }
  219. return ($this->getPermissions($path) & \OCP\Constants::PERMISSION_SHARE);
  220. }
  221. public function file_exists($path) {
  222. if ($path == '' || $path == '/') {
  223. return true;
  224. } else if ($source = $this->getSourcePath($path)) {
  225. list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
  226. return $storage->file_exists($internalPath);
  227. }
  228. return false;
  229. }
  230. public function filemtime($path) {
  231. $source = $this->getSourcePath($path);
  232. list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
  233. return $storage->filemtime($internalPath);
  234. }
  235. public function file_get_contents($path) {
  236. $source = $this->getSourcePath($path);
  237. if ($source) {
  238. $info = array(
  239. 'target' => $this->getMountPoint() . $path,
  240. 'source' => $source,
  241. );
  242. \OCP\Util::emitHook('\OC\Files\Storage\Shared', 'file_get_contents', $info);
  243. list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
  244. return $storage->file_get_contents($internalPath);
  245. }
  246. }
  247. public function file_put_contents($path, $data) {
  248. if ($source = $this->getSourcePath($path)) {
  249. // Check if permission is granted
  250. if (($this->file_exists($path) && !$this->isUpdatable($path))
  251. || ($this->is_dir($path) && !$this->isCreatable($path))
  252. ) {
  253. return false;
  254. }
  255. $info = array(
  256. 'target' => $this->getMountPoint() . '/' . $path,
  257. 'source' => $source,
  258. );
  259. \OCP\Util::emitHook('\OC\Files\Storage\Shared', 'file_put_contents', $info);
  260. list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
  261. $result = $storage->file_put_contents($internalPath, $data);
  262. return $result;
  263. }
  264. return false;
  265. }
  266. /**
  267. * Delete the file if DELETE permission is granted
  268. *
  269. * @param string $path
  270. * @return boolean
  271. */
  272. public function unlink($path) {
  273. // never delete a share mount point
  274. if (empty($path)) {
  275. return false;
  276. }
  277. if ($source = $this->getSourcePath($path)) {
  278. if ($this->isDeletable($path)) {
  279. list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
  280. return $storage->unlink($internalPath);
  281. }
  282. }
  283. return false;
  284. }
  285. public function rename($path1, $path2) {
  286. // we need the paths relative to data/user/files
  287. $relPath1 = $this->getMountPoint() . '/' . $path1;
  288. $relPath2 = $this->getMountPoint() . '/' . $path2;
  289. $pathinfo = pathinfo($relPath1);
  290. $isPartFile = (isset($pathinfo['extension']) && $pathinfo['extension'] === 'part');
  291. $targetExists = $this->file_exists($path2);
  292. $sameFolder = (dirname($relPath1) === dirname($relPath2));
  293. if ($targetExists || ($sameFolder && !$isPartFile)) {
  294. // note that renaming a share mount point is always allowed
  295. if (!$this->isUpdatable('')) {
  296. return false;
  297. }
  298. } else {
  299. if (!$this->isCreatable('')) {
  300. return false;
  301. }
  302. }
  303. /**
  304. * @var \OC\Files\Storage\Storage $sourceStorage
  305. */
  306. list($sourceStorage, $sourceInternalPath) = $this->resolvePath($path1);
  307. /**
  308. * @var \OC\Files\Storage\Storage $targetStorage
  309. */
  310. list($targetStorage, $targetInternalPath) = $this->resolvePath($path2);
  311. return $targetStorage->moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath);
  312. }
  313. public function copy($path1, $path2) {
  314. // Copy the file if CREATE permission is granted
  315. if ($this->isCreatable(dirname($path2))) {
  316. /**
  317. * @var \OC\Files\Storage\Storage $sourceStorage
  318. */
  319. list($sourceStorage, $sourceInternalPath) = $this->resolvePath($path1);
  320. /**
  321. * @var \OC\Files\Storage\Storage $targetStorage
  322. */
  323. list($targetStorage, $targetInternalPath) = $this->resolvePath($path2);
  324. return $targetStorage->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath);
  325. }
  326. return false;
  327. }
  328. public function fopen($path, $mode) {
  329. if ($source = $this->getSourcePath($path)) {
  330. switch ($mode) {
  331. case 'r+':
  332. case 'rb+':
  333. case 'w+':
  334. case 'wb+':
  335. case 'x+':
  336. case 'xb+':
  337. case 'a+':
  338. case 'ab+':
  339. case 'w':
  340. case 'wb':
  341. case 'x':
  342. case 'xb':
  343. case 'a':
  344. case 'ab':
  345. $creatable = $this->isCreatable($path);
  346. $updatable = $this->isUpdatable($path);
  347. // if neither permissions given, no need to continue
  348. if (!$creatable && !$updatable) {
  349. return false;
  350. }
  351. $exists = $this->file_exists($path);
  352. // if a file exists, updatable permissions are required
  353. if ($exists && !$updatable) {
  354. return false;
  355. }
  356. // part file is allowed if !$creatable but the final file is $updatable
  357. if (pathinfo($path, PATHINFO_EXTENSION) !== 'part') {
  358. if (!$exists && !$creatable) {
  359. return false;
  360. }
  361. }
  362. }
  363. $info = array(
  364. 'target' => $this->getMountPoint() . $path,
  365. 'source' => $source,
  366. 'mode' => $mode,
  367. );
  368. \OCP\Util::emitHook('\OC\Files\Storage\Shared', 'fopen', $info);
  369. list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
  370. return $storage->fopen($internalPath, $mode);
  371. }
  372. return false;
  373. }
  374. public function getMimeType($path) {
  375. if ($source = $this->getSourcePath($path)) {
  376. list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
  377. return $storage->getMimeType($internalPath);
  378. }
  379. return false;
  380. }
  381. public function free_space($path) {
  382. $source = $this->getSourcePath($path);
  383. if ($source) {
  384. list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
  385. return $storage->free_space($internalPath);
  386. }
  387. return \OCP\Files\FileInfo::SPACE_UNKNOWN;
  388. }
  389. public function getLocalFile($path) {
  390. if ($source = $this->getSourcePath($path)) {
  391. list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
  392. return $storage->getLocalFile($internalPath);
  393. }
  394. return false;
  395. }
  396. public function touch($path, $mtime = null) {
  397. if ($source = $this->getSourcePath($path)) {
  398. list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
  399. return $storage->touch($internalPath, $mtime);
  400. }
  401. return false;
  402. }
  403. /**
  404. * return mount point of share, relative to data/user/files
  405. *
  406. * @return string
  407. */
  408. public function getMountPoint() {
  409. return $this->share['file_target'];
  410. }
  411. public function setMountPoint($path) {
  412. $this->share['file_target'] = $path;
  413. }
  414. public function getShareType() {
  415. return $this->share['share_type'];
  416. }
  417. /**
  418. * does the group share already has a user specific unique name
  419. *
  420. * @return bool
  421. */
  422. public function uniqueNameSet() {
  423. return (isset($this->share['unique_name']) && $this->share['unique_name']);
  424. }
  425. /**
  426. * the share now uses a unique name of this user
  427. *
  428. * @brief the share now uses a unique name of this user
  429. */
  430. public function setUniqueName() {
  431. $this->share['unique_name'] = true;
  432. }
  433. /**
  434. * get share ID
  435. *
  436. * @return integer unique share ID
  437. */
  438. public function getShareId() {
  439. return $this->share['id'];
  440. }
  441. /**
  442. * get the user who shared the file
  443. *
  444. * @return string
  445. */
  446. public function getSharedFrom() {
  447. return $this->share['uid_owner'];
  448. }
  449. /**
  450. * @return array
  451. */
  452. public function getShare() {
  453. return $this->share;
  454. }
  455. /**
  456. * return share type, can be "file" or "folder"
  457. *
  458. * @return string
  459. */
  460. public function getItemType() {
  461. return $this->share['item_type'];
  462. }
  463. public function hasUpdated($path, $time) {
  464. return $this->filemtime($path) > $time;
  465. }
  466. public function getCache($path = '', $storage = null) {
  467. if (!$storage) {
  468. $storage = $this;
  469. }
  470. return new \OC\Files\Cache\Shared_Cache($storage);
  471. }
  472. public function getScanner($path = '', $storage = null) {
  473. if (!$storage) {
  474. $storage = $this;
  475. }
  476. return new \OC\Files\Cache\SharedScanner($storage);
  477. }
  478. public function getWatcher($path = '', $storage = null) {
  479. if (!$storage) {
  480. $storage = $this;
  481. }
  482. return new \OC\Files\Cache\Shared_Watcher($storage);
  483. }
  484. public function getOwner($path) {
  485. if ($path == '') {
  486. $path = $this->getMountPoint();
  487. }
  488. $source = $this->getFile($path);
  489. if ($source) {
  490. return $source['fileOwner'];
  491. }
  492. return false;
  493. }
  494. public function getETag($path) {
  495. if ($path == '') {
  496. $path = $this->getMountPoint();
  497. }
  498. if ($source = $this->getSourcePath($path)) {
  499. list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
  500. return $storage->getETag($internalPath);
  501. }
  502. return null;
  503. }
  504. /**
  505. * unshare complete storage, also the grouped shares
  506. *
  507. * @return bool
  508. */
  509. public function unshareStorage() {
  510. $result = true;
  511. if (!empty($this->share['grouped'])) {
  512. foreach ($this->share['grouped'] as $share) {
  513. $result = $result && \OCP\Share::unshareFromSelf($share['item_type'], $share['file_target']);
  514. }
  515. }
  516. $result = $result && \OCP\Share::unshareFromSelf($this->getItemType(), $this->getMountPoint());
  517. return $result;
  518. }
  519. /**
  520. * Resolve the path for the source of the share
  521. *
  522. * @param string $path
  523. * @return array
  524. */
  525. private function resolvePath($path) {
  526. $source = $this->getSourcePath($path);
  527. return \OC\Files\Filesystem::resolvePath($source);
  528. }
  529. /**
  530. * @param \OCP\Files\Storage $sourceStorage
  531. * @param string $sourceInternalPath
  532. * @param string $targetInternalPath
  533. * @return bool
  534. */
  535. public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
  536. /** @var \OCP\Files\Storage $targetStorage */
  537. list($targetStorage, $targetInternalPath) = $this->resolvePath($targetInternalPath);
  538. return $targetStorage->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath);
  539. }
  540. /**
  541. * @param \OCP\Files\Storage $sourceStorage
  542. * @param string $sourceInternalPath
  543. * @param string $targetInternalPath
  544. * @return bool
  545. */
  546. public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
  547. /** @var \OCP\Files\Storage $targetStorage */
  548. list($targetStorage, $targetInternalPath) = $this->resolvePath($targetInternalPath);
  549. return $targetStorage->moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath);
  550. }
  551. /**
  552. * @param string $path
  553. * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
  554. * @param \OCP\Lock\ILockingProvider $provider
  555. * @throws \OCP\Lock\LockedException
  556. */
  557. public function acquireLock($path, $type, ILockingProvider $provider) {
  558. /** @var \OCP\Files\Storage $targetStorage */
  559. list($targetStorage, $targetInternalPath) = $this->resolvePath($path);
  560. $targetStorage->acquireLock($targetInternalPath, $type, $provider);
  561. // lock the parent folders of the owner when locking the share as recipient
  562. if ($path === '') {
  563. $sourcePath = $this->ownerView->getPath($this->share['file_source']);
  564. $this->ownerView->lockFile(dirname($sourcePath), ILockingProvider::LOCK_SHARED, true);
  565. }
  566. }
  567. /**
  568. * @param string $path
  569. * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
  570. * @param \OCP\Lock\ILockingProvider $provider
  571. */
  572. public function releaseLock($path, $type, ILockingProvider $provider) {
  573. /** @var \OCP\Files\Storage $targetStorage */
  574. list($targetStorage, $targetInternalPath) = $this->resolvePath($path);
  575. $targetStorage->releaseLock($targetInternalPath, $type, $provider);
  576. // unlock the parent folders of the owner when unlocking the share as recipient
  577. if ($path === '') {
  578. $sourcePath = $this->ownerView->getPath($this->share['file_source']);
  579. $this->ownerView->unlockFile(dirname($sourcePath), ILockingProvider::LOCK_SHARED, true);
  580. }
  581. }
  582. /**
  583. * @param string $path
  584. * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
  585. * @param \OCP\Lock\ILockingProvider $provider
  586. */
  587. public function changeLock($path, $type, ILockingProvider $provider) {
  588. /** @var \OCP\Files\Storage $targetStorage */
  589. list($targetStorage, $targetInternalPath) = $this->resolvePath($path);
  590. $targetStorage->changeLock($targetInternalPath, $type, $provider);
  591. }
  592. /**
  593. * @return array [ available, last_checked ]
  594. */
  595. public function getAvailability() {
  596. // shares do not participate in availability logic
  597. return [
  598. 'available' => true,
  599. 'last_checked' => 0
  600. ];
  601. }
  602. /**
  603. * @param bool $available
  604. */
  605. public function setAvailability($available) {
  606. // shares do not participate in availability logic
  607. }
  608. }