Skip to content

Commit

Permalink
Merge pull request #44061 from nextcloud/revert-32163-file-cache-gc-n…
Browse files Browse the repository at this point in the history
…o-full-setup

Revert "don't perform an explicit setup when using the file cache"
  • Loading branch information
skjnldsv authored Mar 7, 2024
2 parents be3449c + 951c330 commit 7b7fc30
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 22 deletions.
2 changes: 2 additions & 0 deletions lib/private/Cache/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
*/
namespace OC\Cache;

use OC\Files\Filesystem;
use OC\Files\View;
use OCP\ICache;
use OCP\Security\ISecureRandom;
Expand All @@ -52,6 +53,7 @@ protected function getStorage() {
if (\OC::$server->getUserSession()->isLoggedIn()) {
$rootView = new View();
$user = \OC::$server->getUserSession()->getUser();
Filesystem::initMountPoints($user->getUID());
if (!$rootView->file_exists('/' . $user->getUID() . '/cache')) {
$rootView->mkdir('/' . $user->getUID() . '/cache');
}
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Config/UserMountCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function registerMounts(IUser $user, array $mounts, array $mountProviderC

$cachedMounts = $this->getMountsForUser($user);
if (is_array($mountProviderClasses)) {
$cachedMounts = array_filter($cachedMounts, function (ICachedMountInfo $mountInfo) use ($mountProviderClasses, $newMounts): bool {
$cachedMounts = array_filter($cachedMounts, function (ICachedMountInfo $mountInfo) use ($mountProviderClasses, $newMounts) {
// for existing mounts that didn't have a mount provider set
// we still want the ones that map to new mounts
if ($mountInfo->getMountProvider() === '' && isset($newMounts[$mountInfo->getKey()])) {
Expand Down
8 changes: 0 additions & 8 deletions lib/private/Files/ObjectStore/ObjectStoreStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,6 @@ public function __construct($params) {
if (isset($params['validateWrites'])) {
$this->validateWrites = (bool)$params['validateWrites'];
}

// home storage is setup in the SetupManager
if (!$this instanceof HomeObjectStoreStorage) {
//initialize cache with root directory in cache
if (!$this->is_dir('/')) {
$this->mkdir('/');
}
}
$this->handleCopiesAsOwned = (bool)($params['handleCopiesAsOwned'] ?? false);

$this->logger = \OCP\Server::get(LoggerInterface::class);
Expand Down
15 changes: 2 additions & 13 deletions lib/private/Files/SetupManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,21 +257,10 @@ private function oneTimeUserSetup(IUser $user) {

if ($homeMount->getStorageRootId() === -1) {
$this->eventLogger->start('fs:setup:user:home:scan', 'Scan home filesystem for user');
$homeStorage = $homeMount->getStorage();
$homeStorage->mkdir('');
$homeStorage->mkdir('files');
$homeStorage->getScanner()->scan('');
$homeMount->getStorage()->mkdir('');
$homeMount->getStorage()->getScanner()->scan('');
$this->eventLogger->end('fs:setup:user:home:scan');
}

$provider = $homeMount->getMountProvider();
$this->userMountCache->registerMounts($user, [$homeMount], [$provider]);
if (!isset($this->setupUserMountProviders[$user->getUID()])) {
$this->setupUserMountProviders[$user->getUID()] = [];
}
if (!in_array($provider, $this->setupUserMountProviders[$user->getUID()])) {
$this->setupUserMountProviders[$user->getUID()][] = $provider;
}
$this->eventLogger->end('fs:setup:user:home');
} else {
$this->mountManager->addMount(new MountPoint(
Expand Down

0 comments on commit 7b7fc30

Please sign in to comment.