Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions libraries/src/Application/CMSApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,14 +355,10 @@ public function execute()

PluginHelper::importPlugin('system');

// Trigger the onBeforeExecute event.
$this->triggerEvent(
// Trigger the onBeforeExecute event
$this->getDispatcher()->dispatch(
'onBeforeExecute',
[
'subject' => $this,
'eventClass' => BeforeExecuteEvent::class,
'container' => $this->getContainer()
]
new BeforeExecuteEvent('onBeforeExecute', ['subject' => $this, 'container' => $this->getContainer()])
);

// Mark beforeExecute in the profiler.
Expand Down
8 changes: 6 additions & 2 deletions libraries/src/Application/CliApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Joomla\CMS\Application\CLI\CliInput;
use Joomla\CMS\Application\CLI\CliOutput;
use Joomla\CMS\Application\CLI\Output\Stdout;
use Joomla\CMS\Event\BeforeExecuteEvent;
use Joomla\CMS\Extension\ExtensionManagerTrait;
use Joomla\Input\Cli;
use Joomla\Input\Input;
Expand Down Expand Up @@ -145,8 +146,11 @@ public static function getInstance($name = null)
*/
public function execute()
{
// Trigger the onBeforeExecute event.
$this->triggerEvent('onBeforeExecute');
// Trigger the onBeforeExecute event
$this->getDispatcher()->dispatch(
'onBeforeExecute',
new BeforeExecuteEvent('onBeforeExecute', ['subject' => $this, 'container' => $this->getContainer()])
);

// Perform application routines.
$this->doExecute();
Expand Down
8 changes: 6 additions & 2 deletions libraries/src/Application/DaemonApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

jimport('joomla.filesystem.folder');

use Joomla\CMS\Event\BeforeExecuteEvent;
use Joomla\Event\DispatcherInterface;
use Joomla\Registry\Registry;

Expand Down Expand Up @@ -362,8 +363,11 @@ public function loadConfiguration($data)
*/
public function execute()
{
// Trigger the onBeforeExecute event.
$this->triggerEvent('onBeforeExecute');
// Trigger the onBeforeExecute event
$this->getDispatcher()->dispatch(
'onBeforeExecute',
new BeforeExecuteEvent('onBeforeExecute', ['subject' => $this, 'container' => $this->getContainer()])
);

// Enable basic garbage collection.
gc_enable();
Expand Down
8 changes: 6 additions & 2 deletions libraries/src/Application/WebApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Joomla\Application\AbstractWebApplication;
use Joomla\Application\Web\WebClient;
use Joomla\CMS\Document\Document;
use Joomla\CMS\Event\BeforeExecuteEvent;
use Joomla\CMS\Input\Input;
use Joomla\CMS\Language\Language;
use Joomla\CMS\User\User;
Expand Down Expand Up @@ -128,8 +129,11 @@ public static function getInstance($name = null)
*/
public function execute()
{
// Trigger the onBeforeExecute event.
$this->triggerEvent('onBeforeExecute');
// Trigger the onBeforeExecute event
$this->getDispatcher()->dispatch(
'onBeforeExecute',
new BeforeExecuteEvent('onBeforeExecute', ['subject' => $this, 'container' => $this->getContainer()])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one doesn't work sadly :( The getContainer doesn't exist in this class

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a PR to fix it

);

// Perform application routines.
$this->doExecute();
Expand Down