Skip to content

Commit 4d14bab

Browse files
committed
Config value to allow to extend .user.ini on update
When running nextcloud with a web hoster it might be necessary to extend .user.ini after each update (e.g. adding memory_limit). To automate this step, an additional config entry may be provided in config.php that specifies the lines to be added to .user.ini. If the config option 'user_ini_additional_lines' exists, the provided value (string or array of strings) will be added to .user.ini. Signed-off-by: Mathias Koehrer <koehrer08@koehrer-mail.de>
1 parent 744f04d commit 4d14bab

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

index.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,19 @@ public function finalize() {
10231023
throw new \Exception('Could not rmdir .step');
10241024
}
10251025

1026+
/* Check if there is the need to extend .user.ini */
1027+
$user_ini_additional_lines = $this->getConfigOption('user_ini_additional_lines');
1028+
if ($user_ini_additional_lines) {
1029+
$this->silentLog('[info] Extend .user.ini');
1030+
if (is_array($user_ini_additional_lines)) {
1031+
$user_ini_additional_lines = implode(PHP_EOL, $user_ini_additional_lines);
1032+
}
1033+
$result = file_put_contents($this->baseDir . '/../.user.ini', PHP_EOL . '; Additional settings from config.php:' . PHP_EOL . $user_ini_additional_lines . PHP_EOL, FILE_APPEND | FILE_LOCK);
1034+
if ($result === false) {
1035+
throw new \Exception('Could not append to .user.ini');
1036+
}
1037+
}
1038+
10261039
if (function_exists('opcache_reset')) {
10271040
$this->silentLog('[info] call opcache_reset()');
10281041
opcache_reset();

0 commit comments

Comments
 (0)