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

Adding new events triggered when dynamic files are changed by Piwik. #12106

Merged
merged 2 commits into from Sep 25, 2017
Merged

Adding new events triggered when dynamic files are changed by Piwik. #12106

merged 2 commits into from Sep 25, 2017

Conversation

diosmosis
Copy link
Member

@diosmosis diosmosis commented Sep 22, 2017

Added a couple new events that are triggered when changes are made to dynamic files on a Piwik server. The events include:

  • Core.configFileChanged: triggered when an INI config file is changed
  • CoreAdminHome.customLogoChanged: triggered when a custom logo/favicon file is updated
  • CustomPiwikJs.piwikJsChanged: triggered when tracker JS is regenerated & saved

@diosmosis diosmosis added the Needs Review PRs that need a code review label Sep 22, 2017
* @param bool $isSmall If true, the path is for the small logo image, otherwise the
* full image.
*/
Piwik::postEvent('CoreAdminHome.customLogoChanged', [$rootPath . '/' . $smallLogoUserPath, $isSmall = true]);
Copy link
Member

Choose a reason for hiding this comment

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

Looks good to me. Maybe, instead of isSmall:true|false could post something like size=small? Would just allow us to more easily post more events in the future in case we have other sizes.

Copy link
Member

@tsteur tsteur Sep 23, 2017

Choose a reason for hiding this comment

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

I just see below the favicon event... could event have like size=small|large|favicon maybe? Then some constants for those values for easy checking.

@@ -130,6 +131,8 @@ public function update()

if ($newContent !== $this->getCurrentTrackerFileContent()) {
$this->toFile->save($newContent);

Piwik::postEvent('CustomPiwikJs.piwikJsChanged', [$this->toFile->getPath()]);
Copy link
Member

Choose a reason for hiding this comment

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

Can maybe add a little documentation here?

@tsteur
Copy link
Member

tsteur commented Sep 23, 2017

Added 2 small comments but looks good otherwise 👍

@diosmosis
Copy link
Member Author

@tsteur Made the requested changes.

@tsteur
Copy link
Member

tsteur commented Sep 23, 2017

PR looks good to me. I would probably renamed one event to size_$size instead of size=$size or just named it ... customLogoChanged.$size but totally fine with equal size as well. @diosmosis just wondering do we actually need this second event with the size directly in the event name? Totally fine to leave it in there, just wondering if it is actually needed.

FYI: We will need to see what kind of documentation it generates on https://developer.piwik.org/api-reference/events#controllermoduleaction for that event (once merged) as I don't remember whether we need some kind of extra logic for that on the developer website or not.

@mattab mattab added this to the 3.1.2 milestone Sep 24, 2017
@diosmosis
Copy link
Member Author

I would probably renamed one event to size_$size instead of size=$size or just named it ... customLogoChanged.$size but totally fine with equal size as well.

I was going by the text in your comment. Is there a documented convention?

@diosmosis just wondering do we actually need this second event with the size directly in the event name?

Not needed for what I'm doing, just figured I'd be thorough.

@tsteur
Copy link
Member

tsteur commented Sep 25, 2017

There is no convention for this. If it is not needed, I would maybe remove the event though.

@diosmosis
Copy link
Member Author

Removed the size=$size events.

@mattab mattab merged commit da6e68b into matomo-org:3.x-dev Sep 25, 2017
@diosmosis diosmosis deleted the user-file-storage branch September 26, 2017 00:53
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