fix: handle fopen failure gracefully and improve dep check severity
Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/73ed1a44-9f9b-44d6-995a-706993bdef21 Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
parent
d852a44a63
commit
2303175e56
2 changed files with 61 additions and 21 deletions
14
install.php
14
install.php
|
|
@ -221,8 +221,18 @@ function install() {
|
|||
"\$db_type=\"".$db_type."\";\n".
|
||||
"?>";
|
||||
|
||||
$temp = @fopen("includes/config.inc.php", "w");
|
||||
if (!@fwrite($temp, $config)) {
|
||||
$temp = fopen("includes/config.inc.php", "w");
|
||||
if ($temp === false) {
|
||||
print_failure(get_lang('unable_to_write_config') .
|
||||
" — <code>includes/config.inc.php</code> could not be opened for writing. " .
|
||||
"Please run: <code>sudo chmod 664 includes/config.inc.php && sudo chown www-data:www-data includes/config.inc.php</code> " .
|
||||
"(or <code>sudo chmod -R 775 includes/ && sudo chown -R www-data:www-data includes/</code> if the file does not yet exist). " .
|
||||
"You can also use the <a href='check.php'>Dependency Check</a> page for a full diagnostics report.");
|
||||
echo "<p><a href='?step=1'>".get_lang('back')."</a></p>";
|
||||
echo "</td></tr></table>\n";
|
||||
return;
|
||||
}
|
||||
if (fwrite($temp, $config) === false) {
|
||||
print_failure(get_lang('unable_to_write_config'));
|
||||
echo "<p><a href='?step=1'>".get_lang('back')."</a></p>";
|
||||
fclose($temp);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue