Skip to content

Commit

Permalink
Append config values to .user.ini
Browse files Browse the repository at this point in the history
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 <koehrer08@koehrer-mail.de>
  • Loading branch information
makoehr committed Apr 23, 2023
1 parent 744f04d commit d58fa17
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,19 @@ public function finalize() {
throw new \Exception('Could not rmdir .step');
}

/* Check if there is the need to extend .user.ini */
$user_ini_additional_lines = $this->getConfigOption('user_ini_additional_lines');
if ($user_ini_additional_lines) {
$this->silentLog('[info] Extend .user.ini');
if (is_array($user_ini_additional_lines)) {
$user_ini_additional_lines = implode(PHP_EOL, $user_ini_additional_lines);
}
$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);
if ($result === false) {
throw new \Exception('Could append to .user.ini');
}
}

if (function_exists('opcache_reset')) {
$this->silentLog('[info] call opcache_reset()');
opcache_reset();
Expand Down

0 comments on commit d58fa17

Please sign in to comment.