?
avatar sisko1990
sisko1990
22 Jul 2015

Steps to reproduce the issue

Search for e.g. „onExtensionAfterSave“ in Core-Files:
find . -type f -name "*.php" | xargs grep -sl "onExtensionAfterSave"
./administrator/components/com_modules/models/module.php
./administrator/components/com_plugins/models/plugin.php
./administrator/components/com_config/model/component.php
./administrator/components/com_templates/models/style.php
./administrator/components/com_languages/models/language.php

Now look for the trigger method in these files:
find . -type f -name "*.php" | xargs grep -sl "onExtensionAfterSave" | xargs grep -sl "trigger"
./administrator/components/com_modules/models/module.php
./administrator/components/com_config/model/component.php
./administrator/components/com_templates/models/style.php
./administrator/components/com_languages/models/language.php

Expected result

No trigger is used in ./administrator/components/com_plugins/models/plugin.php, but the config for a trigger is prepared. So now a developer cannot use the event on plugins but on all other types.
It would be better as a developer to be able to use that event on plugins, too.

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
4.00

avatar sisko1990 sisko1990 - open - 22 Jul 2015
avatar Bakual
Bakual - comment - 22 Jul 2015

Can you propose a PR? See https://docs.joomla.org/Using_the_Github_UI_to_Make_Pull_Requests if you need assistance in how to create one.

@amazeika Is that related to #4308? Sounds at least like a similar issue.

avatar sisko1990
sisko1990 - comment - 22 Jul 2015

If I know the solution, I would not commit the issue without code. The code looks ok [in ./administrator/components/com_plugins/models/plugin.php the parent:save from JModelAdmin is called and that save method has the triggers]... but I don't know why they are not used...

avatar amazeika
amazeika - comment - 22 Jul 2015

@Bakual Hello Thomas, these events are triggering just fine on my end when saving plugins. I've just reviewed the code and tried it myself.

avatar sisko1990
sisko1990 - comment - 22 Jul 2015

I tried it, too - again.
Installation: Joomla! 3.4.3 Stable with Sample Data.

I added this:

public function onExtensionAfterSave($context, &$table, $isNew)
{
      var_dump($context);
      die(); // I know that die() isn't for debugging but it shows the best contrast (-> white site with a bit of text) 
}

to a standard core system plugin that is always activated: Logout (plugins/system/logout/logout.php) right after the constructor.
Its working in modules, templates, languages and on saving components options but not on plugins.

avatar Bakual
Bakual - comment - 23 Jul 2015

Removing the & from the $table in your code fixed it for me.
The issue comes from the fact that com_plugin is using the save method from JModelAdmin while the other managers have own save methods.
They differ in the trigger call in that JModelAdmin doesn't explicitely pass $table as reference while the others do.
Imho, the table is passed by reference anyway, so this isn't needed.

If you look at your PHP log, you will see a warning like this:

PHP Warning: Parameter 2 to PlgSystemLogout::onExtensionAfterSave() expected to be a reference, value given in D:\xampp\htdocs\joomla3.4\libraries\joomla\event\event.php on line 69

avatar sisko1990
sisko1990 - comment - 23 Jul 2015

That it was! Sorry. log_errors show more errors on Joomla, as only display_errors...

For me the issue is closed. Thanks for your help.

avatar sisko1990 sisko1990 - change - 23 Jul 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-07-23 12:38:05
Closed_By sisko1990
avatar sisko1990 sisko1990 - close - 23 Jul 2015

Add a Comment

Login with GitHub to post a comment