diff options
author | Michał Gaździk <m.gazdzik@clearcode.cc> | 2014-11-11 18:35:08 +0300 |
---|---|---|
committer | Michał Gaździk <m.gazdzik@clearcode.cc> | 2014-11-11 18:35:08 +0300 |
commit | cf3b53ca26e1aa9c202a3a66010d9e91e72f571c (patch) | |
tree | 0dd1e21ace52a2a73fcbef665d2ee70b7dc0a2cf /plugins/ExamplePlugin | |
parent | 3fb5a220e378ff9a3ec2d35b8e822068414c54ff (diff) |
included feedback for previous PR
Diffstat (limited to 'plugins/ExamplePlugin')
-rw-r--r-- | plugins/ExamplePlugin/Archiver.php | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/plugins/ExamplePlugin/Archiver.php b/plugins/ExamplePlugin/Archiver.php index d5c4ddcdcd..2f06b416b3 100644 --- a/plugins/ExamplePlugin/Archiver.php +++ b/plugins/ExamplePlugin/Archiver.php @@ -9,9 +9,31 @@ namespace Piwik\Plugins\ExamplePlugin; +/** + * Class Archiver + * @package Piwik\Plugins\ExamplePlugin + * + * Archiver is class processing raw data into ready ro read reports. + * It must implement two methods for aggregating daily reports + * aggregateDayReport() and other for summing daily reports into periods + * like week, month, year or custom range aggregateMultipleReports(). + * + * For more detailed information about Archiver please visit Piwik developer guide + * http://developer.piwik.org/api-reference/Piwik/Plugin/Archiver + * + */ class Archiver extends \Piwik\Plugin\Archiver { - const EXAMPLEPLUGIN_USERS_RECORD = "ExamplePlugin_users"; + /** + * It is a good practice to store your archive names (reports stored in database) + * in Archiver class constants. You can define as many record namesas you want + * for your plugin. + * + * Also important thing is that record name must be prefixed with plugin name. + * + * This is only an example record name, so feel free to change it to suit your needs. + */ + const EXAMPLEPLUGIN_ARCHIVE_RECORD = "ExamplePlugin_archive_record"; public function aggregateDayReport() { @@ -24,7 +46,7 @@ class Archiver extends \Piwik\Plugin\Archiver * ->getMetricsFromVisitByDimension('idvisitor') * ->asDataTable(); * $visitorReport = $visitorMetrics->getSerialized(); - * $this->getProcessor()->insertBlobRecord(self::EXAMPLEPLUGIN_USERS_RECORD, $visitorReport); + * $this->getProcessor()->insertBlobRecord(self::EXAMPLEPLUGIN_ARCHIVE_RECORD, $visitorReport); */ } @@ -35,8 +57,8 @@ class Archiver extends \Piwik\Plugin\Archiver * to be summed. This work for most cases. * However if needed, also custom queries can be implemented * for periods to achieve more acurrate results. - * - * $this->getProcessor()->aggregateDataTableRecords(self::EXAMPLEPLUGIN_USERS_RECORD); + * + * $this->getProcessor()->aggregateDataTableRecords(self::EXAMPLEPLUGIN_ARCHIVE_RECORD); */ } |