Skip to content

Commit 1dd5bfc

Browse files
authored
[5.4] Add compat6 behaviour plugin to 5.4 so it is available and enabled when updating to 6.x. (joomla#45371)
* Add compat6 behaviour plugin stub to 5.4 * Rename Compat.php to Compat6.php * Remove classes folder from compat6.xml
1 parent 3b81263 commit 1dd5bfc

File tree

10 files changed

+132
-4
lines changed

10 files changed

+132
-4
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `locked`, `manifest_cache`, `params`, `custom_data`, `ordering`, `state`) VALUES
2+
(0, 'plg_behaviour_compat6', 'plugin', 'compat6', 'behaviour', 0, 1, 1, 0, 1, '', '{}', '', -1, 0);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "locked", "manifest_cache", "params", "custom_data", "ordering", "state") VALUES
2+
(0, 'plg_behaviour_compat6', 'plugin', 'compat6', 'behaviour', 0, 1, 1, 0, 1, '', '{}', '', -1, 0);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
; Joomla! Project
2+
; (C) 2025 Open Source Matters, Inc. <https://www.joomla.org>
3+
; License GNU General Public License version 2 or later; see LICENSE.txt
4+
; Note : All ini files need to be saved as UTF-8
5+
6+
PLG_BEHAVIOUR_COMPAT6="Behaviour - Backward Compatibility 6"
7+
PLG_COMPAT6_XML_DESCRIPTION="This plugin should be enabled before updating to Joomla 6."
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
; Joomla! Project
2+
; (C) 2025 Open Source Matters, Inc. <https://www.joomla.org>
3+
; License GNU General Public License version 2 or later; see LICENSE.txt
4+
; Note : All ini files need to be saved as UTF-8
5+
6+
PLG_BEHAVIOUR_COMPAT6="Behaviour - Backward Compatibility 6"
7+
PLG_COMPAT6_XML_DESCRIPTION="This plugin should be enabled before updating to Joomla 6."

