From c8d4e7d186d70df2306b4d5791922cfa2f1887f1 Mon Sep 17 00:00:00 2001 From: slawkens Date: Sat, 27 Jan 2024 14:15:42 +0100 Subject: [PATCH] Auto clear old menu entries on install --- system/src/Plugins.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/system/src/Plugins.php b/system/src/Plugins.php index 57612db2..d30a2497 100644 --- a/system/src/Plugins.php +++ b/system/src/Plugins.php @@ -712,17 +712,15 @@ class Plugins { * @param string $templateName * @param array $categories */ - public static function installMenus($templateName, $categories) + public static function installMenus($templateName, $categories, $clearOld = true) { global $db; if (!$db->hasTable(TABLE_PREFIX . 'menu')) { return; } - // check if menus already exist - $menuInstalled = Menu::where('template', $templateName)->select('id')->first(); - if ($menuInstalled) { - return; + if ($clearOld) { + Menu::where('template', $templateName)->delete(); } foreach ($categories as $category => $menus) {