Skip to content

Commit

Permalink
Display error message if config.local.php is not writable
Browse files Browse the repository at this point in the history
  • Loading branch information
slawkens committed Feb 4, 2024
1 parent e2487f9 commit 647eae0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion system/settings.php
Expand Up @@ -1651,7 +1651,12 @@
}
}

return Settings::saveConfig($configToSave, BASE . 'config.local.php');
$success = Settings::saveConfig($configToSave, BASE . 'config.local.php');
if (!$success) {
error('There has been error saving the config.local.php - probably problem with permissions.');
}

return $success;
},
],
];
Expand Down
6 changes: 3 additions & 3 deletions system/src/Settings.php
Expand Up @@ -557,10 +557,10 @@ public static function saveConfig($config, $filename, &$content = '')
$content .= ';' . PHP_EOL;
}

$success = file_put_contents($filename, $content);
$success = @file_put_contents($filename, $content);

// we saved new config.php, need to revalidate cache (only if opcache is enabled)
if (function_exists('opcache_invalidate')) {
if ($success && function_exists('opcache_invalidate')) {
opcache_invalidate($filename);
}

Expand Down Expand Up @@ -606,7 +606,7 @@ public static function testDatabaseConnection($config): bool
return true;
}

public function getErrors() {
public function getErrors(): array {
return $this->errors;
}

Expand Down

0 comments on commit 647eae0

Please sign in to comment.