mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-19 22:16:49 +00:00
Merge pull request #326 from nextcloud/enh/271/allow-to-change-datadir
allow to change the location of Nextclouds datadir
This commit is contained in:
commit
d170feb1e7
5 changed files with 65 additions and 2 deletions
|
|
@ -337,4 +337,27 @@ class ConfigurationManager
|
|||
return $mount;
|
||||
}
|
||||
}
|
||||
|
||||
public function GetNextcloudDatadirMount() : string {
|
||||
$mount = getenv('NEXTCLOUD_DATADIR');
|
||||
if ($mount === false) {
|
||||
$config = $this->GetConfig();
|
||||
if (!isset($config['nextcloud_datadir']) || $config['nextcloud_datadir'] === '') {
|
||||
$config['nextcloud_datadir'] = 'nextcloud_aio_nextcloud_data';
|
||||
}
|
||||
return $config['nextcloud_datadir'];
|
||||
} else {
|
||||
if(file_exists(DataConst::GetConfigFile())) {
|
||||
$config = $this->GetConfig();
|
||||
if (!isset($config['nextcloud_datadir'])) {
|
||||
$config['nextcloud_datadir'] = '';
|
||||
}
|
||||
if ($mount !== $config['nextcloud_datadir']) {
|
||||
$config['nextcloud_datadir'] = $mount;
|
||||
$this->WriteConfig($config);
|
||||
}
|
||||
}
|
||||
return $mount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue