From 45e1091c3bf47375c63a410c38f6d0b5398d502d Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Mon, 24 Jun 2024 14:14:16 +0200 Subject: [PATCH] Revert separate component update and installer script --- .../com_joomlaupdate/joomlaupdate.xml | 5 +- .../components/com_joomlaupdate/script.php | 126 ------------------ .../language/en-GB/com_joomlaupdate.sys.ini | 4 - 3 files changed, 2 insertions(+), 133 deletions(-) delete mode 100644 administrator/components/com_joomlaupdate/script.php diff --git a/administrator/components/com_joomlaupdate/joomlaupdate.xml b/administrator/components/com_joomlaupdate/joomlaupdate.xml index 1a793bac57c43..6c57c2fbb43ef 100644 --- a/administrator/components/com_joomlaupdate/joomlaupdate.xml +++ b/administrator/components/com_joomlaupdate/joomlaupdate.xml @@ -2,14 +2,13 @@ com_joomlaupdate Joomla! Project - 2024-06 + 2021-08 (C) 2012 Open Source Matters, Inc. GNU General Public License version 2 or later; see LICENSE.txt admin@joomla.org www.joomla.org - 5.1.2 + 4.0.3 COM_JOOMLAUPDATE_XML_DESCRIPTION - script.php Joomla\Component\Joomlaupdate js diff --git a/administrator/components/com_joomlaupdate/script.php b/administrator/components/com_joomlaupdate/script.php deleted file mode 100644 index f21941ec56e62..0000000000000 --- a/administrator/components/com_joomlaupdate/script.php +++ /dev/null @@ -1,126 +0,0 @@ - - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -use Joomla\CMS\Application\AdministratorApplication; -use Joomla\CMS\Component\ComponentHelper; -use Joomla\CMS\Installer\InstallerAdapter; -use Joomla\CMS\Installer\InstallerScriptInterface; -use Joomla\CMS\Language\Text; -use Joomla\Database\DatabaseInterface; -use Joomla\DI\Container; -use Joomla\DI\ServiceProviderInterface; - -// phpcs:disable PSR1.Files.SideEffects -\defined('_JEXEC') or die; -// phpcs:enable PSR1.Files.SideEffects - -/** - * Joomla Update Component installer script. - * - * @since __DEPLOY_VERSION__ - * - * @deprecated 5.1.2 will be removed in 6.0 - */ -return new class () implements ServiceProviderInterface { - public function register(Container $container) - { - $container->set( - InstallerScriptInterface::class, - new class ( - $container->get(AdministratorApplication::class), - $container->get(DatabaseInterface::class) - ) implements InstallerScriptInterface { - private AdministratorApplication $app; - private DatabaseInterface $db; - - public function __construct(AdministratorApplication $app, DatabaseInterface $db) - { - $this->app = $app; - $this->db = $db; - } - - public function install(InstallerAdapter $parent): bool - { - return true; - } - - public function update(InstallerAdapter $parent): bool - { - $parent->loadLanguage(JPATH_ADMINISTRATOR . '/languages'); - - // Reset update source from "next" to "default" - try { - $dbChanged = $this->resetUpdateSource(); - } catch (\Throwable $e) { - $this->app->enqueueMessage(Text::_('COM_JOOMLAUPDATE_SCRIPT_CHANGE_UPDATE_SOURCE_FAILED'), 'warning'); - - $dbChanged = false; - } - - // Show message if update source changed - if ($dbChanged) { - $this->app->enqueueMessage(Text::_('COM_JOOMLAUPDATE_SCRIPT_CHANGE_UPDATE_SOURCE_OK'), 'notice'); - } - - return true; - } - - public function uninstall(InstallerAdapter $parent): bool - { - return true; - } - - public function preflight(string $type, InstallerAdapter $parent): bool - { - return true; - } - - public function postflight(string $type, InstallerAdapter $parent): bool - { - return true; - } - - /** - * Reset update source from "next" to "default" - * - * @return boolean true if update source is reset, false if not - * - * @since __DEPLOY_VERSION__ - * @throws \RuntimeException - */ - private function resetUpdateSource() - { - // Get current update source - $params = ComponentHelper::getParams('com_joomlaupdate'); - - // Do nothing if not "next" - if ($params->get('updatesource', 'default') !== 'next') { - return false; - } - - $params->set('updatesource', 'default'); - - $params = $params->toString(); - $query = $this->db->getQuery(true) - ->update($this->db->quoteName('#__extensions')) - ->set($this->db->quoteName('params') . ' = :params') - ->where($this->db->quoteName('type') . ' = ' . $this->db->quote('component')) - ->where($this->db->quoteName('element') . ' = ' . $this->db->quote('com_joomlaupdate')) - ->bind(':params', $params); - - $this->db->setQuery($query); - $this->db->execute(); - - return true; - } - } - ); - } -}; diff --git a/administrator/language/en-GB/com_joomlaupdate.sys.ini b/administrator/language/en-GB/com_joomlaupdate.sys.ini index 62a0864341003..42b51de9d9608 100644 --- a/administrator/language/en-GB/com_joomlaupdate.sys.ini +++ b/administrator/language/en-GB/com_joomlaupdate.sys.ini @@ -8,7 +8,3 @@ COM_JOOMLAUPDATE_DEFAULT_VIEW_DEFAULT_DESC="Check for Joomla! updates and update COM_JOOMLAUPDATE_DEFAULT_VIEW_DEFAULT_TITLE="View Joomla! Updates" COM_JOOMLAUPDATE_JOOMLAUPDATE_VIEW_DISPLAY_BADGE="Display Badge" COM_JOOMLAUPDATE_XML_DESCRIPTION="One-click update to the latest Joomla release." - -; The following two strings are deprecated and will be removed with 6.0. -COM_JOOMLAUPDATE_SCRIPT_CHANGE_UPDATE_SOURCE_FAILED="Failed to reset the update channel from \"Joomla Next\" to \"Default\". Please change it in the Joomla Update Component's options so you don't miss future updates." -COM_JOOMLAUPDATE_SCRIPT_CHANGE_UPDATE_SOURCE_OK="The update channel has been reset from \"Joomla Next\" to \"Default\"."