diff --git a/administrator/components/com_installer/controllers/install.php b/administrator/components/com_installer/controllers/install.php index 9334a83800781..8289990361a2e 100644 --- a/administrator/components/com_installer/controllers/install.php +++ b/administrator/components/com_installer/controllers/install.php @@ -28,15 +28,11 @@ public function install() // Check for request forgeries. JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + /** @var InstallerModelInstall $model */ $model = $this->getModel('install'); - if ($result = $model->install()) - { - $cache = JFactory::getCache('mod_menu'); - $cache->clean(); - - // TODO: Reset the users acl here as well to kill off any missing bits. - } + // TODO: Reset the users acl here as well to kill off any missing bits. + $result = $model->install(); $app = JFactory::getApplication(); $redirect_url = $app->getUserState('com_installer.redirect_url'); diff --git a/administrator/components/com_installer/controllers/manage.php b/administrator/components/com_installer/controllers/manage.php index af9df3f34e942..e4f01a2ca237e 100644 --- a/administrator/components/com_installer/controllers/manage.php +++ b/administrator/components/com_installer/controllers/manage.php @@ -58,6 +58,7 @@ public function publish() else { // Get the model. + /** @var InstallerModelManage $model */ $model = $this->getModel('manage'); // Change the state of the records. @@ -95,7 +96,9 @@ public function remove() // Check for request forgeries. JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); - $eid = $this->input->get('cid', array(), 'array'); + $eid = $this->input->get('cid', array(), 'array'); + + /** @var InstallerModelManage $model */ $model = $this->getModel('manage'); $eid = ArrayHelper::toInteger($eid, array()); diff --git a/administrator/components/com_installer/controllers/update.php b/administrator/components/com_installer/controllers/update.php index a3b541c07a6ef..c691e5c144de1 100644 --- a/administrator/components/com_installer/controllers/update.php +++ b/administrator/components/com_installer/controllers/update.php @@ -43,11 +43,6 @@ public function update() $model->update($uid, $minimum_stability); - if ($model->getState('result', false)) - { - JFactory::getCache('mod_menu')->clean(); - } - $app = JFactory::getApplication(); $redirect_url = $app->getUserState('com_installer.redirect_url'); diff --git a/administrator/components/com_installer/models/install.php b/administrator/components/com_installer/models/install.php index feda297cf1280..539730ae91198 100644 --- a/administrator/components/com_installer/models/install.php +++ b/administrator/components/com_installer/models/install.php @@ -220,6 +220,16 @@ public function install() JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']); + // Clear the cached extension data and menu cache + $this->cleanCache('_system', 0); + $this->cleanCache('_system', 1); + $this->cleanCache('com_modules', 0); + $this->cleanCache('com_modules', 1); + $this->cleanCache('com_plugins', 0); + $this->cleanCache('com_plugins', 1); + $this->cleanCache('mod_menu', 0); + $this->cleanCache('mod_menu', 1); + return $result; } diff --git a/administrator/components/com_installer/models/manage.php b/administrator/components/com_installer/models/manage.php index 18ccb15b9e987..f6f6f492ecd3a 100644 --- a/administrator/components/com_installer/models/manage.php +++ b/administrator/components/com_installer/models/manage.php @@ -146,6 +146,14 @@ public function publish(&$eid = array(), $value = 1) } } + // Clear the cached extension data and menu cache + $this->cleanCache('_system', 0); + $this->cleanCache('_system', 1); + $this->cleanCache('com_modules', 0); + $this->cleanCache('com_modules', 1); + $this->cleanCache('mod_menu', 0); + $this->cleanCache('mod_menu', 1); + return $result; } @@ -261,6 +269,16 @@ public function remove($eid = array()) $app->setUserState('com_installer.message', $installer->message); $app->setUserState('com_installer.extension_message', $installer->get('extension_message')); + // Clear the cached extension data and menu cache + $this->cleanCache('_system', 0); + $this->cleanCache('_system', 1); + $this->cleanCache('com_modules', 0); + $this->cleanCache('com_modules', 1); + $this->cleanCache('com_plugins', 0); + $this->cleanCache('com_plugins', 1); + $this->cleanCache('mod_menu', 0); + $this->cleanCache('mod_menu', 1); + return $result; } diff --git a/administrator/components/com_installer/models/update.php b/administrator/components/com_installer/models/update.php index 368b48101cb37..15e5113b61126 100644 --- a/administrator/components/com_installer/models/update.php +++ b/administrator/components/com_installer/models/update.php @@ -371,6 +371,16 @@ public function update($uids, $minimum_stability = JUpdater::STABILITY_STABLE) $result = $res & $result; } + // Clear the cached extension data and menu cache + $this->cleanCache('_system', 0); + $this->cleanCache('_system', 1); + $this->cleanCache('com_modules', 0); + $this->cleanCache('com_modules', 1); + $this->cleanCache('com_plugins', 0); + $this->cleanCache('com_plugins', 1); + $this->cleanCache('mod_menu', 0); + $this->cleanCache('mod_menu', 1); + // Set the final state $this->setState('result', $result); } @@ -525,7 +535,7 @@ protected function loadFormData() protected function preparePreUpdate($update, $table) { jimport('joomla.filesystem.file'); - + switch ($table->type) { // Components could have a helper which adds additional data @@ -535,11 +545,11 @@ protected function preparePreUpdate($update, $table) $cname = ucfirst($ename) . 'Helper'; $path = JPATH_ADMINISTRATOR . '/components/' . $table->element . '/helpers/' . $fname; - + if (JFile::exists($path)) { require_once $path; - + if (class_exists($cname) && is_callable(array($cname, 'prepareUpdate'))) { call_user_func_array(array($cname, 'prepareUpdate'), array(&$update, &$table)); @@ -552,19 +562,19 @@ protected function preparePreUpdate($update, $table) case 'module': $cname = str_replace('_', '', $table->element) . 'Helper'; $path = ($table->client_id ? JPATH_ADMINISTRATOR : JPATH_SITE) . '/modules/' . $table->element . '/helper.php'; - + if (JFile::exists($path)) { require_once $path; - + if (class_exists($cname) && is_callable(array($cname, 'prepareUpdate'))) { call_user_func_array(array($cname, 'prepareUpdate'), array(&$update, &$table)); } } - + break; - + // If we have a plugin, we can use the plugin trigger "onInstallerBeforePackageDownload" // But we should make sure, that our plugin is loaded, so we don't need a second "installer" plugin case 'plugin': diff --git a/administrator/components/com_menus/models/item.php b/administrator/components/com_menus/models/item.php index 6bf4ec2be359e..90410cd62f65d 100644 --- a/administrator/components/com_menus/models/item.php +++ b/administrator/components/com_menus/models/item.php @@ -1747,6 +1747,7 @@ protected function cleanCache($group = null, $client_id = 0) { parent::cleanCache('com_menus', 0); parent::cleanCache('com_modules'); - parent::cleanCache('mod_menu'); + parent::cleanCache('mod_menu', 0); + parent::cleanCache('mod_menu', 1); } } diff --git a/administrator/components/com_menus/models/menu.php b/administrator/components/com_menus/models/menu.php index 20c89465b7694..4e40104c64b19 100644 --- a/administrator/components/com_menus/models/menu.php +++ b/administrator/components/com_menus/models/menu.php @@ -352,6 +352,7 @@ protected function cleanCache($group = null, $client_id = 0) { parent::cleanCache('com_menus', 0); parent::cleanCache('com_modules'); - parent::cleanCache('mod_menu'); + parent::cleanCache('mod_menu', 0); + parent::cleanCache('mod_menu', 1); } }