CachedMountFileInfo.php 1004 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OC\Files\Config;
  7. use OCP\Files\Config\ICachedMountFileInfo;
  8. use OCP\IUser;
  9. class CachedMountFileInfo extends CachedMountInfo implements ICachedMountFileInfo {
  10. private string $internalPath;
  11. public function __construct(
  12. IUser $user,
  13. int $storageId,
  14. int $rootId,
  15. string $mountPoint,
  16. ?int $mountId,
  17. string $mountProvider,
  18. string $rootInternalPath,
  19. string $internalPath,
  20. ) {
  21. parent::__construct($user, $storageId, $rootId, $mountPoint, $mountProvider, $mountId, $rootInternalPath);
  22. $this->internalPath = $internalPath;
  23. }
  24. public function getInternalPath(): string {
  25. if ($this->getRootInternalPath()) {
  26. return substr($this->internalPath, strlen($this->getRootInternalPath()) + 1);
  27. } else {
  28. return $this->internalPath;
  29. }
  30. }
  31. public function getPath(): string {
  32. return $this->getMountPoint() . $this->getInternalPath();
  33. }
  34. }