-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
[5.3] Fix core update information retrieval after changing the update…
… channel or stability options (#44954)
1 parent
ebaced4
commit 2c859aa
Showing
13 changed files
with
205 additions
and
26 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
administrator/components/com_admin/sql/updates/mysql/5.3.0-2025-02-22.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-- Add plg_extension_joomlaupdate plugin | ||
INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `locked`, `manifest_cache`, `params`, `custom_data`, `ordering`, `state`) VALUES | ||
(0, 'plg_extension_joomlaupdate', 'plugin', 'joomlaupdate', 'extension', 0, 1, 1, 0, 1, '', '', '', 0, 0); |
3 changes: 3 additions & 0 deletions
3
administrator/components/com_admin/sql/updates/postgresql/5.3.0-2025-02-22.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-- Add plg_extension_joomlaupdate module | ||
INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "locked", "manifest_cache", "params", "custom_data", "ordering", "state") VALUES | ||
(0, 'plg_extension_joomlaupdate', 'plugin', 'joomlaupdate', 'extension', 0, 1, 1, 0, 1, '', '', '', 0, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
; Joomla! Project | ||
; (C) 2025 Open Source Matters, Inc. <https://www.joomla.org> | ||
; License GNU General Public License version 2 or later; see LICENSE.txt | ||
; Note : All ini files need to be saved as UTF-8 | ||
|
||
PLG_EXTENSION_JOOMLAUPDATE="Extension - Joomla! Update" | ||
PLG_EXTENSION_JOOMLAUPDATE_XML_DESCRIPTION="Purges the core updates after release channel changes." |
7 changes: 7 additions & 0 deletions
7
administrator/language/en-GB/plg_extension_joomlaupdate.sys.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
; Joomla! Project | ||
; (C) 2025 Open Source Matters, Inc. <https://www.joomla.org> | ||
; License GNU General Public License version 2 or later; see LICENSE.txt | ||
; Note : All ini files need to be saved as UTF-8 | ||
|
||
PLG_EXTENSION_JOOMLAUPDATE="Extension - Joomla! Update" | ||
PLG_EXTENSION_JOOMLAUPDATE_XML_DESCRIPTION="Purges the core updates after release channel changes." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<extension type="plugin" group="extension" method="upgrade"> | ||
<name>plg_extension_joomlaupdate</name> | ||
<author>Joomla! Project</author> | ||
<creationDate>2025-02</creationDate> | ||
<copyright>(C) 2025 Open Source Matters, Inc.</copyright> | ||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license> | ||
<authorEmail>admin@joomla.org</authorEmail> | ||
<authorUrl>www.joomla.org</authorUrl> | ||
<version>1.0.0</version> | ||
<description>PLG_EXTENSION_JOOMLAUPDATE_XML_DESCRIPTION</description> | ||
<namespace path="src">Joomla\Plugin\Extension\Joomlaupdate</namespace> | ||
<files> | ||
<folder plugin="joomlaupdate">services</folder> | ||
<folder>src</folder> | ||
</files> | ||
<languages> | ||
<language tag="en-GB">language/en-GB/plg_extension_joomlaupdate.ini</language> | ||
<language tag="en-GB">language/en-GB/plg_extension_joomlaupdate.sys.ini</language> | ||
</languages> | ||
</extension> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
/** | ||
* @package Joomla.Plugin | ||
* @subpackage Extension.joomla | ||
* | ||
* @copyright (C) 2025 Open Source Matters, Inc. <https://www.joomla.org> | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
\defined('_JEXEC') or die; | ||
|
||
use Joomla\CMS\Extension\PluginInterface; | ||
use Joomla\CMS\Factory; | ||
use Joomla\CMS\Plugin\PluginHelper; | ||
use Joomla\DI\Container; | ||
use Joomla\DI\ServiceProviderInterface; | ||
use Joomla\Event\DispatcherInterface; | ||
use Joomla\Plugin\Extension\Joomlaupdate\Extension\Joomlaupdate; | ||
|
||
return new class () implements ServiceProviderInterface { | ||
/** | ||
* Registers the service provider with a DI container. | ||
* | ||
* @param Container $container The DI container. | ||
* | ||
* @return void | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
public function register(Container $container) | ||
{ | ||
$container->set( | ||
PluginInterface::class, | ||
function (Container $container) { | ||
$plugin = new Joomlaupdate( | ||
$container->get(DispatcherInterface::class), | ||
(array) PluginHelper::getPlugin('extension', 'joomlaupdate') | ||
); | ||
|
||
$plugin->setApplication(Factory::getApplication()); | ||
|
||
return $plugin; | ||
} | ||
); | ||
} | ||
}; |
91 changes: 91 additions & 0 deletions
91
plugins/extension/joomlaupdate/src/Extension/Joomlaupdate.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?php | ||
|
||
/** | ||
* @package Joomla.Plugin | ||
* @subpackage Extension.joomla | ||
* | ||
* @copyright (C) 2025 Open Source Matters, Inc. <https://www.joomla.org> | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
namespace Joomla\Plugin\Extension\Joomlaupdate\Extension; | ||
|
||
use Joomla\CMS\Event\Model\AfterSaveEvent; | ||
use Joomla\CMS\Plugin\CMSPlugin; | ||
use Joomla\Component\Joomlaupdate\Administrator\Model\UpdateModel; | ||
use Joomla\Event\SubscriberInterface; | ||
use Joomla\Registry\Registry; | ||
|
||
// phpcs:disable PSR1.Files.SideEffects | ||
\defined('_JEXEC') or die; | ||
// phpcs:enable PSR1.Files.SideEffects | ||
|
||
/** | ||
* The extension plugin for com_joomlaupdate | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
final class Joomlaupdate extends CMSPlugin implements SubscriberInterface | ||
{ | ||
/** | ||
* Load the language file on instantiation. | ||
* | ||
* @var boolean | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
protected $autoloadLanguage = true; | ||
|
||
/** | ||
* Returns an array of events this subscriber will listen to. | ||
* | ||
* @return array | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
public static function getSubscribedEvents(): array | ||
{ | ||
return [ | ||
'onExtensionAfterSave' => 'onExtensionAfterSave', | ||
]; | ||
} | ||
|
||
/** | ||
* After update of an extension | ||
* | ||
* @param AfterSaveEvent $event Event instance. | ||
* | ||
* @return void | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
public function onExtensionAfterSave(AfterSaveEvent $event): void | ||
{ | ||
$context = $event->getContext(); | ||
$item = $event->getItem(); | ||
|
||
if ($context !== 'com_config.component') { | ||
return; | ||
} | ||
|
||
if ($item->element !== 'com_joomlaupdate') { | ||
return; | ||
} | ||
|
||
/** @var UpdateModel $updateModel */ | ||
$updateModel = $this->getApplication()->bootComponent('com_joomlaupdate') | ||
->getMVCFactory()->createModel('Update', 'Administrator', ['ignore_request' => true]); | ||
|
||
if (!$updateModel) { | ||
return; | ||
} | ||
|
||
$params = new Registry($item->params); | ||
|
||
// Apply updated config | ||
$updateModel->applyUpdateSite( | ||
$params->get('updatesource'), | ||
$params->get('customurl'), | ||
); | ||
} | ||
} |