Db
6 years ago
Handler
6 years ago
TableLogAction
6 years ago
Visit
6 years ago
Action.php
6 years ago
ActionPageview.php
6 years ago
Cache.php
6 years ago
Db.php
6 years ago
Failures.php
6 years ago
FingerprintSalt.php
6 years ago
GoalManager.php
6 years ago
Handler.php
6 years ago
IgnoreCookie.php
6 years ago
LogTable.php
6 years ago
Model.php
6 years ago
PageUrl.php
6 years ago
Request.php
5 years ago
RequestProcessor.php
6 years ago
RequestSet.php
6 years ago
Response.php
6 years ago
ScheduledTasksRunner.php
6 years ago
Settings.php
5 years ago
TableLogAction.php
6 years ago
TrackerCodeGenerator.php
6 years ago
TrackerConfig.php
6 years ago
Visit.php
5 years ago
VisitExcluded.php
6 years ago
VisitInterface.php
6 years ago
Visitor.php
6 years ago
VisitorNotFoundInDb.php
6 years ago
VisitorRecognizer.php
6 years ago
LogTable.php
123 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Piwik - free/libre analytics platform |
| 4 | * |
| 5 | * @link https://matomo.org |
| 6 | * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later |
| 7 | * |
| 8 | */ |
| 9 | namespace Piwik\Tracker; |
| 10 | |
| 11 | /** |
| 12 | * Base class for LogTables. You need to create a log table eg if you want to be able to create a segment for a custom |
| 13 | * log table. |
| 14 | */ |
| 15 | abstract class LogTable { |
| 16 | |
| 17 | /** |
| 18 | * Get the unprefixed database table name. For example 'log_visit' or 'log_action'. |
| 19 | * @return string |
| 20 | */ |
| 21 | abstract public function getName(); |
| 22 | |
| 23 | /** |
| 24 | * Get the name of the column that represents the primary key. For example "idvisit" or "idlink_va". If the table |
| 25 | * does not have a unique ID for each row, you may choose a column that comes closest to it, for example "idvisit". |
| 26 | * @return string |
| 27 | */ |
| 28 | public function getIdColumn() |
| 29 | { |
| 30 | return ''; |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Get the name of the column that can be used to join a visit with another table. This is the name of the column |
| 35 | * that represents the "idvisit". |
| 36 | * @return string |
| 37 | */ |
| 38 | public function getColumnToJoinOnIdVisit() |
| 39 | { |
| 40 | return ''; |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Get the name of the column that can be used to join an action with another table. This is the name of the column |
| 45 | * that represents the "idaction". |
| 46 | * |
| 47 | * This could be more generic eg by specifiying "$this->joinableOn = array('action' => 'idaction') and this |
| 48 | * would allow to also add more complex structures in the future but not needed for now I'd say. Let's go with |
| 49 | * simpler, more clean and expressive solution for now until needed. |
| 50 | * |
| 51 | * @return string |
| 52 | */ |
| 53 | public function getColumnToJoinOnIdAction() |
| 54 | { |
| 55 | return ''; |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * If a table can neither be joined via idVisit nor idAction, it should be given a way to join with other tables |
| 60 | * so the log table can be joined via idvisit through a different table joins. |
| 61 | * |
| 62 | * For this to work it requires the same column to be present in two tables. If for example you have a table |
| 63 | * `log_foo_bar (idlogfoobar, idlogfoo)` and a table `log_foo(idlogfoo, idsite, idvisit)`, then you can in the |
| 64 | * log table instance for `log_foo_bar` return `array('log_foo' => 'idlogfoo')`. This tells the core that a join |
| 65 | * with that other log table is possible using the specified column. |
| 66 | * @return array |
| 67 | */ |
| 68 | public function getWaysToJoinToOtherLogTables() |
| 69 | { |
| 70 | return array(); |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * Defines whether this table should be joined via a subselect. Return true if a complex join is needed. (eg when |
| 75 | * having visits and needing actions, or when having visits and needing conversions, or vice versa). |
| 76 | * @return bool |
| 77 | */ |
| 78 | public function shouldJoinWithSubSelect() |
| 79 | { |
| 80 | return false; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Defines a column that stores the date/time at which time an entry was written or updated. Setting this |
| 85 | * can help improve the performance of some archive queries. For example the log_link_visit_action table would define |
| 86 | * server_time while log_visit would define visit_last_action_time |
| 87 | * @return string |
| 88 | */ |
| 89 | public function getDateTimeColumn() |
| 90 | { |
| 91 | return ''; |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Returns the name of a log table that allows to join on a visit. Eg if there is a table "action", and it is not |
| 96 | * joinable with "visit" table, it can return "log_link_visit_action" to be able to join the action table on visit |
| 97 | * via this link table. |
| 98 | * |
| 99 | * In theory there could be case where it may be needed to join via two tables, so it could be needed at some |
| 100 | * point to return an array of tables here. not sure if we should handle this case just yet. Alternatively, |
| 101 | * once needed eg in LogQueryBuilder, we should maybe better call instead ->getLinkTableToBeAbleToJoinOnVisit() |
| 102 | * again on the returned table until we have found a table that can be joined with visit. |
| 103 | * |
| 104 | * @return string |
| 105 | */ |
| 106 | public function getLinkTableToBeAbleToJoinOnVisit() |
| 107 | { |
| 108 | return; |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * Get the names of the columns that represents the primary key. For example "idvisit" or "idlink_va". If the table |
| 113 | * defines the primary key based on multiple columns, you must specify them all |
| 114 | * (eg array('idvisit', 'idgoal', 'buster')). |
| 115 | * |
| 116 | * @return array |
| 117 | */ |
| 118 | public function getPrimaryKey() |
| 119 | { |
| 120 | return array(); |
| 121 | } |
| 122 | } |
| 123 |