Skip to content

Commit

Permalink
apply known mtime wrapper for external storages
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 authored and blizzz committed Oct 10, 2023
1 parent 36eef0b commit 155fd0b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
28 changes: 10 additions & 18 deletions apps/files_external/lib/Config/ConfigAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

use OC\Files\Storage\FailedStorage;
use OC\Files\Storage\Wrapper\Availability;
use OC\Files\Storage\Wrapper\KnownMtime;
use OCA\Files_External\Lib\PersonalMount;
use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\Service\UserGlobalStoragesService;
Expand All @@ -40,29 +41,17 @@
use OCP\Files\Storage\IStorageFactory;
use OCP\Files\StorageNotAvailableException;
use OCP\IUser;
use Psr\Clock\ClockInterface;

/**
* Make the old files_external config work with the new public mount config api
*/
class ConfigAdapter implements IMountProvider {

/** @var UserStoragesService */
private $userStoragesService;

/** @var UserGlobalStoragesService */
private $userGlobalStoragesService;

/**
* @param UserStoragesService $userStoragesService
* @param UserGlobalStoragesService $userGlobalStoragesService
*/
public function __construct(
UserStoragesService $userStoragesService,
UserGlobalStoragesService $userGlobalStoragesService
) {
$this->userStoragesService = $userStoragesService;
$this->userGlobalStoragesService = $userGlobalStoragesService;
}
private UserStoragesService $userStoragesService,
private UserGlobalStoragesService $userGlobalStoragesService,
private ClockInterface $clock,
) {}

/**
* Process storage ready for mounting
Expand Down Expand Up @@ -155,7 +144,10 @@ public function getMountsForUser(IUser $user, IStorageFactory $loader) {
$this->userStoragesService,
$storageConfig,
$storageConfig->getId(),
$storage,
new KnownMtime([
'storage' => $storage,
'clock' => $this->clock,
]),
'/' . $user->getUID() . '/files' . $storageConfig->getMountPoint(),
null,
$loader,
Expand Down
1 change: 0 additions & 1 deletion tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

use OC\Files\Storage\Temporary;
use OC\Files\Storage\Wrapper\KnownMtime;
use OCP\Constants;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Clock\ClockInterface;
use Test\Files\Storage\Storage;
Expand Down

0 comments on commit 155fd0b

Please sign in to comment.