diff --git a/administrator/components/com_joomlaupdate/finalisation.php b/administrator/components/com_joomlaupdate/finalisation.php index d690a54b42fa5..8319203fca08e 100644 --- a/administrator/components/com_joomlaupdate/finalisation.php +++ b/administrator/components/com_joomlaupdate/finalisation.php @@ -75,6 +75,17 @@ function finalizeUpdate(string $siteRoot, string $restorePath): void { (new JoomlaInstallerScript)->deleteUnexistingFiles(); } + + /** + * Remove autoload_psr4.php so that namespace map is re-generated on the next request. This is needed + * when there are new classes added to extensions on new Joomla! release. + */ + $namespaceMapFile = JPATH_ROOT . '/administrator/cache/autoload_psr4.php'; + + if (\Joomla\CMS\Filesystem\File::exists($namespaceMapFile)) + { + \Joomla\CMS\Filesystem\File::delete($namespaceMapFile); + } } } } diff --git a/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php b/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php index eb56123114a48..da11c325c4ffc 100644 --- a/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php +++ b/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php @@ -690,9 +690,6 @@ public function finaliseUpgrade() return false; } - // Re-create namespace map. It is needed when updating to a Joomla! version has new extension added - (new \JNamespacePsr4Map)->create(); - $installer->manifest = $manifest; $installer->setUpgrade(true);