From 7a3b481c61225c8cc2de3f741f1716330f4bfcff Mon Sep 17 00:00:00 2001
From: Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de>
Date: Fri, 5 Aug 2022 19:28:15 +0000
Subject: [PATCH] disable opcache (for this request) when updating plugin,
 fixes #569

Closes #569

Merge request studip/studip!866
---
 lib/classes/PluginAdministration.php | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/lib/classes/PluginAdministration.php b/lib/classes/PluginAdministration.php
index caf80ceab22..dc3f3bcc51d 100644
--- a/lib/classes/PluginAdministration.php
+++ b/lib/classes/PluginAdministration.php
@@ -100,6 +100,9 @@ class PluginAdministration
                 rmdirr($plugindir_old);
                 rename($plugindir, $plugindir_old);
             }
+
+            // avoid loading old version of the class from opcache (see ticket #569)
+            ini_set('opcache.enable', 0);
         }
 
         // move directory to final destination
@@ -119,10 +122,6 @@ class PluginAdministration
 
         rename($tmpplugindir, $plugindir);
 
-        // wait until opcache.revalidate_freq expires
-        $revalidate_freq = min(ini_get('opcache.revalidate_freq'), 10);
-        sleep($revalidate_freq);
-
         // create database schema if needed
         $this->createDBSchema($plugindir, $manifest, $pluginregistered);
 
-- 
GitLab