From a0b1c82d0d972f75c5466914707e31cbdbdaccec Mon Sep 17 00:00:00 2001
From: Shish <shish@shishnet.org>
Date: Fri, 19 Jul 2019 10:25:07 +0100
Subject: [PATCH] function to clear event listeners

---
 core/send_event.php      | 7 +++++++
 ext/ext_manager/main.php | 4 +---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/core/send_event.php b/core/send_event.php
index 6759bf0f..ae2c42f3 100644
--- a/core/send_event.php
+++ b/core/send_event.php
@@ -23,6 +23,13 @@ function _load_event_listeners(): void
     }
 }
 
+function _clear_cached_event_listeners(): void
+{
+    if (file_exists(data_path("cache/shm_event_listeners.php"))) {
+       unlink(data_path("cache/shm_event_listeners.php"));
+    }
+}
+
 function _set_event_listeners(): void
 {
     global $_shm_event_listeners;
diff --git a/ext/ext_manager/main.php b/ext/ext_manager/main.php
index 07bad29c..03ee3bb1 100644
--- a/ext/ext_manager/main.php
+++ b/ext/ext_manager/main.php
@@ -224,8 +224,6 @@ class ExtManager extends Extension
         // when the list of active extensions changes, we can be
         // pretty sure that the list of who reacts to what will
         // change too
-        if (file_exists("data/cache/event_listeners.php")) {
-            unlink("data/cache/event_listeners.php");
-        }
+        _clear_cached_event_listeners();
     }
 }