diff options
Diffstat (limited to 'modules/ArchiveProcessing/Day.php')
-rw-r--r-- | modules/ArchiveProcessing/Day.php | 258 |
1 files changed, 129 insertions, 129 deletions
diff --git a/modules/ArchiveProcessing/Day.php b/modules/ArchiveProcessing/Day.php index 7f3773ed75..d5b68b2139 100644 --- a/modules/ArchiveProcessing/Day.php +++ b/modules/ArchiveProcessing/Day.php @@ -1,14 +1,14 @@ -<?php
-/**
- * Piwik - Open source web analytics
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
- * @version $Id$
- *
- * @package Piwik_ArchiveProcessing
- */
-
+<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later + * @version $Id$ + * + * @package Piwik_ArchiveProcessing + */ + /** * Handles the archiving process for a day. @@ -28,8 +28,8 @@ class Piwik_ArchiveProcessing_Day extends Piwik_ArchiveProcessing */ public $isThereSomeVisits = false; - /**
- * Constructor
+ /** + * Constructor */ function __construct() { @@ -38,10 +38,10 @@ class Piwik_ArchiveProcessing_Day extends Piwik_ArchiveProcessing } /** - * Main method to process logs for a day. The only logic done here is computing the number of visits, actions, etc.
- * All the other reports are computed inside plugins listening to the event 'ArchiveProcessing_Day.compute'.
- * See some of the plugins for an example eg. 'Provider'
- *
+ * Main method to process logs for a day. The only logic done here is computing the number of visits, actions, etc. + * All the other reports are computed inside plugins listening to the event 'ArchiveProcessing_Day.compute'. + * See some of the plugins for an example eg. 'Provider' + * * @return void */ protected function compute() @@ -100,23 +100,23 @@ class Piwik_ArchiveProcessing_Day extends Piwik_ArchiveProcessing Zend_Registry::get('db')->query(sprintf($query, $blobTable), $this->periodId); Zend_Registry::get('db')->query(sprintf($query, $numericTable), $this->periodId); } -
- /**
- * Helper function that returns a DataTable containing the $select fields / value pairs.
- * IMPORTANT: The $select must return only one row!!
- *
- * Example $select = "count(distinct( config_os )) as countDistinctOs,
- * sum( config_flash ) / count(distinct(idvisit)) as percentFlash "
- * $labelCount = "test_column_name"
- * will return a dataTable that looks like
- * label test_column_name
- * CountDistinctOs 9
- * PercentFlash 0.5676
- *
- *
- * @param string $select
- * @param string $labelCount
- * @return Piwik_DataTable
+ + /** + * Helper function that returns a DataTable containing the $select fields / value pairs. + * IMPORTANT: The $select must return only one row!! + * + * Example $select = "count(distinct( config_os )) as countDistinctOs, + * sum( config_flash ) / count(distinct(idvisit)) as percentFlash " + * $labelCount = "test_column_name" + * will return a dataTable that looks like + * label test_column_name + * CountDistinctOs 9 + * PercentFlash 0.5676 + * + * + * @param string $select + * @param string $labelCount + * @return Piwik_DataTable */ public function getSimpleDataTableFromSelect($select, $labelCount) { @@ -135,28 +135,28 @@ class Piwik_ArchiveProcessing_Day extends Piwik_ArchiveProcessing return $table; } - /**
- * Helper function that returns common statistics for a given database field distinct values.
- *
- * The statistics returned are:
- * - number of unique visitors
- * - number of visits
- * - number of actions
- * - maximum number of action for a visit
- * - sum of the visits' length in sec
- * - count of bouncing visits (visits with one page view)
- *
- * For example if $label = 'config_os' it will return the statistics for every distinct Operating systems
- * The returned DataTable will have a row per distinct operating systems,
- * and a column per stat (nb of visits, max actions, etc)
- *
- * label nb_uniq_visitors nb_visits nb_actions max_actions sum_visit_length bounce_count
- * Linux 27 66 66 1 660 66
- * Windows XP 12 39 39 1 390 39
- * Mac OS 15 36 36 1 360 36
- *
- * @param string $label Table log_visit field name to be use to compute common stats
- * @return Piwik_DataTable
+ /** + * Helper function that returns common statistics for a given database field distinct values. + * + * The statistics returned are: + * - number of unique visitors + * - number of visits + * - number of actions + * - maximum number of action for a visit + * - sum of the visits' length in sec + * - count of bouncing visits (visits with one page view) + * + * For example if $label = 'config_os' it will return the statistics for every distinct Operating systems + * The returned DataTable will have a row per distinct operating systems, + * and a column per stat (nb of visits, max actions, etc) + * + * label nb_uniq_visitors nb_visits nb_actions max_actions sum_visit_length bounce_count + * Linux 27 66 66 1 660 66 + * Windows XP 12 39 39 1 390 39 + * Mac OS 15 36 36 1 360 36 + * + * @param string $label Table log_visit field name to be use to compute common stats + * @return Piwik_DataTable */ public function getDataTableInterestForLabel( $label ) { @@ -195,14 +195,14 @@ class Piwik_ArchiveProcessing_Day extends Piwik_ArchiveProcessing $table->loadFromArrayLabelIsKey($interest); return $table; } -
- /**
- * Generates a dataTable given a multidimensional PHP array that associates LABELS to Piwik_DataTableRows
- * This is used for the "Actions" DataTable, where a line is the aggregate of all the subtables
- * Example: the category /blog has 3 visits because it has /blog/index (2 visits) + /blog/about (1 visit)
- *
- * @param array $table
- * @return Piwik_DataTable
+ + /** + * Generates a dataTable given a multidimensional PHP array that associates LABELS to Piwik_DataTableRows + * This is used for the "Actions" DataTable, where a line is the aggregate of all the subtables + * Example: the category /blog has 3 visits because it has /blog/index (2 visits) + /blog/about (1 visit) + * + * @param array $table + * @return Piwik_DataTable */ static public function generateDataTable( $table ) { @@ -232,17 +232,17 @@ class Piwik_ArchiveProcessing_Day extends Piwik_ArchiveProcessing return $dataTableToReturn; } -
- /**
- * Helper function that returns the serialized DataTable of the given PHP array.
- * The array must have the format of Piwik_DataTable::loadFromArrayLabelIsKey()
- * Example: array (
- * LABEL => array(col1 => X, col2 => Y),
- * LABEL2 => array(col1 => X, col2 => Y),
- * )
- *
- * @param array $array at the given format
- * @return array Array with one element: the serialized data table string
+ + /** + * Helper function that returns the serialized DataTable of the given PHP array. + * The array must have the format of Piwik_DataTable::loadFromArrayLabelIsKey() + * Example: array ( + * LABEL => array(col1 => X, col2 => Y), + * LABEL2 => array(col1 => X, col2 => Y), + * ) + * + * @param array $array at the given format + * @return array Array with one element: the serialized data table string */ public function getDataTableSerialized( $arrayLevel0 ) { @@ -252,29 +252,29 @@ class Piwik_ArchiveProcessing_Day extends Piwik_ArchiveProcessing return $toReturn; } -
- /**
- * Helper function that returns the multiple serialized DataTable of the given PHP array.
- * The DataTable here associates a subtable to every row of the level 0 array.
- * This is used for example for search engines. Every search engine (level 0) has a subtable containing the
- * keywords.
- *
- * The $arrayLevel0 must have the format
- * Example: array (
- * LABEL => array(col1 => X, col2 => Y),
- * LABEL2 => array(col1 => X, col2 => Y),
- * )
- *
- * The $subArrayLevel1ByKey must have the format
- * Example: array(
- * LABEL => #Piwik_DataTable_ForLABEL,
- * LABEL2 => #Piwik_DataTable_ForLABEL2,
- * )
- *
- *
- * @param array $arrayLevel0
- * @param array of Piwik_DataTable $subArrayLevel1ByKey
- * @return array Array with N elements: the strings of the datatable serialized
+ + /** + * Helper function that returns the multiple serialized DataTable of the given PHP array. + * The DataTable here associates a subtable to every row of the level 0 array. + * This is used for example for search engines. Every search engine (level 0) has a subtable containing the + * keywords. + * + * The $arrayLevel0 must have the format + * Example: array ( + * LABEL => array(col1 => X, col2 => Y), + * LABEL2 => array(col1 => X, col2 => Y), + * ) + * + * The $subArrayLevel1ByKey must have the format + * Example: array( + * LABEL => #Piwik_DataTable_ForLABEL, + * LABEL2 => #Piwik_DataTable_ForLABEL2, + * ) + * + * + * @param array $arrayLevel0 + * @param array of Piwik_DataTable $subArrayLevel1ByKey + * @return array Array with N elements: the strings of the datatable serialized */ public function getDataTablesSerialized( $arrayLevel0, $subArrayLevel1ByKey) { @@ -294,11 +294,11 @@ class Piwik_ArchiveProcessing_Day extends Piwik_ArchiveProcessing return $toReturn; } -
- /**
- * Returns an empty row containing default values for the common stat
- *
- * @return array
+ + /** + * Returns an empty row containing default values for the common stat + * + * @return array */ public function getNewInterestRow() { @@ -310,32 +310,32 @@ class Piwik_ArchiveProcessing_Day extends Piwik_ArchiveProcessing Piwik_Archive::INDEX_BOUNCE_COUNT => 0 ); } -
-
- /**
- * Returns a Piwik_DataTable_Row containing default values for common stat,
- * plus a column 'label' with the value $label
- *
- * @param string $label
- * @return Piwik_DataTable_Row
- */
- public function getNewInterestRowLabeled( $label )
- {
- return new Piwik_DataTable_Row(
- array(
- Piwik_DataTable_Row::COLUMNS => array( 'label' => $label)
- + $this->getNewInterestRow()
- )
- );
- }
-
- /**
- * Adds the given row $newRowToAdd to the existing $oldRowToUpdate passed by reference
- *
- * The rows are php arrays Name => value
- *
- * @param array $newRowToAdd
- * @param array $oldRowToUpdate
+ + + /** + * Returns a Piwik_DataTable_Row containing default values for common stat, + * plus a column 'label' with the value $label + * + * @param string $label + * @return Piwik_DataTable_Row + */ + public function getNewInterestRowLabeled( $label ) + { + return new Piwik_DataTable_Row( + array( + Piwik_DataTable_Row::COLUMNS => array( 'label' => $label) + + $this->getNewInterestRow() + ) + ); + } + + /** + * Adds the given row $newRowToAdd to the existing $oldRowToUpdate passed by reference + * + * The rows are php arrays Name => value + * + * @param array $newRowToAdd + * @param array $oldRowToUpdate */ public function updateInterestStats( $newRowToAdd, &$oldRowToUpdate) { |