MDL-49329 admin: Call opcache_reset() after installing new plugin code
authorDavid Mudrák <david@moodle.com>
Wed, 7 Oct 2015 19:33:43 +0000 (21:33 +0200)
committerDavid Mudrák <david@moodle.com>
Fri, 9 Oct 2015 07:50:45 +0000 (09:50 +0200)
During the testing, I was experiencing weird behaviour - after a single
plugin updated was installed, I ended up on admin/index.php?cache=1. I
believe it was caused by the missing opcache_reset().

lib/classes/plugin_manager.php

index c8fc476..4de0ae7 100644 (file)
@@ -1321,10 +1321,16 @@ class core_plugin_manager {
             if (!$this->unzip_plugin_file($zipfile, $target, $pluginname)) {
                 $silent or $this->mtrace(get_string('error'));
                 $silent or $this->mtrace('Unable to unzip '.$zipfile, PHP_EOL, DEBUG_DEVELOPER);
+                if (function_exists('opcache_reset')) {
+                    opcache_reset();
+                }
                 return false;
             }
             $silent or $this->mtrace($ok);
         }
+        if (function_exists('opcache_reset')) {
+            opcache_reset();
+        }
 
         return true;
     }