Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure component updated event is triggered even if there is no update file #10807

Merged
merged 3 commits into from Nov 1, 2016

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Oct 30, 2016

Component update event has only be triggered if an update file was processed.

Shall we backport that for 2.x?

@sgiehl sgiehl added the Needs Review PRs that need a code review label Oct 30, 2016
@sgiehl sgiehl added this to the 3.0.0-b2 milestone Oct 30, 2016
@tsteur
Copy link
Member

tsteur commented Oct 30, 2016

I'm not quite sure if this is the right place for it. Looking at the callers it might be called several times eg in CoreUpdater::dispatch. Would it be maybe better to post this event in general in Updater::markComponentSuccessfullyUpdated . Then we would have it in one place and maybe only when it was really marked as updated? Same could be maybe applied for markComponentSuccessfullyUninstalled etc

@sgiehl
Copy link
Member Author

sgiehl commented Oct 30, 2016

Sounds good to move the events to the markComponentX methods. Will update the PR

*/
public function markComponentSuccessfullyUpdated($name, $version)
public function markComponentSuccessfullyUpdated($name, $version, $isNew = false)
Copy link
Member Author

Choose a reason for hiding this comment

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

Needed a new parameter to indicate if a new plugin was installed or updated, as that method is also used when installing new plugins

@sgiehl
Copy link
Member Author

sgiehl commented Oct 30, 2016

@tsteur would you have another look, if it's better that way?
As I now also have renamed the events, I guess it's better to do that for 3.x only.

@mattab mattab modified the milestones: 3.0.0-b2, 3.0.0-b3 Oct 30, 2016
* `PluginManager.pluginInstalled` triggered after a plugin was installed
* `PluginManager.pluginUninstalled` triggered after a plugin was uninstalled
* `Updater.componentInstalled` triggered after a plugin was installed
* `Updater.componentUninstalled` triggered after a plugin was uninstalled
Copy link
Member

Choose a reason for hiding this comment

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

We are using those events in CustomPiwikJS and it needs to be updated there if we rename it. Not sure if we should actually rename it as it is now inconsistent with PluginManager.pluginActivated and PluginManager.pluginDeactivated. Maybe we could have just both events as there might be different use cases where you only want to listen to pluginActivated but don't care so much when a dimension component was updated etc? Also it would be maybe more clear for developers to have both events as it would not be so much obvious that you need to listen to an Updater event when a plugin was installed. Any thoughts on this @sgiehl @mattab ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure how to handle that best. Tried to make the event name consistent with Updater.componentUpdated. We could for sure have both events. Which would mean installing a plugin would trigger PluginManager.pluginInstalled and Updater.componentInstalled

Copy link
Member

Choose a reason for hiding this comment

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

I think we should trigger both. That would be valuable and a bit more intuitive

@sgiehl
Copy link
Member Author

sgiehl commented Nov 1, 2016

As discussed now both events are triggered up on un-/install

* $mail->send();
* });
*
* @param string $componentName 'core', or plugin name
Copy link
Member

Choose a reason for hiding this comment

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

I think it could be also the name of a dimension etc. as they are basically components as well

@@ -106,6 +144,13 @@ public function markComponentSuccessfullyUninstalled($name)
} catch (\Exception $e) {
// case when the option table is not yet created (before 0.2.10)
}

/**
* Event triggered after a plugin has been uninstalled.
Copy link
Member

Choose a reason for hiding this comment

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

after a "component" has been uninstalled

/**
* Event triggered after a component has been updated.
*
* Can be used to handle stuff that should be done after a component was updated
Copy link
Member

Choose a reason for hiding this comment

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

Can we maybe replace the word "stuff" with something else? :) Maybe with "logic" or so

@tsteur
Copy link
Member

tsteur commented Nov 1, 2016

I have mentioned small notes re the docs. Feel free to merge afterwards 👍

@sgiehl sgiehl merged commit ded86bb into 3.x-dev Nov 1, 2016
@sgiehl sgiehl deleted the componentupdatedevent branch November 1, 2016 22:03
sgiehl added a commit that referenced this pull request Nov 1, 2016
…e file (#10807)

* ensure component updated event is triggered even if there is no update file
* improve events triggered during component changes
* improve wordings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants