Skip to content

Commit

Permalink
Set up FS before querying storage info in settings
Browse files Browse the repository at this point in the history
The personal info section of the personal settings is querying the
storage quota information. For this it requires the FS to be setup which
is not always guaranteed.

This fixes an issue where refreshing the settings page would cause it to
fail after Redis caches are full. It is likely that when Redis cache is
populated, some code path is initializing the FS, so it works so far.
But when the cache is populated, that code path is skipped so the FS is
not guaranteed to be setup...

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
  • Loading branch information
PVince81 committed Nov 13, 2020
1 parent fd76bf1 commit a9938aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apps/settings/lib/Settings/Personal/PersonalInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ public function getForm() {
$user = $this->userManager->get($uid);
$userData = $this->accountManager->getUser($user);

// make sure FS is setup before querying storage related stuff...
\OC_Util::setupFS($uid);

$storageInfo = \OC_Helper::getStorageInfo('/');
if ($storageInfo['quota'] === FileInfo::SPACE_UNLIMITED) {
$totalSpace = $this->l->t('Unlimited');
Expand Down
3 changes: 3 additions & 0 deletions lib/private/legacy/OC_Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,9 @@ public static function findBinaryPath($program) {
/**
* Calculate the disc space for the given path
*
* BEWARE: this requires that Util::setupFS() was called
* already !
*
* @param string $path
* @param \OCP\Files\FileInfo $rootInfo (optional)
* @return array
Expand Down

0 comments on commit a9938aa

Please sign in to comment.