User tests: Successful: Unsuccessful:
Following #8888, this PR adds the final event afterRespond
to the Joomla! Debug Console Profile Information
block.
As it is now Joomla is not returning the real page time because it's not counting the afterRespond
event.
To achive this goal a new event, the onBeforeEnd
, is created. This event:
onAfterRespond
events) and before the app closes.Since the onAfterRespond
events are now in the Profiler too, this PR will also allow to debug the onAfterRespond
events.
afterRespond
time and memory usage is in the Joomla! Debug Console Profile Information
block.onAfterRespond
. For instance, add the following php to a system plugin that is enabled, load page and observe if the messages appear in the Joomla! Debug Console.public function onAfterRespond()
{
// Test to add mark in the profiler Joomla! Debug Console Profile Information block.
JDEBUG ? JProfiler::getInstance('Application')->mark('testMark') : null;
// Test to add log message to Log Messages block.
JDEBUG ? JLog::add('Test log message to Joomla! Debug Console Log Messages block.', JLog::WARNING, 'deprecated') : null;
}
Improvements or suggestions are welcome.
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
ok. i will replace it onBeforeEnd for onAfterExecute. But only for JDEBUG right?
In the Joomla the onAfterExecute
event is executed before onAfterRespond
event (https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/application/web.php#L263).
The goal here is to have a last event that is executed after the onAfterRespond
event to be only used by the debugger so we can debug all events in the application so i think onAfterExecute
will not serve the goal.
Oh... These web application classes are so inconsistent. The base application class triggers that event as the last thing in execute, I wish I knew why the folks who wrote those classes decided to have onAfterExecute
in the middle of execute :facepalm:
Also, you can't create an event trigger that will only dispatch to one plugin. If you really wanted to do that, you'd need to just trigger $plugin->runThisAfterExecuteFinishes()
instead of using the event dispatcher. Even if it's only dispatched if JDEBUG is true, any plugin with a public function onAfterExecute()
would still listen to that event.
I'd just use onAfterExecute
for the method and consider changing the event trigger order in JApplicationWeb
so that the method is actually triggered after execute finishes.
Check also the comments in Joomla Framework:
If i understand this correctly there is a doExecute
inside the execute
. The onBeforeExecute
and onAfterExecute
are related to the doExecute
, in other words, onAfterExecute
the doExecute
.
Regarding this PR, i will try to change and call the debug plugin directly (with no new event).
As the only crazy guy left using the Framework, I'd say the current trigger position is wrong, or the web application classes need an additional afterExecute
type of event after the response is sent. Either way what's there now is less than optimal.
Look on the bright side, if you're the only crazy guy left using the Framework
you have more liberty to correct it.
Category | ⇒ | Libraries |
closing for lack of interest
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-09-05 21:56:38 |
Closed_By | ⇒ | andrepereiradasilva |
Category | Libraries | ⇒ | Libraries Plugins Front End |
The parent JApplicationWeb class has onBeforeExecute and onAfterExecute
events that we pulled out when migrating the application classes from the
legacy stuff. So if we're going to put a new trigger at the end of the
execute method I'd put that onAfterExecute trigger back.
On Tuesday, January 12, 2016, andrepereiradasilva notifications@github.com
wrote: