From 6f99ee765bceb6f7bd0ed332254dfefaf9898506 Mon Sep 17 00:00:00 2001 From: Sonny Le Date: Fri, 1 Nov 2024 14:23:00 +0700 Subject: [PATCH] Fix issue Astroid menu module position resets after updating Astroid #854 --- script.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/script.php b/script.php index 4817fb9b..92e52ff5 100644 --- a/script.php +++ b/script.php @@ -105,14 +105,16 @@ public function installModule($module, $module_dir) $db->setQuery($query); $db->execute(); - $query = $db->getQuery(true); - $query->update('#__modules'); - $query->set($db->quoteName('published') . ' = 1'); - $query->set($db->quoteName('position') . ' = ' . $db->quote('status')); - $query->set($db->quoteName('params') . ' = ' . $db->quote('{"layout":"_:default","moduleclass_sfx":"","style":"0","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":""}')); - $query->where($db->quoteName('module') . ' = ' . $db->quote($module_name)); - $db->setQuery($query); - $db->execute(); + if ($module_name === 'mod_astroid_clear_cache') { + $query = $db->getQuery(true); + $query->update('#__modules'); + $query->set($db->quoteName('published') . ' = 1'); + $query->set($db->quoteName('position') . ' = ' . $db->quote('status')); + $query->set($db->quoteName('params') . ' = ' . $db->quote('{"layout":"_:default","moduleclass_sfx":"","style":"0","module_tag":"div","bootstrap_size":"0","header_tag":"h3","header_class":""}')); + $query->where($db->quoteName('module') . ' = ' . $db->quote($module_name)); + $db->setQuery($query); + $db->execute(); + } // Retrieve ID $query = $db->getQuery(true);