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