Add missing cache resets when using PIP GUI
authorMatthias Schmidt <gravatronics@live.com>
Mon, 11 Feb 2019 17:57:35 +0000 (18:57 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Mon, 11 Feb 2019 17:57:35 +0000 (18:57 +0100)
See #2545

wcfsetup/install/files/lib/data/event/listener/EventListenerEditor.class.php
wcfsetup/install/files/lib/data/template/listener/TemplateListenerEditor.class.php
wcfsetup/install/files/lib/system/devtools/pip/TXmlGuiPackageInstallationPlugin.class.php

index bdf4ed122c773803305c311f4bca20e3dc449141..bf48a23b8ee5008596f73333e0ef2719d9c97ac0 100644 (file)
@@ -1,6 +1,8 @@
 <?php
 namespace wcf\data\event\listener;
 use wcf\data\DatabaseObjectEditor;
+use wcf\data\IEditableCachedObject;
+use wcf\system\cache\builder\EventListenerCacheBuilder;
 
 /**
  * Provides functions to edit event listener.
@@ -14,9 +16,17 @@ use wcf\data\DatabaseObjectEditor;
  * @method             EventListener   getDecoratedObject()
  * @mixin              EventListener
  */
-class EventListenerEditor extends DatabaseObjectEditor {
+class EventListenerEditor extends DatabaseObjectEditor implements IEditableCachedObject {
        /**
         * @inheritDoc
         */
        protected static $baseClass = EventListener::class;
+       
+       /**
+        * @inheritDoc
+        * @since       5.2
+        */
+       public static function resetCache() {
+               EventListenerCacheBuilder::getInstance()->reset();
+       }
 }
index 6c01a438cb5f84c58f5863c857f696f60c1bcbe1..a79a4d663fbb2b086c83ad353078c44cce402491 100644 (file)
@@ -1,6 +1,9 @@
 <?php
 namespace wcf\data\template\listener;
 use wcf\data\DatabaseObjectEditor;
+use wcf\data\IEditableCachedObject;
+use wcf\system\cache\builder\TemplateListenerCodeCacheBuilder;
+use wcf\system\language\LanguageFactory;
 
 /**
  * Provides functions to edit template listeners.
@@ -14,9 +17,20 @@ use wcf\data\DatabaseObjectEditor;
  * @method             TemplateListener        getDecoratedObject()
  * @mixin              TemplateListener
  */
-class TemplateListenerEditor extends DatabaseObjectEditor {
+class TemplateListenerEditor extends DatabaseObjectEditor implements IEditableCachedObject {
        /**
         * @inheritDoc
         */
        protected static $baseClass = TemplateListener::class;
+       
+       /**
+        * @inheritDoc
+        * @since       5.2
+        */
+       public static function resetCache() {
+               TemplateListenerCodeCacheBuilder::getInstance()->reset();
+               
+               // delete compiled templates
+               LanguageFactory::getInstance()->deleteLanguageCache();
+       }
 }
index 0e137d842c53b0cc152993218a81bccb26afdd26..4aa181e9e6163da584a3e88d489903b979190ae5 100644 (file)
@@ -219,6 +219,10 @@ trait TXmlGuiPackageInstallationPlugin {
                else {
                        $xml->write($this->getXmlFileLocation($project));
                }
+               
+               if (is_subclass_of($this->className, IEditableCachedObject::class)) {
+                       call_user_func([$this->className, 'resetCache']);
+               }
        }
        
        /**