diff --git a/administrator/components/com_installer/src/Model/InstallModel.php b/administrator/components/com_installer/src/Model/InstallModel.php
index efe20b3431393..73a17c58959a1 100644
--- a/administrator/components/com_installer/src/Model/InstallModel.php
+++ b/administrator/components/com_installer/src/Model/InstallModel.php
@@ -10,6 +10,9 @@
namespace Joomla\Component\Installer\Administrator\Model;
+use Joomla\CMS\Event\Installer\AfterInstallerEvent;
+use Joomla\CMS\Event\Installer\BeforeInstallationEvent;
+use Joomla\CMS\Event\Installer\BeforeInstallerEvent;
use Joomla\CMS\Factory;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Installer\Installer;
@@ -82,16 +85,22 @@ public function install()
{
$this->setState('action', 'install');
- $app = Factory::getApplication();
+ $app = Factory::getApplication();
+ $dispatcher = $this->getDispatcher();
// Load installer plugins for assistance if required:
- PluginHelper::importPlugin('installer');
+ PluginHelper::importPlugin('installer', null, true, $dispatcher);
$package = null;
// This event allows an input pre-treatment, a custom pre-packing or custom installation.
// (e.g. from a \JSON description).
- $results = $app->triggerEvent('onInstallerBeforeInstallation', [$this, &$package]);
+ $eventBefore = new BeforeInstallationEvent('onInstallerBeforeInstallation', [
+ 'subject' => $this,
+ 'package' => &$package, // TODO: Remove reference in Joomla 6, see InstallerEvent::__constructor()
+ ]);
+ $results = $dispatcher->dispatch('onInstallerBeforeInstallation', $eventBefore)->getArgument('result', []);
+ $package = $eventBefore->getPackage();
if (in_array(true, $results, true)) {
return true;
@@ -128,7 +137,12 @@ public function install()
}
// This event allows a custom installation of the package or a customization of the package:
- $results = $app->triggerEvent('onInstallerBeforeInstaller', [$this, &$package]);
+ $eventBeforeInst = new BeforeInstallerEvent('onInstallerBeforeInstaller', [
+ 'subject' => $this,
+ 'package' => &$package, // TODO: Remove reference in Joomla 6, see InstallerEvent::__constructor()
+ ]);
+ $results = $dispatcher->dispatch('onInstallerBeforeInstaller', $eventBeforeInst)->getArgument('result', []);
+ $package = $eventBeforeInst->getPackage();
if (in_array(true, $results, true)) {
return true;
@@ -205,7 +219,17 @@ public function install()
}
// This event allows a custom a post-flight:
- $app->triggerEvent('onInstallerAfterInstaller', [$this, &$package, $installer, &$result, &$msg]);
+ $eventAfterInst = new AfterInstallerEvent('onInstallerAfterInstaller', [
+ 'subject' => $this,
+ 'package' => &$package, // TODO: Remove reference in Joomla 6, see InstallerEvent::__constructor()
+ 'installer' => $installer,
+ 'installerResult' => &$result, // TODO: Remove reference in Joomla 6, see AfterInstallerEvent::__constructor()
+ 'message' => &$msg, // TODO: Remove reference in Joomla 6, see AfterInstallerEvent::__constructor()
+ ]);
+ $dispatcher->dispatch('onInstallerAfterInstaller', $eventAfterInst);
+ $package = $eventAfterInst->getPackage();
+ $result = $eventAfterInst->getInstallerResult();
+ $msg = $eventAfterInst->getMessage();
// Set some model state values.
$app->enqueueMessage($msg, $msgType);
diff --git a/administrator/components/com_installer/tmpl/install/default.php b/administrator/components/com_installer/tmpl/install/default.php
index 1c2b115aa7477..965be5cd1a8ce 100644
--- a/administrator/components/com_installer/tmpl/install/default.php
+++ b/administrator/components/com_installer/tmpl/install/default.php
@@ -10,6 +10,7 @@
defined('_JEXEC') or die;
+use Joomla\CMS\Event\Installer\AddInstallationTabEvent;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
@@ -29,8 +30,9 @@
->usePreset('com_installer.installer')
->useScript('webcomponent.core-loader');
-$app = Factory::getApplication();
-$tabs = $app->triggerEvent('onInstallerAddInstallationTab', []);
+$tabs = Factory::getApplication()->getDispatcher()
+ ->dispatch('onInstallerAddInstallationTab', new AddInstallationTabEvent('onInstallerAddInstallationTab', []))
+ ->getArgument('result', []);
?>
diff --git a/libraries/src/Event/CoreEventAware.php b/libraries/src/Event/CoreEventAware.php
index 3cb34e6f9e85b..2997c027f1e7d 100644
--- a/libraries/src/Event/CoreEventAware.php
+++ b/libraries/src/Event/CoreEventAware.php
@@ -153,7 +153,7 @@ trait CoreEventAware
'onPrepareModuleList' => Module\PrepareModuleListEvent::class,
'onAfterModuleList' => Module\AfterModuleListEvent::class,
'onAfterCleanModuleList' => Module\AfterCleanModuleListEvent::class,
- // Extension and Installer
+ // Extension
'onExtensionBeforeInstall' => Extension\BeforeInstallEvent::class,
'onExtensionAfterInstall' => Extension\AfterInstallEvent::class,
'onExtensionBeforeUninstall' => Extension\BeforeUninstallEvent::class,
@@ -163,6 +163,12 @@ trait CoreEventAware
'onExtensionBeforeSave' => Model\BeforeSaveEvent::class,
'onExtensionAfterSave' => Model\AfterSaveEvent::class,
'onExtensionAfterDelete' => Model\AfterDeleteEvent::class,
+ // Installer
+ 'onInstallerAddInstallationTab' => Installer\AddInstallationTabEvent::class,
+ 'onInstallerBeforeInstallation' => Installer\BeforeInstallationEvent::class,
+ 'onInstallerBeforeInstaller' => Installer\BeforeInstallerEvent::class,
+ 'onInstallerAfterInstaller' => Installer\AfterInstallerEvent::class,
+ 'onInstallerBeforePackageDownload' => Installer\BeforePackageDownloadEvent::class,
// Finder
'onFinderCategoryChangeState' => Finder\AfterCategoryChangeStateEvent::class,
'onFinderChangeState' => Finder\AfterChangeStateEvent::class,
diff --git a/libraries/src/Event/Installer/AddInstallationTabEvent.php b/libraries/src/Event/Installer/AddInstallationTabEvent.php
new file mode 100644
index 0000000000000..c033b14e81e85
--- /dev/null
+++ b/libraries/src/Event/Installer/AddInstallationTabEvent.php
@@ -0,0 +1,30 @@
+
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+namespace Joomla\CMS\Event\Installer;
+
+use Joomla\CMS\Event\AbstractImmutableEvent;
+use Joomla\CMS\Event\Result\ResultAware;
+use Joomla\CMS\Event\Result\ResultAwareInterface;
+use Joomla\CMS\Event\Result\ResultTypeArrayAware;
+
+// phpcs:disable PSR1.Files.SideEffects
+\defined('_JEXEC') or die;
+// phpcs:enable PSR1.Files.SideEffects
+
+/**
+ * Class for Installer events
+ *
+ * @since __DEPLOY_VERSION__
+ */
+class AddInstallationTabEvent extends AbstractImmutableEvent implements ResultAwareInterface
+{
+ use ResultAware;
+ use ResultTypeArrayAware;
+}
diff --git a/libraries/src/Event/Installer/AfterInstallerEvent.php b/libraries/src/Event/Installer/AfterInstallerEvent.php
new file mode 100644
index 0000000000000..fcef2d512d455
--- /dev/null
+++ b/libraries/src/Event/Installer/AfterInstallerEvent.php
@@ -0,0 +1,182 @@
+
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+namespace Joomla\CMS\Event\Installer;
+
+use Joomla\CMS\Installer\Installer as ExtensionInstaller;
+
+// phpcs:disable PSR1.Files.SideEffects
+\defined('_JEXEC') or die;
+// phpcs:enable PSR1.Files.SideEffects
+
+/**
+ * Class for Installer events
+ *
+ * @since __DEPLOY_VERSION__
+ */
+class AfterInstallerEvent extends InstallerEvent
+{
+ /**
+ * The argument names, in order expected by legacy plugins.
+ *
+ * @var array
+ *
+ * @since __DEPLOY_VERSION__
+ * @deprecated 5.0 will be removed in 6.0
+ */
+ protected $legacyArgumentsOrder = ['subject', 'package', 'installer', 'installerResult', 'message'];
+
+ /**
+ * Constructor.
+ *
+ * @param string $name The event name.
+ * @param array $arguments The event arguments.
+ *
+ * @throws \BadMethodCallException
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function __construct($name, array $arguments = [])
+ {
+ parent::__construct($name, $arguments);
+
+ if (!\array_key_exists('installer', $this->arguments)) {
+ throw new \BadMethodCallException("Argument 'installer' of event {$name} is required but has not been provided");
+ }
+
+ if (!\array_key_exists('installerResult', $this->arguments)) {
+ throw new \BadMethodCallException("Argument 'installerResult' of event {$name} is required but has not been provided");
+ }
+
+ if (!\array_key_exists('message', $this->arguments)) {
+ throw new \BadMethodCallException("Argument 'message' of event {$name} is required but has not been provided");
+ }
+
+ // For backward compatibility make sure the values is referenced
+ // TODO: Remove in Joomla 6
+ // @deprecated: Passing argument by reference is deprecated, and will not work in Joomla 6
+ if (key($arguments) === 0) {
+ $this->arguments['installerResult'] = &$arguments[3];
+ $this->arguments['message'] = &$arguments[4];
+ } elseif (\array_key_exists('installerResult', $arguments)) {
+ $this->arguments['installerResult'] = &$arguments['installerResult'];
+ $this->arguments['message'] = &$arguments['message'];
+ }
+ }
+
+ /**
+ * Setter for the installer argument.
+ *
+ * @param ExtensionInstaller $value The value to set
+ *
+ * @return ExtensionInstaller
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ protected function setInstaller(ExtensionInstaller $value): ExtensionInstaller
+ {
+ return $value;
+ }
+
+ /**
+ * Setter for the installerResult argument.
+ *
+ * @param bool $value The value to set
+ *
+ * @return bool
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ protected function setInstallerResult(bool $value): bool
+ {
+ return $value;
+ }
+
+ /**
+ * Setter for the message argument.
+ *
+ * @param string $value The value to set
+ *
+ * @return string
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ protected function setMessage(string $value): string
+ {
+ return $value;
+ }
+
+ /**
+ * Getter for the installer.
+ *
+ * @return ExtensionInstaller
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function getInstaller(): ExtensionInstaller
+ {
+ return $this->arguments['installer'];
+ }
+
+ /**
+ * Getter for the installer result.
+ *
+ * @return bool
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function getInstallerResult(): bool
+ {
+ return $this->arguments['installerResult'];
+ }
+
+ /**
+ * Getter for the message.
+ *
+ * @return string
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function getMessage(): string
+ {
+ return $this->arguments['message'];
+ }
+
+ /**
+ * Update the installerResult.
+ *
+ * @param bool $value The value to set
+ *
+ * @return static
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function updateInstallerResult(bool $value): static
+ {
+ $this->arguments['installerResult'] = $value;
+
+ return $this;
+ }
+
+ /**
+ * Update the message.
+ *
+ * @param string $value The value to set
+ *
+ * @return static
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function updateMessage(string $value): static
+ {
+ $this->arguments['message'] = $value;
+
+ return $this;
+ }
+}
diff --git a/libraries/src/Event/Installer/BeforeInstallationEvent.php b/libraries/src/Event/Installer/BeforeInstallationEvent.php
new file mode 100644
index 0000000000000..0c60014928ef0
--- /dev/null
+++ b/libraries/src/Event/Installer/BeforeInstallationEvent.php
@@ -0,0 +1,29 @@
+
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+namespace Joomla\CMS\Event\Installer;
+
+use Joomla\CMS\Event\Result\ResultAware;
+use Joomla\CMS\Event\Result\ResultAwareInterface;
+use Joomla\CMS\Event\Result\ResultTypeBooleanAware;
+
+// phpcs:disable PSR1.Files.SideEffects
+\defined('_JEXEC') or die;
+// phpcs:enable PSR1.Files.SideEffects
+
+/**
+ * Class for Installer events
+ *
+ * @since __DEPLOY_VERSION__
+ */
+class BeforeInstallationEvent extends InstallerEvent implements ResultAwareInterface
+{
+ use ResultAware;
+ use ResultTypeBooleanAware;
+}
diff --git a/libraries/src/Event/Installer/BeforeInstallerEvent.php b/libraries/src/Event/Installer/BeforeInstallerEvent.php
new file mode 100644
index 0000000000000..a2ed8293650b3
--- /dev/null
+++ b/libraries/src/Event/Installer/BeforeInstallerEvent.php
@@ -0,0 +1,29 @@
+
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+namespace Joomla\CMS\Event\Installer;
+
+use Joomla\CMS\Event\Result\ResultAware;
+use Joomla\CMS\Event\Result\ResultAwareInterface;
+use Joomla\CMS\Event\Result\ResultTypeBooleanAware;
+
+// phpcs:disable PSR1.Files.SideEffects
+\defined('_JEXEC') or die;
+// phpcs:enable PSR1.Files.SideEffects
+
+/**
+ * Class for Installer events
+ *
+ * @since __DEPLOY_VERSION__
+ */
+class BeforeInstallerEvent extends InstallerEvent implements ResultAwareInterface
+{
+ use ResultAware;
+ use ResultTypeBooleanAware;
+}
diff --git a/libraries/src/Event/Installer/BeforePackageDownloadEvent.php b/libraries/src/Event/Installer/BeforePackageDownloadEvent.php
new file mode 100644
index 0000000000000..7914abd57799e
--- /dev/null
+++ b/libraries/src/Event/Installer/BeforePackageDownloadEvent.php
@@ -0,0 +1,143 @@
+
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+namespace Joomla\CMS\Event\Installer;
+
+use Joomla\CMS\Event\AbstractImmutableEvent;
+use Joomla\CMS\Event\ReshapeArgumentsAware;
+
+// phpcs:disable PSR1.Files.SideEffects
+\defined('_JEXEC') or die;
+// phpcs:enable PSR1.Files.SideEffects
+
+/**
+ * Class for Installer events
+ *
+ * @since __DEPLOY_VERSION__
+ */
+class BeforePackageDownloadEvent extends AbstractImmutableEvent
+{
+ use ReshapeArgumentsAware;
+
+ /**
+ * The argument names, in order expected by legacy plugins.
+ *
+ * @var array
+ *
+ * @since __DEPLOY_VERSION__
+ * @deprecated 5.0 will be removed in 6.0
+ */
+ protected $legacyArgumentsOrder = ['url', 'headers'];
+
+ /**
+ * Constructor.
+ *
+ * @param string $name The event name.
+ * @param array $arguments The event arguments.
+ *
+ * @throws \BadMethodCallException
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function __construct($name, array $arguments = [])
+ {
+ // Reshape the arguments array to preserve b/c with legacy listeners
+ // Do not override existing $arguments in place, or it will break references!
+ if ($this->legacyArgumentsOrder) {
+ parent::__construct($name, $this->reshapeArguments($arguments, $this->legacyArgumentsOrder));
+ } else {
+ parent::__construct($name, $arguments);
+ }
+
+ if (!\array_key_exists('url', $this->arguments)) {
+ throw new \BadMethodCallException("Argument 'url' of event {$name} is required but has not been provided");
+ }
+
+ if (!\array_key_exists('headers', $this->arguments)) {
+ throw new \BadMethodCallException("Argument 'headers' of event {$name} is required but has not been provided");
+ }
+
+ // For backward compatibility make sure the value is referenced
+ // TODO: Remove in Joomla 6
+ // @deprecated: Passing argument by reference is deprecated, and will not work in Joomla 6
+ if (key($arguments) === 0) {
+ $this->arguments['url'] = &$arguments[0];
+ } elseif (\array_key_exists('url', $arguments)) {
+ $this->arguments['url'] = &$arguments['url'];
+ }
+ }
+
+ /**
+ * Setter for the url argument.
+ *
+ * @param string $value The value to set
+ *
+ * @return string
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ protected function setUrl(string $value): string
+ {
+ return $value;
+ }
+
+ /**
+ * Setter for the headers argument.
+ *
+ * @param array|\ArrayAccess $value The value to set
+ *
+ * @return array|\ArrayAccess
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ protected function setHeaders(array|\ArrayAccess $value): array|\ArrayAccess
+ {
+ return $value;
+ }
+
+ /**
+ * Getter for the url.
+ *
+ * @return string
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function getUrl(): string
+ {
+ return $this->arguments['url'];
+ }
+
+ /**
+ * Getter for the headers.
+ *
+ * @return array|\ArrayAccess
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function getHeaders(): array|\ArrayAccess
+ {
+ return $this->arguments['headers'];
+ }
+
+ /**
+ * Update the url.
+ *
+ * @param string $value The value to set
+ *
+ * @return static
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function updateUrl(string $value): static
+ {
+ $this->arguments['url'] = $value;
+
+ return $this;
+ }
+}
diff --git a/libraries/src/Event/Installer/InstallerEvent.php b/libraries/src/Event/Installer/InstallerEvent.php
new file mode 100644
index 0000000000000..7ad91e8bf7168
--- /dev/null
+++ b/libraries/src/Event/Installer/InstallerEvent.php
@@ -0,0 +1,144 @@
+
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+namespace Joomla\CMS\Event\Installer;
+
+use Joomla\CMS\Event\AbstractImmutableEvent;
+use Joomla\CMS\Event\ReshapeArgumentsAware;
+use Joomla\CMS\MVC\Model\BaseModel;
+
+// phpcs:disable PSR1.Files.SideEffects
+\defined('_JEXEC') or die;
+// phpcs:enable PSR1.Files.SideEffects
+
+/**
+ * Class for Installer events
+ *
+ * @since __DEPLOY_VERSION__
+ */
+abstract class InstallerEvent extends AbstractImmutableEvent
+{
+ use ReshapeArgumentsAware;
+
+ /**
+ * The argument names, in order expected by legacy plugins.
+ *
+ * @var array
+ *
+ * @since __DEPLOY_VERSION__
+ * @deprecated 5.0 will be removed in 6.0
+ */
+ protected $legacyArgumentsOrder = ['subject', 'package'];
+
+ /**
+ * Constructor.
+ *
+ * @param string $name The event name.
+ * @param array $arguments The event arguments.
+ *
+ * @throws \BadMethodCallException
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function __construct($name, array $arguments = [])
+ {
+ // Reshape the arguments array to preserve b/c with legacy listeners
+ // Do not override existing $arguments in place, or it will break references!
+ if ($this->legacyArgumentsOrder) {
+ parent::__construct($name, $this->reshapeArguments($arguments, $this->legacyArgumentsOrder));
+ } else {
+ parent::__construct($name, $arguments);
+ }
+
+ if (!\array_key_exists('subject', $this->arguments)) {
+ throw new \BadMethodCallException("Argument 'subject' of event {$name} is required but has not been provided");
+ }
+
+ if (!\array_key_exists('package', $this->arguments)) {
+ throw new \BadMethodCallException("Argument 'package' of event {$name} is required but has not been provided");
+ }
+
+ // For backward compatibility make sure the package is referenced
+ // TODO: Remove in Joomla 6
+ // @deprecated: Passing argument by reference is deprecated, and will not work in Joomla 6
+ if (key($arguments) === 0) {
+ $this->arguments['package'] = &$arguments[1];
+ } elseif (\array_key_exists('package', $arguments)) {
+ $this->arguments['package'] = &$arguments['package'];
+ }
+ }
+
+ /**
+ * Setter for the subject argument.
+ *
+ * @param BaseModel $value The value to set
+ *
+ * @return BaseModel
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ protected function setSubject(BaseModel $value): BaseModel
+ {
+ return $value;
+ }
+
+ /**
+ * Setter for the package argument.
+ *
+ * @param array|\ArrayAccess|null $value The value to set
+ *
+ * @return array|\ArrayAccess|null
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ protected function setPackage(array|\ArrayAccess|null $value): array|\ArrayAccess|null
+ {
+ return $value;
+ }
+
+ /**
+ * Getter for the model.
+ *
+ * @return BaseModel
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function getModel(): BaseModel
+ {
+ return $this->arguments['subject'];
+ }
+
+ /**
+ * Getter for the package.
+ *
+ * @return array|\ArrayAccess|null
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function getPackage(): array|\ArrayAccess|null
+ {
+ return $this->arguments['package'] ?? null;
+ }
+
+ /**
+ * Update the package.
+ *
+ * @param array|\ArrayAccess|null $value The value to set
+ *
+ * @return static
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function updatePackage(array|\ArrayAccess|null $value): static
+ {
+ $this->arguments['package'] = $value;
+
+ return $this;
+ }
+}
diff --git a/libraries/src/Installer/InstallerHelper.php b/libraries/src/Installer/InstallerHelper.php
index b4d085dfb33ec..5989e144ea250 100644
--- a/libraries/src/Installer/InstallerHelper.php
+++ b/libraries/src/Installer/InstallerHelper.php
@@ -10,12 +10,14 @@
namespace Joomla\CMS\Installer;
use Joomla\Archive\Archive;
+use Joomla\CMS\Event\Installer\BeforePackageDownloadEvent;
use Joomla\CMS\Factory;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Http\HttpFactory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Log\Log;
use Joomla\CMS\Plugin\PluginHelper;
+use Joomla\CMS\Proxy\ArrayProxy;
use Joomla\CMS\Updater\Update;
use Joomla\CMS\Version;
use Joomla\Filesystem\File;
@@ -77,9 +79,15 @@ public static function downloadPackage($url, $target = false)
ini_set('user_agent', $version->getUserAgent('Installer'));
// Load installer plugins, and allow URL and headers modification
- $headers = [];
- PluginHelper::importPlugin('installer');
- Factory::getApplication()->triggerEvent('onInstallerBeforePackageDownload', [&$url, &$headers]);
+ $headers = [];
+ $dispatcher = Factory::getApplication()->getDispatcher();
+ PluginHelper::importPlugin('installer', null, true, $dispatcher);
+ $event = new BeforePackageDownloadEvent('onInstallerBeforePackageDownload', [
+ 'url' => &$url, // TODO: Remove reference in Joomla 6, see BeforePackageDownloadEvent::__constructor()
+ 'headers' => new ArrayProxy($headers),
+ ]);
+ $dispatcher->dispatch('onInstallerBeforePackageDownload', $event);
+ $url = $event->getUrl();
try {
$response = HttpFactory::getHttp()->get($url, $headers);
diff --git a/plugins/installer/folderinstaller/src/Extension/FolderInstaller.php b/plugins/installer/folderinstaller/src/Extension/FolderInstaller.php
index fae97b97b5379..a8ee960b4e0ca 100644
--- a/plugins/installer/folderinstaller/src/Extension/FolderInstaller.php
+++ b/plugins/installer/folderinstaller/src/Extension/FolderInstaller.php
@@ -10,8 +10,10 @@
namespace Joomla\Plugin\Installer\Folder\Extension;
+use Joomla\CMS\Event\Installer\AddInstallationTabEvent;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Plugin\PluginHelper;
+use Joomla\Event\SubscriberInterface;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
@@ -22,7 +24,7 @@
*
* @since 3.6.0
*/
-final class FolderInstaller extends CMSPlugin
+final class FolderInstaller extends CMSPlugin implements SubscriberInterface
{
/**
* Application object.
@@ -34,13 +36,27 @@ final class FolderInstaller extends CMSPlugin
protected $app;
/**
- * Textfield or Form of the Plugin.
+ * Returns an array of events this subscriber will listen to.
*
- * @return array Returns an array with the tab information
+ * @return array
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public static function getSubscribedEvents(): array
+ {
+ return ['onInstallerAddInstallationTab' => 'onInstallerAddInstallationTab'];
+ }
+
+ /**
+ * Installer add Installation Tab listener.
+ *
+ * @param AddInstallationTabEvent $event The event instance
+ *
+ * @return void
*
* @since 3.6.0
*/
- public function onInstallerAddInstallationTab()
+ public function onInstallerAddInstallationTab(AddInstallationTabEvent $event)
{
// Load language files
$this->loadLanguage();
@@ -54,6 +70,6 @@ public function onInstallerAddInstallationTab()
include PluginHelper::getLayoutPath('installer', 'folderinstaller');
$tab['content'] = ob_get_clean();
- return $tab;
+ $event->addResult($tab);
}
}
diff --git a/plugins/installer/packageinstaller/src/Extension/PackageInstaller.php b/plugins/installer/packageinstaller/src/Extension/PackageInstaller.php
index f4f974ba829db..add2a762ee2b3 100644
--- a/plugins/installer/packageinstaller/src/Extension/PackageInstaller.php
+++ b/plugins/installer/packageinstaller/src/Extension/PackageInstaller.php
@@ -10,8 +10,10 @@
namespace Joomla\Plugin\Installer\Package\Extension;
+use Joomla\CMS\Event\Installer\AddInstallationTabEvent;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Plugin\PluginHelper;
+use Joomla\Event\SubscriberInterface;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
@@ -22,7 +24,7 @@
*
* @since 3.6.0
*/
-final class PackageInstaller extends CMSPlugin
+final class PackageInstaller extends CMSPlugin implements SubscriberInterface
{
/**
* Application object
@@ -34,13 +36,27 @@ final class PackageInstaller extends CMSPlugin
protected $app;
/**
- * Textfield or Form of the Plugin.
+ * Returns an array of events this subscriber will listen to.
*
- * @return array Returns an array with the tab information
+ * @return array
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public static function getSubscribedEvents(): array
+ {
+ return ['onInstallerAddInstallationTab' => 'onInstallerAddInstallationTab'];
+ }
+
+ /**
+ * Installer add Installation Tab listener.
+ *
+ * @param AddInstallationTabEvent $event The event instance
+ *
+ * @return void
*
* @since 3.6.0
*/
- public function onInstallerAddInstallationTab()
+ public function onInstallerAddInstallationTab(AddInstallationTabEvent $event)
{
// Load language files
$this->loadLanguage();
@@ -54,6 +70,6 @@ public function onInstallerAddInstallationTab()
include PluginHelper::getLayoutPath('installer', 'packageinstaller');
$tab['content'] = ob_get_clean();
- return $tab;
+ $event->addResult($tab);
}
}
diff --git a/plugins/installer/urlinstaller/src/Extension/UrlInstaller.php b/plugins/installer/urlinstaller/src/Extension/UrlInstaller.php
index 1ee46cacf0f0c..03c271c5b1711 100644
--- a/plugins/installer/urlinstaller/src/Extension/UrlInstaller.php
+++ b/plugins/installer/urlinstaller/src/Extension/UrlInstaller.php
@@ -10,8 +10,10 @@
namespace Joomla\Plugin\Installer\Url\Extension;
+use Joomla\CMS\Event\Installer\AddInstallationTabEvent;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Plugin\PluginHelper;
+use Joomla\Event\SubscriberInterface;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
@@ -22,7 +24,7 @@
*
* @since 3.6.0
*/
-final class UrlInstaller extends CMSPlugin
+final class UrlInstaller extends CMSPlugin implements SubscriberInterface
{
/**
* Application object.
@@ -34,13 +36,27 @@ final class UrlInstaller extends CMSPlugin
protected $app;
/**
- * Textfield or Form of the Plugin.
+ * Returns an array of events this subscriber will listen to.
*
- * @return array Returns an array with the tab information
+ * @return array
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public static function getSubscribedEvents(): array
+ {
+ return ['onInstallerAddInstallationTab' => 'onInstallerAddInstallationTab'];
+ }
+
+ /**
+ * Installer add Installation Tab listener.
+ *
+ * @param AddInstallationTabEvent $event The event instance
+ *
+ * @return void
*
* @since 3.6.0
*/
- public function onInstallerAddInstallationTab()
+ public function onInstallerAddInstallationTab(AddInstallationTabEvent $event)
{
// Load language files
$this->loadLanguage();
@@ -54,6 +70,6 @@ public function onInstallerAddInstallationTab()
include PluginHelper::getLayoutPath('installer', 'urlinstaller');
$tab['content'] = ob_get_clean();
- return $tab;
+ $event->addResult($tab);
}
}
diff --git a/plugins/installer/webinstaller/src/Extension/WebInstaller.php b/plugins/installer/webinstaller/src/Extension/WebInstaller.php
index f339c175bfc8c..871195dc9fb3c 100644
--- a/plugins/installer/webinstaller/src/Extension/WebInstaller.php
+++ b/plugins/installer/webinstaller/src/Extension/WebInstaller.php
@@ -11,6 +11,7 @@
namespace Joomla\Plugin\Installer\Web\Extension;
use Joomla\CMS\Application\CMSApplication;
+use Joomla\CMS\Event\Installer\AddInstallationTabEvent;
use Joomla\CMS\Form\Rule\UrlRule;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\CMSPlugin;
@@ -18,6 +19,7 @@
use Joomla\CMS\Updater\Update;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Version;
+use Joomla\Event\SubscriberInterface;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
@@ -28,7 +30,7 @@
*
* @since 3.2
*/
-final class WebInstaller extends CMSPlugin
+final class WebInstaller extends CMSPlugin implements SubscriberInterface
{
/**
* The URL for the remote server.
@@ -63,14 +65,28 @@ final class WebInstaller extends CMSPlugin
*/
private $rtl = null;
+ /**
+ * Returns an array of events this subscriber will listen to.
+ *
+ * @return array
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public static function getSubscribedEvents(): array
+ {
+ return ['onInstallerAddInstallationTab' => 'onInstallerAddInstallationTab'];
+ }
+
/**
* Event listener for the `onInstallerAddInstallationTab` event.
*
- * @return array Returns an array with the tab information
+ * @param AddInstallationTabEvent $event The event instance
+ *
+ * @return void
*
* @since 4.0.0
*/
- public function onInstallerAddInstallationTab()
+ public function onInstallerAddInstallationTab(AddInstallationTabEvent $event)
{
// Load language files
$this->loadLanguage();
@@ -125,7 +141,7 @@ public function onInstallerAddInstallationTab()
$tab['content'] = ob_get_clean();
$tab['content'] = '' . $tab['content'];
- return $tab;
+ $event->addResult($tab);
}
/**