PageRenderTime 44ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/private/Files/Cache/HomePropagator.php

https://gitlab.com/wuhang2003/core
PHP | 51 lines | 18 code | 6 blank | 27 comment | 2 complexity | ea6f43a126c4dd1add0f7e9ebac44d8f MD5 | raw file
  1. <?php
  2. /**
  3. * @author Robin Appelman <icewind@owncloud.com>
  4. *
  5. * @copyright Copyright (c) 2016, ownCloud, Inc.
  6. * @license AGPL-3.0
  7. *
  8. * This code is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License, version 3,
  10. * as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU Affero General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Affero General Public License, version 3,
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>
  19. *
  20. */
  21. namespace OC\Files\Cache;
  22. use OCP\IDBConnection;
  23. class HomePropagator extends Propagator {
  24. private $ignoredBaseFolders;
  25. /**
  26. * @param \OC\Files\Storage\Storage $storage
  27. */
  28. public function __construct(\OC\Files\Storage\Storage $storage, IDBConnection $connection) {
  29. parent::__construct($storage, $connection);
  30. $this->ignoredBaseFolders = ['files_encryption'];
  31. }
  32. /**
  33. * @param string $internalPath
  34. * @param int $time
  35. * @param int $sizeDifference number of bytes the file has grown
  36. */
  37. public function propagateChange($internalPath, $time, $sizeDifference = 0) {
  38. list($baseFolder) = explode('/', $internalPath, 2);
  39. if (in_array($baseFolder, $this->ignoredBaseFolders)) {
  40. return [];
  41. } else {
  42. parent::propagateChange($internalPath, $time, $sizeDifference);
  43. }
  44. }
  45. }