]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/commitdiff
Check if opcache_invalidate() is available, before calling it, fixing HTTP 500
authorBram Matthys <redacted>
Sat, 22 Apr 2023 07:11:13 +0000 (09:11 +0200)
committerBram Matthys <redacted>
Sat, 22 Apr 2023 07:11:13 +0000 (09:11 +0200)
in setup screen.

Reported by Madriix in https://github.com/unrealircd/unrealircd-webpanel/issues/26

common.php
plugins/file_auth/file_auth.php

index b666395d8f7046ceb5d8a191cbb46acb39099dc7..c6139c2bcac5d3a503020b8f403bcb7ac251af09 100644 (file)
@@ -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."<br>");
-       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
index 77095d78fad199d9625cce1917efbdff2b064fde..ece2bd2061ef2d7bbe2702f59e8a8b079922ab9f 100644 (file)
@@ -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."<br>");
-               opcache_invalidate($db_filename);
+               if (function_exists('opcache_invalidate'))
+                       opcache_invalidate($db_filename);
        }
 
        public static function user_create(&$u)