🐘 Actions.php (Php) 730 bytes 2016-05-21
PHP module for Actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 | <?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\DataAccess;
use Piwik\Db;
use Piwik\Common;
/**
* Data Access Object for operations dealing with the log_action table.
*/
class Actions
{
/**
* Removes a list of actions from the log_action table by ID.
*
* @param int[] $idActions
*/
public function delete($idActions)
{
foreach ($idActions as &$id) {
$id = (int)$id;
}
$table = Common::prefixTable('log_action');
$sql = "DELETE FROM $table WHERE idaction IN (" . implode(",", $idActions) . ")";
Db::query($sql);
}
}
|
{
"@context": "https://schema.org",
"@type": "SoftwareSourceCode",
"name": "Actions.php",
"description": "PHP module for Actions",
"dateModified": "2016-05-21",
"dateCreated": "2025-03-23",
"contentSize": "730 bytes",
"contentUrl": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/DataAccess/Actions.php",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "Php"
},
"codeRepository": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/DataAccess/"
}
🐘 ArchiveSelector.php (Php) 13.6 KB 2016-05-21
PHP module for ArchiveSelector
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 | <?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\DataAccess;
use Exception;
use Piwik\Archive;
use Piwik\Archive\Chunk;
use Piwik\ArchiveProcessor;
use Piwik\ArchiveProcessor\Rules;
use Piwik\Common;
use Piwik\Date;
use Piwik\Db;
use Piwik\Period;
use Piwik\Period\Range;
use Piwik\Segment;
/**
* Data Access object used to query archives
*
* A record in the Database for a given report is defined by
* - idarchive = unique ID that is associated to all the data of this archive (idsite+period+date)
* - idsite = the ID of the website
* - date1 = starting day of the period
* - date2 = ending day of the period
* - period = integer that defines the period (day/week/etc.). @see period::getId()
* - ts_archived = timestamp when the archive was processed (UTC)
* - name = the name of the report (ex: uniq_visitors or search_keywords_by_search_engines)
* - value = the actual data (a numeric value, or a blob of compressed serialized data)
*
*/
class ArchiveSelector
{
const NB_VISITS_RECORD_LOOKED_UP = "nb_visits";
const NB_VISITS_CONVERTED_RECORD_LOOKED_UP = "nb_visits_converted";
private static function getModel()
{
return new Model();
}
public static function getArchiveIdAndVisits(ArchiveProcessor\Parameters $params, $minDatetimeArchiveProcessedUTC)
{
$idSite = $params->getSite()->getId();
... [truncated, 320 more lines] ...
|
{
"@context": "https://schema.org",
"@type": "SoftwareSourceCode",
"name": "ArchiveSelector.php",
"description": "PHP module for ArchiveSelector",
"dateModified": "2016-05-21",
"dateCreated": "2025-03-23",
"contentSize": "13.6 KB",
"contentUrl": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/DataAccess/ArchiveSelector.php",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "Php"
},
"codeRepository": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/DataAccess/"
}
🐘 ArchiveTableCreator.php (Php) 3.2 KB 2016-05-21
PHP module for ArchiveTableCreator
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 | <?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\DataAccess;
use Piwik\Common;
use Piwik\Date;
use Piwik\DbHelper;
class ArchiveTableCreator
{
const NUMERIC_TABLE = "numeric";
const BLOB_TABLE = "blob";
public static $tablesAlreadyInstalled = null;
public static function getNumericTable(Date $date)
{
return self::getTable($date, self::NUMERIC_TABLE);
}
public static function getBlobTable(Date $date)
{
return self::getTable($date, self::BLOB_TABLE);
}
protected static function getTable(Date $date, $type)
{
$tableNamePrefix = "archive_" . $type;
$tableName = $tableNamePrefix . "_" . self::getTableMonthFromDate($date);
$tableName = Common::prefixTable($tableName);
self::createArchiveTablesIfAbsent($tableName, $tableNamePrefix);
return $tableName;
}
protected static function createArchiveTablesIfAbsent($tableName, $tableNamePrefix)
{
if (is_null(self::$tablesAlreadyInstalled)) {
self::refreshTableList();
}
if (!in_array($tableName, self::$tablesAlreadyInstalled)) {
... [truncated, 74 more lines] ...
|
{
"@context": "https://schema.org",
"@type": "SoftwareSourceCode",
"name": "ArchiveTableCreator.php",
"description": "PHP module for ArchiveTableCreator",
"dateModified": "2016-05-21",
"dateCreated": "2025-03-23",
"contentSize": "3.2 KB",
"contentUrl": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/DataAccess/ArchiveTableCreator.php",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "Php"
},
"codeRepository": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/DataAccess/"
}
🐘 ArchiveTableDao.php (Php) 3.2 KB 2016-05-21
PHP module for ArchiveTableDao
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 | <?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\DataAccess;
use Piwik\Common;
use Piwik\Config;
use Piwik\Db;
/**
* Data Access class for querying numeric & blob archive tables.
*/
class ArchiveTableDao
{
/**
* Analyzes numeric & blob tables for a single table date (ie, `'2015_01'`) and returns
* statistics including:
*
* - number of archives present
* - number of invalidated archives
* - number of temporary archives
* - number of error archives
* - number of segment archives
* - number of numeric rows
* - number of blob rows
*
* @param string $tableDate ie `'2015_01'`
* @return array
*/
public function getArchiveTableAnalysis($tableDate)
{
$numericQueryEmptyRow = array(
'count_archives' => '-',
'count_invalidated_archives' => '-',
'count_temporary_archives' => '-',
'count_error_archives' => '-',
'count_segment_archives' => '-',
'count_numeric_rows' => '-',
);
$tableDate = str_replace("`", "", $tableDate); // for sanity
$numericTable = Common::prefixTable("archive_numeric_$tableDate");
$blobTable = Common::prefixTable("archive_blob_$tableDate");
... [truncated, 39 more lines] ...
|
{
"@context": "https://schema.org",
"@type": "SoftwareSourceCode",
"name": "ArchiveTableDao.php",
"description": "PHP module for ArchiveTableDao",
"dateModified": "2016-05-21",
"dateCreated": "2025-03-23",
"contentSize": "3.2 KB",
"contentUrl": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/DataAccess/ArchiveTableDao.php",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "Php"
},
"codeRepository": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/DataAccess/"
}
🐘 ArchiveWriter.php (Php) 7.5 KB 2016-05-21
PHP module for ArchiveWriter
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 | <?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\DataAccess;
use Exception;
use Piwik\Archive;
use Piwik\Archive\Chunk;
use Piwik\ArchiveProcessor\Rules;
use Piwik\ArchiveProcessor;
use Piwik\Db;
use Piwik\Db\BatchInsert;
use Piwik\Period;
/**
* This class is used to create a new Archive.
* An Archive is a set of reports (numeric and data tables).
* New data can be inserted in the archive with insertRecord/insertBulkRecords
*/
class ArchiveWriter
{
/**
* Flag stored at the end of the archiving
*
* @var int
*/
const DONE_OK = 1;
/**
* Flag stored at the start of the archiving
* When requesting an Archive, we make sure that non-finished archive are not considered valid
*
* @var int
*/
const DONE_ERROR = 2;
/**
* Flag indicates the archive is over a period that is not finished, eg. the current day, current week, etc.
* Archives flagged will be regularly purged from the DB.
*
* @var int
*/
const DONE_OK_TEMPORARY = 3;
/**
* Flag indicated that archive is done but was marked as invalid later and needs to be re-processed during next archiving process
*
... [truncated, 227 more lines] ...
|
{
"@context": "https://schema.org",
"@type": "SoftwareSourceCode",
"name": "ArchiveWriter.php",
"description": "PHP module for ArchiveWriter",
"dateModified": "2016-05-21",
"dateCreated": "2025-03-23",
"contentSize": "7.5 KB",
"contentUrl": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/DataAccess/ArchiveWriter.php",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "Php"
},
"codeRepository": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/DataAccess/"
}
🐘 LogAggregator.php (Php) 41.6 KB 2016-05-21
PHP module for LogAggregator
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 | <?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\DataAccess;
use Piwik\ArchiveProcessor\Parameters;
use Piwik\Common;
use Piwik\DataArray;
use Piwik\Db;
use Piwik\Metrics;
use Piwik\Tracker\GoalManager;
/**
* Contains methods that calculate metrics by aggregating log data (visits, actions, conversions,
* ecommerce items).
*
* You can use the methods in this class within {@link Piwik\Plugin\Archiver Archiver} descendants
* to aggregate log data without having to write SQL queries.
*
* ### Aggregation Dimension
*
* All aggregation methods accept a **dimension** parameter. These parameters are important as
* they control how rows in a table are aggregated together.
*
* A **_dimension_** is just a table column. Rows that have the same values for these columns are
* aggregated together. The result of these aggregations is a set of metrics for every recorded value
* of a **dimension**.
*
* _Note: A dimension is essentially the same as a **GROUP BY** field._
*
* ### Examples
*
* **Aggregating visit data**
*
* $archiveProcessor = // ...
* $logAggregator = $archiveProcessor->getLogAggregator();
*
* // get metrics for every used browser language of all visits by returning visitors
* $query = $logAggregator->queryVisitsByDimension(
* $dimensions = array('log_visit.location_browser_lang'),
* $where = 'log_visit.visitor_returning = 1',
*
* // also count visits for each browser language that are not located in the US
* $additionalSelects = array('sum(case when log_visit.location_country <> 'us' then 1 else 0 end) as nonus'),
*
... [truncated, 888 more lines] ...
|
{
"@context": "https://schema.org",
"@type": "SoftwareSourceCode",
"name": "LogAggregator.php",
"description": "PHP module for LogAggregator",
"dateModified": "2016-05-21",
"dateCreated": "2025-03-23",
"contentSize": "41.6 KB",
"contentUrl": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/DataAccess/LogAggregator.php",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "Php"
},
"codeRepository": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/DataAccess/"
}
🐘 LogQueryBuilder.php (Php) 15.4 KB 2016-05-21
PHP module for LogQueryBuilder
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 | <?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\DataAccess;
use Exception;
use Piwik\Common;
use Piwik\Segment\SegmentExpression;
class LogQueryBuilder
{
public function getSelectQueryString(SegmentExpression $segmentExpression, $select, $from, $where, $bind, $groupBy,
$orderBy, $limitAndOffset)
{
if (!is_array($from)) {
$from = array($from);
}
$fromInitially = $from;
if (!$segmentExpression->isEmpty()) {
$segmentExpression->parseSubExpressionsIntoSqlExpressions($from);
$segmentSql = $segmentExpression->getSql();
$where = $this->getWhereMatchBoth($where, $segmentSql['where']);
$bind = array_merge($bind, $segmentSql['bind']);
}
$joins = $this->generateJoinsString($from);
$joinWithSubSelect = $joins['joinWithSubSelect'];
$from = $joins['sql'];
// hack for https://github.com/piwik/piwik/issues/9194#issuecomment-164321612
$useSpecialConversionGroupBy = (!empty($segmentSql)
&& strpos($groupBy, 'log_conversion.idgoal') !== false
&& $fromInitially == array('log_conversion')
&& strpos($from, 'log_link_visit_action') !== false);
if ($useSpecialConversionGroupBy) {
$innerGroupBy = "CONCAT(log_conversion.idvisit, '_' , log_conversion.idgoal, '_', log_conversion.buster)";
$sql = $this->buildWrappedSelectQuery($select, $from, $where, $groupBy, $orderBy, $limitAndOffset, $innerGroupBy);
} elseif ($joinWithSubSelect) {
$sql = $this->buildWrappedSelectQuery($select, $from, $where, $groupBy, $orderBy, $limitAndOffset);
} else {
$sql = $this->buildSelectQuery($select, $from, $where, $groupBy, $orderBy, $limitAndOffset);
... [truncated, 349 more lines] ...
|
{
"@context": "https://schema.org",
"@type": "SoftwareSourceCode",
"name": "LogQueryBuilder.php",
"description": "PHP module for LogQueryBuilder",
"dateModified": "2016-05-21",
"dateCreated": "2025-03-23",
"contentSize": "15.4 KB",
"contentUrl": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/DataAccess/LogQueryBuilder.php",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "Php"
},
"codeRepository": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/DataAccess/"
}
🐘 Model.php (Php) 12.4 KB 2016-05-21
PHP module for Model
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 | <?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\DataAccess;
use Exception;
use Piwik\ArchiveProcessor\Rules;
use Piwik\Common;
use Piwik\Container\StaticContainer;
use Piwik\Db;
use Piwik\DbHelper;
use Piwik\Period;
use Piwik\Segment;
use Piwik\Sequence;
use Psr\Log\LoggerInterface;
/**
* Cleans up outdated archives
*
* @package Piwik\DataAccess
*/
class Model
{
/**
* @var LoggerInterface
*/
private $logger;
public function __construct(LoggerInterface $logger = null)
{
$this->logger = $logger ?: StaticContainer::get('Psr\Log\LoggerInterface');
}
/**
* Returns the archives IDs that have already been invalidated and have been since re-processed.
*
* These archives { archive name (includes segment hash) , idsite, date, period } will be deleted.
*
* @param string $archiveTable
* @param array $idSites
* @return array
* @throws Exception
*/
public function getInvalidatedArchiveIdsSafeToDelete($archiveTable, array $idSites)
{
... [truncated, 309 more lines] ...
|
{
"@context": "https://schema.org",
"@type": "SoftwareSourceCode",
"name": "Model.php",
"description": "PHP module for Model",
"dateModified": "2016-05-21",
"dateCreated": "2025-03-23",
"contentSize": "12.4 KB",
"contentUrl": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/DataAccess/Model.php",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "Php"
},
"codeRepository": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/DataAccess/"
}
🐘 RawLogDao.php (Php) 13.2 KB 2016-05-21
PHP module for RawLogDao
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 | <?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\DataAccess;
use Piwik\Common;
use Piwik\Container\StaticContainer;
use Piwik\Db;
use Piwik\Plugin\Dimension\DimensionMetadataProvider;
/**
* DAO that queries log tables.
*/
class RawLogDao
{
const DELETE_UNUSED_ACTIONS_TEMP_TABLE_NAME = 'tmp_log_actions_to_keep';
/**
* @var DimensionMetadataProvider
*/
private $dimensionMetadataProvider;
public function __construct(DimensionMetadataProvider $provider = null)
{
$this->dimensionMetadataProvider = $provider ?: StaticContainer::get('Piwik\Plugin\Dimension\DimensionMetadataProvider');
}
/**
* @param array $values
* @param string $idVisit
*/
public function updateVisits(array $values, $idVisit)
{
$sql = "UPDATE " . Common::prefixTable('log_visit')
. " SET " . $this->getColumnSetExpressions(array_keys($values))
. " WHERE idvisit = ?";
$this->update($sql, $values, $idVisit);
}
/**
* @param array $values
* @param string $idVisit
*/
public function updateConversions(array $values, $idVisit)
... [truncated, 352 more lines] ...
|
{
"@context": "https://schema.org",
"@type": "SoftwareSourceCode",
"name": "RawLogDao.php",
"description": "PHP module for RawLogDao",
"dateModified": "2016-05-21",
"dateCreated": "2025-03-23",
"contentSize": "13.2 KB",
"contentUrl": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/DataAccess/RawLogDao.php",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "Php"
},
"codeRepository": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/DataAccess/"
}
🐘 TableMetadata.php (Php) 1.4 KB 2016-05-21
PHP module for TableMetadata
{
"@context": "https://schema.org",
"@type": "SoftwareSourceCode",
"name": "TableMetadata.php",
"description": "PHP module for TableMetadata",
"dateModified": "2016-05-21",
"dateCreated": "2025-03-23",
"contentSize": "1.4 KB",
"contentUrl": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/DataAccess/TableMetadata.php",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "Php"
},
"codeRepository": "https://www.artikelschreiber.com/opensource/buzzerstar/static/core/DataAccess/"
}