Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/dav/lib/Command/CleanupChunks.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ protected function configure() {
'local',
'l',
InputOption::VALUE_NONE,
'only delete chunks that exist on the local filesystem,
this applies to setups with multiple servers connected to the same database and
'only delete chunks that exist on the local filesystem,
this applies to setups with multiple servers connected to the same database and
chunk folder is not shared among'
);
}
Expand All @@ -74,7 +74,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$output->writeln("Cleaning chunks older than $d days({$cutOffTime->format('c')})");
$this->userManager->callForSeenUsers(function (IUser $user) use ($output, $cutOffTime, $checkUploadExistsLocal) {
\OC_Util::tearDownFS();
\OC_Util::setupFS($user->getUID());
\OC_Util::setupFS($user->getUID(), false);

$view = new View('/' . $user->getUID() . '/uploads');
$home = new UploadHome(['user' => $user]);
Expand Down
2 changes: 1 addition & 1 deletion apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ protected function tearDownFS() {
*/
protected function setupFS($user) {
\OC_Util::tearDownFS();
\OC_Util::setupFS($user);
\OC_Util::setupFS($user, false);

// Check if this user has a trashbin directory
$view = new \OC\Files\View('/' . $user);
Expand Down
2 changes: 1 addition & 1 deletion apps/files_trashbin/lib/Command/CleanUp.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
*/
protected function removeDeletedFiles($uid) {
\OC_Util::tearDownFS();
\OC_Util::setupFS($uid);
\OC_Util::setupFS($uid, false);
if ($this->rootFolder->nodeExists('/' . $uid . '/files_trashbin')) {
$this->rootFolder->get('/' . $uid . '/files_trashbin')->delete();
$query = $this->dbConnection->getQueryBuilder();
Expand Down
2 changes: 1 addition & 1 deletion apps/files_trashbin/lib/Command/Expire.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function handle() {
}

\OC_Util::tearDownFS();
\OC_Util::setupFS($this->user);
\OC_Util::setupFS($this->user, false);

$trashExpiryManager->expireTrash($this->user);

Expand Down
2 changes: 1 addition & 1 deletion apps/files_trashbin/lib/Command/ExpireTrash.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function expireTrashForUser(IUser $user) {
*/
protected function setupFS($user) {
\OC_Util::tearDownFS();
\OC_Util::setupFS($user);
\OC_Util::setupFS($user, false);

// Check if this user has a trashbin directory
$view = new \OC\Files\View('/' . $user);
Expand Down
2 changes: 1 addition & 1 deletion apps/files_versions/lib/BackgroundJob/ExpireVersions.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected function run($argument) {
*/
protected function setupFS($user) {
\OC_Util::tearDownFS();
\OC_Util::setupFS($user);
\OC_Util::setupFS($user, false);

// Check if this user has a versions directory
$view = new \OC\Files\View('/' . $user);
Expand Down
2 changes: 1 addition & 1 deletion apps/files_versions/lib/Command/ExpireVersions.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function expireVersionsForUser(IUser $user) {
*/
protected function setupFS($user) {
\OC_Util::tearDownFS();
\OC_Util::setupFS($user);
\OC_Util::setupFS($user, false);

// Check if this user has a version directory
$view = new \OC\Files\View('/' . $user);
Expand Down
17 changes: 17 additions & 0 deletions changelog/unreleased/40031
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Bugfix: Allow partial initialization of the FS

Previously, when the FS was initialized, we needed to make a request
to the LDAP server in order to fetch the possible group shares of the
user. Some commands only accessed to the trashbin or versions, and
operated for a target user, so accessing to the LDAP server to fetch
groups that wouldn't be used doesn't make much sense.

Now, the commands have the ability to initialize the FS partially,
meaning that no additional mount point other than the home one will
be mounted. In particular, this affects shares and external storages.
Anyway, the commands that have been modified don't need such access. The
main advantage is that now, those commands can operate without a working
connection to the LDAP server because the users will be fetched from the
DB and they don't operate with groups.

https://github.com/owncloud/core/pull/40031
2 changes: 1 addition & 1 deletion core/Command/Encryption/ChangeKeyStorageRoot.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ protected function moveSystemKeys($oldRoot, $newRoot) {
*/
protected function setupUserFS($uid) {
\OC_Util::tearDownFS();
\OC_Util::setupFS($uid);
\OC_Util::setupFS($uid, false);
}

/**
Expand Down
26 changes: 14 additions & 12 deletions lib/private/Files/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public static function resolvePath($path) {
}
}

public static function init($user, $root) {
public static function init($user, $root, $fullInit = true) {
if (self::$defaultInstance) {
return false;
}
Expand All @@ -371,7 +371,7 @@ public static function init($user, $root) {
}

//load custom mount config
self::initMountPoints($user);
self::initMountPoints($user, $fullInit);

self::$loaded = true;

Expand All @@ -390,7 +390,7 @@ public static function initMountManager() {
* @param string $user
* @throws \OC\User\NoUserException if the user is not available
*/
public static function initMountPoints($user = '') {
public static function initMountPoints($user = '', $fullInit = true) {
if ($user == '') {
$user = \OC_User::getUser();
}
Expand Down Expand Up @@ -441,16 +441,18 @@ public static function initMountPoints($user = '') {

\OC\Files\Filesystem::getStorage($user);

// Chance to mount for other storages
if ($userObject) {
$mounts = $mountConfigManager->getMountsForUser($userObject);
\array_walk($mounts, [self::$mounts, 'addMount']);
$mounts[] = $homeMount;
$mountConfigManager->registerMounts($userObject, $mounts);
}
if ($fullInit) {
// Chance to mount for other storages
if ($userObject) {
$mounts = $mountConfigManager->getMountsForUser($userObject);
\array_walk($mounts, [self::$mounts, 'addMount']);
$mounts[] = $homeMount;
$mountConfigManager->registerMounts($userObject, $mounts);
}

self::listenForNewMountProviders($mountConfigManager, $userManager);
\OC_Hook::emit('OC_Filesystem', 'post_initMountPoints', ['user' => $user]);
self::listenForNewMountProviders($mountConfigManager, $userManager);
\OC_Hook::emit('OC_Filesystem', 'post_initMountPoints', ['user' => $user]);
}
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/private/legacy/util.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private static function initObjectStoreRootFS($config) {
* @return boolean
* @description configure the initial filesystem based on the configuration
*/
public static function setupFS($user = '') {
public static function setupFS($user = '', $fullInit = true) {
//setting up the filesystem twice can only lead to trouble
if (self::$fsSetup) {
return false;
Expand Down Expand Up @@ -308,7 +308,7 @@ function ($mountPoint, $storage) use ($user) {
$userDir = '/' . $user . '/files';

//jail the user into his "home" directory
\OC\Files\Filesystem::init($user, $userDir);
\OC\Files\Filesystem::init($user, $userDir, $fullInit);

OC_Hook::emit('OC_Filesystem', 'setup', ['user' => $user, 'user_dir' => $userDir]);
}
Expand Down