From f816bd8b04db9ca63870a2a8f68ff8a8a261b9f0 Mon Sep 17 00:00:00 2001 From: divinity76 Date: Mon, 17 Mar 2025 14:58:12 +0100 Subject: [PATCH] fix config save opcache delay If you had opcache installed, settings changes would not be immediately applied, leading to the >Sometimes the save action may not work on the first try, so please attempt it again. text. Opcache is bundled in php core as of php5.5.0, compiled by default in php-fpm, and is a very popular extension. It's basically ubiquitous. --- tinyfilemanager.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tinyfilemanager.php b/tinyfilemanager.php index d1848d9..a9c7f12 100644 --- a/tinyfilemanager.php +++ b/tinyfilemanager.php @@ -1639,8 +1639,6 @@ if (isset($_GET['settings']) && !FM_READONLY) { - - * . @@ -3691,7 +3689,11 @@ class FM_Config for ($x = 3; $x < count($lines); $x++) { @fputs($fh, $lines[$x], strlen($lines[$x])); } + @fflush($fh); @fclose($fh); + if (is_callable("opcache_invalidate")) { + @opcache_invalidate($fm_file, true); + } } } }