Skip to content
Open
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
9 changes: 9 additions & 0 deletions config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -2280,6 +2280,15 @@
*/
'updatedirectory' => '',

/**
* Override where Nextcloud stores the ``appdata_INSTANCEID`` directory. Useful
* when using remote object storage where local system disks provide faster data
* access. Defaults to `datadirectory` if unset.
*
* The Web server user must have write access to this directory.
*/
'appdatadirectory' => '',

/**
* Block specific files or filenames, disallowing uploads or access (read and write).
* ``.htaccess`` is blocked by default.
Expand Down
18 changes: 17 additions & 1 deletion lib/private/Files/SetupManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,26 @@ public function setupRoot(): void {
foreach ($rootMounts as $rootMountProvider) {
$this->mountManager->addMount($rootMountProvider);
}

$this->setupAppData();
Copy link
Contributor Author

@akhil1508 akhil1508 Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if this is the right place to do this mount setup. setupRoot doesn't have any events to hook into either.

But if we do it in AppData.php like in #36337, occ files:scan-app-data stops working since that command does a tearDownFS and setupFS.

Whereas $setupManager->setupRoot() seems to me is completed generally for all requests, commands and background jobs.

Please suggest a better approach if possible :)

$this->eventLogger->end('fs:setup:root');
}

private function setupAppData(): void {
if ($appdatadirectory = $this->config->getSystemValue('appdatadirectory', null)) {
$instanceId = $this->config->getSystemValue('instanceid', null);
if ($instanceId === null) {
throw new \RuntimeException('no instance id!');
}
$folderName = 'appdata_' . $instanceId;
$arguments = [
'datadir' => $appdatadirectory,
];
$storage = new \OC\Files\Storage\Local($arguments);
$mount = new \OC\Files\Mount\MountPoint($storage, $folderName, $arguments);
$this->mountManager->addMount($mount);
}
}

/**
* Get the user to setup for a path or `null` if the root needs to be setup
*
Expand Down
1 change: 1 addition & 0 deletions lib/private/SystemConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class SystemConfig {
protected const DEFAULT_SENSITIVE_VALUES = [
'instanceid' => true,
'datadirectory' => true,
'appdatadirectory' => true,
'dbname' => true,
'dbhost' => true,
'dbpassword' => true,
Expand Down
Loading