installation/sql/mysql/base.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,9 @@ INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`,
263263
(0, 'plg_authentication_joomla', 'plugin', 'joomla', 'authentication', 0, 1, 1, 1, 1, '', '', '', 2, 0),
264264
(0, 'plg_authentication_ldap', 'plugin', 'ldap', 'authentication', 0, 0, 1, 0, 1, '', '{"host":"","port":"389","use_ldapV3":"0","negotiate_tls":"0","no_referrals":"0","auth_method":"bind","base_dn":"","search_string":"","users_dn":"","username":"admin","password":"bobby7","ldap_fullname":"fullName","ldap_email":"mail","ldap_uid":"uid"}', '', 3, 0),
265265
(0, 'plg_behaviour_compat', 'plugin', 'compat', 'behaviour', 0, 1, 1, 0, 1, '', '{"classes_aliases":"1","es5_assets":"1"}', '', 1, 0),
266-
(0, 'plg_behaviour_taggable', 'plugin', 'taggable', 'behaviour', 0, 1, 1, 0, 1, '', '{}', '', 2, 0),
267-
(0, 'plg_behaviour_versionable', 'plugin', 'versionable', 'behaviour', 0, 1, 1, 0, 1, '', '{}', '', 3, 0),
266+
(0, 'plg_behaviour_compat6', 'plugin', 'compat6', 'behaviour', 0, 1, 1, 0, 1, '', '{}', '', 2, 0),
267+
(0, 'plg_behaviour_taggable', 'plugin', 'taggable', 'behaviour', 0, 1, 1, 0, 1, '', '{}', '', 3, 0),
268+
(0, 'plg_behaviour_versionable', 'plugin', 'versionable', 'behaviour', 0, 1, 1, 0, 1, '', '{}', '', 4, 0),
268269
(0, 'plg_content_confirmconsent', 'plugin', 'confirmconsent', 'content', 0, 0, 1, 0, 1, '', '{}', '', 1, 0),
269270
(0, 'plg_content_contact', 'plugin', 'contact', 'content', 0, 1, 1, 0, 1, '', '', '', 2, 0),
270271
(0, 'plg_content_emailcloak', 'plugin', 'emailcloak', 'content', 0, 1, 1, 0, 1, '', '{"mode":"1"}', '', 3, 0),

installation/sql/postgresql/base.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,9 @@ INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder",
269269
(0, 'plg_authentication_joomla', 'plugin', 'joomla', 'authentication', 0, 1, 1, 1, 1, '', '', '', 2, 0),
270270
(0, 'plg_authentication_ldap', 'plugin', 'ldap', 'authentication', 0, 0, 1, 0, 1, '', '{"host":"","port":"389","use_ldapV3":"0","negotiate_tls":"0","no_referrals":"0","auth_method":"bind","base_dn":"","search_string":"","users_dn":"","username":"admin","password":"bobby7","ldap_fullname":"fullName","ldap_email":"mail","ldap_uid":"uid"}', '', 3, 0),
271271
(0, 'plg_behaviour_compat', 'plugin', 'compat', 'behaviour', 0, 1, 1, 0, 1, '', '{"classes_aliases":"1","es5_assets":"1"}', '', 1, 0),
272-
(0, 'plg_behaviour_taggable', 'plugin', 'taggable', 'behaviour', 0, 1, 1, 0, 1, '', '{}', '', 2, 0),
273-
(0, 'plg_behaviour_versionable', 'plugin', 'versionable', 'behaviour', 0, 1, 1, 0, 1, '', '{}', '', 3, 0),
272+
(0, 'plg_behaviour_compat6', 'plugin', 'compat6', 'behaviour', 0, 1, 1, 0, 1, '', '{}', '', 2, 0),
273+
(0, 'plg_behaviour_taggable', 'plugin', 'taggable', 'behaviour', 0, 1, 1, 0, 1, '', '{}', '', 3, 0),
274+
(0, 'plg_behaviour_versionable', 'plugin', 'versionable', 'behaviour', 0, 1, 1, 0, 1, '', '{}', '', 4, 0),
274275
(0, 'plg_content_confirmconsent', 'plugin', 'confirmconsent', 'content', 0, 0, 1, 0, 1, '', '{}', '', 1, 0),
275276
(0, 'plg_content_contact', 'plugin', 'contact', 'content', 0, 1, 1, 0, 1, '', '', '', 2, 0),
276277
(0, 'plg_content_emailcloak', 'plugin', 'emailcloak', 'content', 0, 1, 1, 0, 1, '', '{"mode":"1"}', '', 3, 0),

libraries/src/Extension/ExtensionHelper.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ class ExtensionHelper
174174

175175
// Core plugin extensions - behaviour
176176
['plugin', 'compat', 'behaviour', 0],
177+
['plugin', 'compat6', 'behaviour', 0],
177178
['plugin', 'taggable', 'behaviour', 0],
178179
['plugin', 'versionable', 'behaviour', 0],
179180

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<extension type="plugin" group="behaviour" method="upgrade">
3+
<name>plg_behaviour_compat6</name>
4+
<author>Joomla! Project</author>
5+
<creationDate>2025-04</creationDate>
6+
<copyright>(C) 2025 Open Source Matters, Inc.</copyright>
7+
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
8+
<authorEmail>[email protected]</authorEmail>
9+
<authorUrl>www.joomla.org</authorUrl>
10+
<version>5.4.0</version>
11+
<description>PLG_COMPAT6_XML_DESCRIPTION</description>
12+
<namespace path="src">Joomla\Plugin\Behaviour\Compat6</namespace>
13+
<files>
14+
<folder plugin="compat6">services</folder>
15+
<folder>src</folder>
16+
</files>
17+
<languages>
18+
<language tag="en-GB">language/en-GB/plg_behaviour_compat6.ini</language>
19+
<language tag="en-GB">language/en-GB/plg_behaviour_compat6.sys.ini</language>
20+
</languages>
21+
</extension>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
/**
4+
* @package Joomla.Plugin
5+
* @subpackage Behaviour.compat6
6+
*
7+
* @copyright (C) 2025 Open Source Matters, Inc. <https://www.joomla.org>
8+
* @license GNU General Public License version 2 or later; see LICENSE.txt
9+
*/
10+
11+
\defined('_JEXEC') or die;
12+
13+
use Joomla\CMS\Extension\PluginInterface;
14+
use Joomla\CMS\Factory;
15+
use Joomla\CMS\Plugin\PluginHelper;
16+
use Joomla\DI\Container;
17+
use Joomla\DI\ServiceProviderInterface;
18+
use Joomla\Event\DispatcherInterface;
19+
use Joomla\Plugin\Behaviour\Compat6\Extension\Compat6;
20+
21+
return new class () implements ServiceProviderInterface {
22+
/**
23+
* Registers the service provider with a DI container.
24+
*
25+
* @param Container $container The DI container.
26+
*
27+
* @return void
28+
* @since 5.4.0
29+
*/
30+
public function register(Container $container)
31+
{
32+
$container->set(
33+
PluginInterface::class,
34+
function (Container $container) {
35+
$plugin = PluginHelper::getPlugin('behaviour', 'compat6');
36+
$dispatcher = $container->get(DispatcherInterface::class);
37+
38+
$plugin = new Compat6($dispatcher, (array) $plugin);
39+
$plugin->setApplication(Factory::getApplication());
40+
41+
return $plugin;
42+
}
43+
);
44+
}
45+
};
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
/**
4+
* @package Joomla.Plugin
5+
* @subpackage Behaviour.compat6
6+
*
7+
* @copyright (C) 2025 Open Source Matters, Inc. <https://www.joomla.org>
8+
* @license GNU General Public License version 2 or later; see LICENSE.txt
9+
*/
10+
11+
namespace Joomla\Plugin\Behaviour\Compat6\Extension;
12+
13+
use Joomla\CMS\Plugin\CMSPlugin;
14+
use Joomla\Event\SubscriberInterface;
15+
16+
// phpcs:disable PSR1.Files.SideEffects
17+
\defined('_JEXEC') or die;
18+
// phpcs:enable PSR1.Files.SideEffects
19+
20+
/**
21+
* Joomla! Compat6 Plugin.
22+
*
23+
* @since 5.4.0
24+
*/
25+
final class Compat6 extends CMSPlugin implements SubscriberInterface
26+
{
27+
/**
28+
* Returns an array of CMS events this plugin will listen to and the respective handlers.
29+
*
30+
* @return array
31+
*
32+
* @since 5.4.0
33+
*/
34+
public static function getSubscribedEvents(): array
35+
{
36+
/**
37+
* This plugin does not listen to any events.
38+
*/
39+
return [];
40+
}
41+
}

0 commit comments

Comments
 (0)