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

Conversation

Projects
None yet
3 participants
@diosmosis
Copy link
Member

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
* @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]);

This comment has been minimized.

Copy link
@tsteur

tsteur Sep 23, 2017

Member

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.

This comment has been minimized.

Copy link
@tsteur

tsteur Sep 23, 2017

Member

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()]);

This comment has been minimized.

Copy link
@tsteur

tsteur Sep 23, 2017

Member

Can maybe add a little documentation here?

@tsteur

This comment has been minimized.

Copy link
Member

commented Sep 23, 2017

Added 2 small comments but looks good otherwise 👍

@diosmosis diosmosis force-pushed the diosmosis:user-file-storage branch from 7cc01b0 to 27f9095 Sep 23, 2017

@diosmosis

This comment has been minimized.

Copy link
Member Author

commented Sep 23, 2017

@tsteur Made the requested changes.

@tsteur

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member Author

commented Sep 25, 2017

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

This comment has been minimized.

Copy link
Member

commented Sep 25, 2017

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

@diosmosis diosmosis force-pushed the diosmosis:user-file-storage branch from 27f9095 to 4e1ad3e Sep 25, 2017

@diosmosis

This comment has been minimized.

Copy link
Member Author

commented Sep 25, 2017

Removed the size=$size events.

@tsteur

tsteur approved these changes Sep 25, 2017

@mattab mattab merged commit da6e68b into matomo-org:3.x-dev Sep 25, 2017

1 check failed

continuous-integration/travis-ci/pr The Travis CI build failed
Details

@diosmosis diosmosis deleted the diosmosis:user-file-storage branch Sep 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.