Skip to content

Commit 76b1770

Browse files
committed
https://github.com/joomla/joomla-cms/pull/45644
1 parent afc31d8 commit 76b1770

File tree

51 files changed

+516
-186
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+516
-186
lines changed

CHANGELOG.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
* L Language
2121
* N Note
2222
*/
23-
25.44.7589
23+
__DEPLOY_VERSION__
24+
^ Remove use of deprecated dispatcher from the plugin constructors (related to https://github.com/joomla/joomla-cms/pull/45644). With J4 backward compability
2425
+ Added validation of sql type fields (checker).
2526
+ Added cleanup of obsolete field values
2627
# Fixed incorrect check for 'empty' dates in LinkTable

com_blc/admin/src/Blc/BlcPlugin.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@
2222
use Blc\Component\Blc\Administrator\Traits\BlcExtractTrait;
2323
use Joomla\CMS\Component\ComponentHelper;
2424
use Joomla\CMS\Plugin\CMSPlugin;
25+
use Joomla\Database\DatabaseAwareInterface;
2526
use Joomla\Database\DatabaseAwareTrait;
26-
use Joomla\Event\DispatcherInterface;
2727

28-
abstract class BlcPlugin extends CMSPlugin
28+
29+
abstract class BlcPlugin extends CMSPlugin implements DatabaseAwareInterface
2930
{
3031
use DatabaseAwareTrait;
3132
use BlcExtractTrait; /* for now. This must move to implementations of blcExtractInterface */
@@ -36,9 +37,14 @@ abstract class BlcPlugin extends CMSPlugin
3637
protected $allowLegacyListeners = false;
3738

3839

39-
public function __construct(DispatcherInterface $dispatcher, array $config = [])
40+
public function __construct(array $config = [])
4041
{
41-
parent::__construct($dispatcher, $config);
42+
if (version_compare(JVERSION, '5.0', '>=')) {
43+
parent::__construct($config);
44+
} else {
45+
$dispatcher = Factory::getApplication()->getDispatcher();
46+
parent::__construct($dispatcher, $config);
47+
}
4248
$this->componentConfig = ComponentHelper::getParams('com_blc');
4349
}
4450

plg_blc_category/services/provider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ public function register(Container $container): void
3535
$container->set(
3636
PluginInterface::class,
3737
function (Container $container) {
38-
$dispatcher = $container->get(DispatcherInterface::class); //Joomla 4
38+
3939
$plugin = new BlcPluginActor(
40-
$dispatcher,
40+
4141
(array) PluginHelper::getPlugin('blc', 'category')
4242
);
4343
$plugin->setApplication(Factory::getApplication());

plg_blc_category/src/Extension/BlcPluginActor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ class BlcPluginActor extends BlcPlugin implements SubscriberInterface, BlcExtrac
5050
protected $context = 'com_categories.category';
5151
private $replacedUrls = [];
5252

53-
public function __construct(DispatcherInterface $dispatcher, array $config = [])
53+
public function __construct( array $config = [])
5454
{
55-
parent::__construct($dispatcher, $config);
55+
parent::__construct( $config);
5656
$this->fieldContext = 'com_content.categories'; //why joomla WHY?
5757
$this->__cftConstruct();
5858
}

plg_blc_checker/services/provider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ public function register(Container $container): void
3737
$container->set(
3838
PluginInterface::class,
3939
function (Container $container) {
40-
$dispatcher = $container->get(DispatcherInterface::class);
40+
4141
$plugin = new BlcPluginActor(
42-
$dispatcher,
42+
4343
(array) PluginHelper::getPlugin('blc', 'checker')
4444
);
4545
$plugin->setApplication(Factory::getApplication());

plg_blc_checker/src/Extension/BlcPluginActor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ class BlcPluginActor extends BlcPlugin implements SubscriberInterface, BlcChecke
3131
protected $autoloadLanguage = true;
3232

3333
private const HELPLINK = 'https://brokenlinkchecker.dev/extensions/plg-blc-checker';
34-
public function __construct(DispatcherInterface $dispatcher, array $config = [])
34+
public function __construct( array $config = [])
3535
{
36-
parent::__construct($dispatcher, $config);
36+
parent::__construct( $config);
3737
}
3838

3939
public static function getSubscribedEvents(): array

plg_blc_content/services/provider.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use Joomla\DI\ServiceProviderInterface;
2020
use Joomla\Event\DispatcherInterface;
2121

22-
return new class () implements ServiceProviderInterface {
22+
return new class() implements ServiceProviderInterface {
2323
/**
2424
* Registers the service provider with a DI container.
2525
*
@@ -34,9 +34,7 @@ public function register(Container $container): void
3434
$container->set(
3535
PluginInterface::class,
3636
function (Container $container) {
37-
$dispatcher = $container->get(DispatcherInterface::class); //Joomla 4
3837
$plugin = new BlcPluginActor(
39-
$dispatcher,
4038
(array) PluginHelper::getPlugin('blc', 'content')
4139
);
4240
$plugin->setApplication(Factory::getApplication());

plg_blc_content/src/Extension/BlcPluginActor.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,16 @@ class BlcPluginActor extends BlcPlugin implements SubscriberInterface, BlcExtrac
5555
'image_fulltext' => BlcSetAltInterface::BLC_REPLACE_ALT_YES,
5656
];
5757

58-
public function __construct(DispatcherInterface $dispatcher, array $config = [])
58+
public function __construct(array $config = [])
5959
{
60-
parent::__construct($dispatcher, $config);
60+
61+
if (version_compare(JVERSION, '5.0', '>=')) {
62+
parent::__construct($config);
63+
} else {
64+
$dispatcher = Factory::getApplication()->getDispatcher();
65+
parent::__construct($dispatcher, $config);
66+
}
67+
6168

6269
$this->__cftConstruct();
6370
}

plg_blc_external/services/provider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use Joomla\Database\DatabaseInterface;
1818
use Joomla\DI\Container;
1919
use Joomla\DI\ServiceProviderInterface;
20-
use Joomla\Event\DispatcherInterface;
20+
2121

2222
return new class () implements ServiceProviderInterface {
2323
/**
@@ -35,9 +35,9 @@ public function register(Container $container): void
3535
$container->set(
3636
PluginInterface::class,
3737
function (Container $container) {
38-
$dispatcher = $container->get(DispatcherInterface::class); //Joomla 4
38+
3939
$plugin = new BlcPluginActor(
40-
$dispatcher,
40+
4141
(array) PluginHelper::getPlugin('blc', 'external')
4242
);
4343
$plugin->setApplication(Factory::getApplication());

plg_blc_external/src/Extension/BlcPluginActor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ final class BlcPluginActor extends BlcPlugin implements SubscriberInterface, Blc
5050
* @since 3.5
5151
*/
5252

53-
public function __construct(DispatcherInterface $dispatcher, array $config = [])
53+
public function __construct( array $config = [])
5454
{
55-
parent::__construct($dispatcher, $config);
55+
parent::__construct( $config);
5656
$this->setRecheck();
5757
}
5858

0 commit comments

Comments
 (0)