diff options
author | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-07-06 03:44:45 +0400 |
---|---|---|
committer | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-07-06 03:44:45 +0400 |
commit | ddd7aac6f2d1e3b1660f38045cab4214a26f2325 (patch) | |
tree | 8e49b4362a6a88505d1b790d64a546a719056188 /plugins/UserSettings | |
parent | 3a3517e48823a4d7dc521e5a754c51ddbcf5d210 (diff) |
Implemented custom event dispatching system for Piwik (replaced event dispatcher lib in libs/Event).
Notes:
- New dispatcher can execute callbacks before or after other callbacks.
- It is also possible to dispatch events only to a specific set of plugins instead of all plugins.
- Moved Piwik::unprefixClass to Piwik_Common::unprefixClass
- Added visibility to some event handlers that were missing it.
- Allowed two unit tests to fail w/ better diagnostic messages.
Diffstat (limited to 'plugins/UserSettings')
-rw-r--r-- | plugins/UserSettings/UserSettings.php | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/plugins/UserSettings/UserSettings.php b/plugins/UserSettings/UserSettings.php index 19b5252360..e3d9076280 100644 --- a/plugins/UserSettings/UserSettings.php +++ b/plugins/UserSettings/UserSettings.php @@ -177,13 +177,9 @@ class Piwik_UserSettings extends Piwik_Plugin /* * Registers reports metadata - * - * @param Piwik_Event_Notification $notification notification object */ - public function getReportMetadata($notification) + public function getReportMetadata(&$reports) { - $reports = & $notification->getNotificationObject(); - $i = 0; foreach ($this->reportMetadata as $report) { list($category, $name, $apiModule, $apiAction, $columnName) = $report; @@ -221,12 +217,9 @@ class Piwik_UserSettings extends Piwik_Plugin /** * Get segments meta data - * - * @param Piwik_Event_Notification $notification notification object */ - public function getSegmentsMetadata($notification) + public function getSegmentsMetadata(&$segments) { - $segments =& $notification->getNotificationObject(); foreach ($this->reportMetadata as $report) { @list($category, $name, $apiModule, $apiAction, $columnName, $segment, $sqlSegment, $acceptedValues, $sqlFilter) = $report; if (empty($segment)) continue; @@ -267,30 +260,20 @@ class Piwik_UserSettings extends Piwik_Plugin * Daily archive of User Settings report. Processes reports for Visits by Resolution, * by Browser, Browser family, etc. Some reports are built from the logs, some reports * are superset of an existing report (eg. Browser family is built from the Browser report) - * - * @param Piwik_Event_Notification $notification notification object */ - function archiveDay($notification) + public function archiveDay(Piwik_ArchiveProcessor_Day $archiveProcessor) { - $archiveProcessor = $notification->getNotificationObject(); - $archiving = new Piwik_UserSettings_Archiver($archiveProcessor); if($archiving->shouldArchive()) { $archiving->archiveDay(); } } - /** * Period archiving: simply sums up daily archives - * - * @param Piwik_Event_Notification $notification notification object - * @return void */ - function archivePeriod($notification) + public function archivePeriod(Piwik_ArchiveProcessor_Period $archiveProcessor) { - $archiveProcessor = $notification->getNotificationObject(); - $archiving = new Piwik_UserSettings_Archiver($archiveProcessor); if($archiving->shouldArchive()) { $archiving->archivePeriod(); |