From: Bram Matthys Date: Sat, 22 Apr 2023 07:11:13 +0000 (+0200) Subject: Check if opcache_invalidate() is available, before calling it, fixing HTTP 500 X-Git-Tag: 0.9~123 X-Git-Url: https://jfr.im/git/irc/unrealircd/unrealircd-webpanel.git/commitdiff_plain/9f303b7c3d4a9859030e7b0d62d035975886cdb2 Check if opcache_invalidate() is available, before calling it, fixing HTTP 500 in setup screen. Reported by Madriix in https://github.com/unrealircd/unrealircd-webpanel/issues/26 --- diff --git a/common.php b/common.php index b666395..c6139c2 100644 --- a/common.php +++ b/common.php @@ -118,7 +118,8 @@ function write_config_file() /* Now atomically rename the file */ if (!rename($tmpfile, $cfg_filename)) die("Could not write (rename) to file ".$cfg_filename."
"); - opcache_invalidate($cfg_filename); + if (function_exists('opcache_invalidate')) + opcache_invalidate($cfg_filename); /* Do not re-read config, as it would reinitialize config * without having the DB settings read. (And it also diff --git a/plugins/file_auth/file_auth.php b/plugins/file_auth/file_auth.php index 77095d7..ece2bd2 100644 --- a/plugins/file_auth/file_auth.php +++ b/plugins/file_auth/file_auth.php @@ -186,7 +186,8 @@ class file_auth /* Now atomically rename the file */ if (!rename($tmpfile, $db_filename)) die("Could not write (rename) to file ".$db_filename."
"); - opcache_invalidate($db_filename); + if (function_exists('opcache_invalidate')) + opcache_invalidate($db_filename); } public static function user_create(&$u)