forked from matomo-org/matomo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moved resolution and configuration reports to a new plugin
- Loading branch information
Showing
30 changed files
with
365 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?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\Updates; | ||
|
||
use Piwik\DataAccess\ArchiveTableCreator; | ||
use Piwik\Updater; | ||
use Piwik\Updates; | ||
|
||
class Updates_2_10_0_b6 extends Updates | ||
{ | ||
|
||
static function getSql() | ||
{ | ||
$sqls = array(); | ||
|
||
$archiveTables = ArchiveTableCreator::getTablesArchivesInstalled(); | ||
|
||
$archiveBlobTables = array_filter($archiveTables, function($name) { | ||
return ArchiveTableCreator::getTypeFromTableName($name) == ArchiveTableCreator::BLOB_TABLE; | ||
}); | ||
|
||
foreach ($archiveBlobTables as $table) { | ||
|
||
$sqls["UPDATE " . $table . " SET name = 'Resolution_resolution' WHERE name = 'UserSettings_resolution'"] = false; | ||
$sqls["UPDATE " . $table . " SET name = 'Resolution_configuration' WHERE name = 'UserSettings_configuration'"] = false; | ||
} | ||
|
||
return $sqls; | ||
} | ||
|
||
static function update() | ||
{ | ||
Updater::updateDatabase(__FILE__, self::getSql()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?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\Plugins\Resolution; | ||
|
||
use Piwik\Archive; | ||
use Piwik\DataTable; | ||
use Piwik\Metrics; | ||
use Piwik\Piwik; | ||
|
||
/** | ||
* @see plugins/Resolution/functions.php | ||
*/ | ||
require_once PIWIK_INCLUDE_PATH . '/plugins/Resolution/functions.php'; | ||
|
||
/** | ||
* @method static \Piwik\Plugins\Resolution\API getInstance() | ||
*/ | ||
class API extends \Piwik\Plugin\API | ||
{ | ||
protected function getDataTable($name, $idSite, $period, $date, $segment) | ||
{ | ||
Piwik::checkUserHasViewAccess($idSite); | ||
$archive = Archive::build($idSite, $period, $date, $segment); | ||
$dataTable = $archive->getDataTable($name); | ||
$dataTable->filter('Sort', array(Metrics::INDEX_NB_VISITS)); | ||
$dataTable->queueFilter('ReplaceColumnNames'); | ||
$dataTable->queueFilter('ReplaceSummaryRowLabel'); | ||
return $dataTable; | ||
} | ||
|
||
public function getResolution($idSite, $period, $date, $segment = false) | ||
{ | ||
$dataTable = $this->getDataTable(Archiver::RESOLUTION_RECORD_NAME, $idSite, $period, $date, $segment); | ||
return $dataTable; | ||
} | ||
|
||
public function getConfiguration($idSite, $period, $date, $segment = false) | ||
{ | ||
$dataTable = $this->getDataTable(Archiver::CONFIGURATION_RECORD_NAME, $idSite, $period, $date, $segment); | ||
$dataTable->queueFilter('ColumnCallbackReplace', array('label', __NAMESPACE__ . '\getConfigurationLabel')); | ||
return $dataTable; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?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\Plugins\Resolution; | ||
|
||
use Piwik\DataTable; | ||
use Piwik\Metrics; | ||
|
||
/** | ||
* Archiver for Resolution Plugin | ||
* | ||
* @see PluginsArchiver | ||
*/ | ||
class Archiver extends \Piwik\Plugin\Archiver | ||
{ | ||
const RESOLUTION_RECORD_NAME = 'Resolution_resolution'; | ||
const CONFIGURATION_RECORD_NAME = 'Resolution_configuration'; | ||
const RESOLUTION_DIMENSION = "log_visit.config_resolution"; | ||
const CONFIGURATION_DIMENSION = "CONCAT(log_visit.config_os, ';', log_visit.config_browser_name, ';', log_visit.config_resolution)"; | ||
|
||
public function aggregateDayReport() | ||
{ | ||
$this->aggregateByResolution(); | ||
$this->aggregateByConfiguration(); | ||
} | ||
|
||
/** | ||
* Period archiving: simply sums up daily archives | ||
*/ | ||
public function aggregateMultipleReports() | ||
{ | ||
$dataTableRecords = array( | ||
self::RESOLUTION_RECORD_NAME, | ||
self::CONFIGURATION_RECORD_NAME, | ||
); | ||
$this->getProcessor()->aggregateDataTableRecords($dataTableRecords, $this->maximumRows); | ||
} | ||
|
||
protected function aggregateByConfiguration() | ||
{ | ||
$metrics = $this->getLogAggregator()->getMetricsFromVisitByDimension(self::CONFIGURATION_DIMENSION)->asDataTable(); | ||
$this->insertTable(self::CONFIGURATION_RECORD_NAME, $metrics); | ||
} | ||
|
||
protected function aggregateByResolution() | ||
{ | ||
$table = $this->getLogAggregator()->getMetricsFromVisitByDimension(self::RESOLUTION_DIMENSION)->asDataTable(); | ||
$table->filter('ColumnCallbackDeleteRow', array('label', function ($value) { | ||
return strlen($value) <= 5; | ||
})); | ||
$this->insertTable(self::RESOLUTION_RECORD_NAME, $table); | ||
return $table; | ||
} | ||
|
||
protected function insertTable($recordName, DataTable $table) | ||
{ | ||
$report = $table->getSerialized($this->maximumRows, null, Metrics::INDEX_NB_VISITS); | ||
return $this->getProcessor()->insertBlobRecord($recordName, $report); | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?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\Plugins\Resolution\Reports; | ||
|
||
use Piwik\Plugin\ViewDataTable; | ||
use Piwik\Plugins\CoreVisualizations\Visualizations\Graph; | ||
|
||
abstract class Base extends \Piwik\Plugin\Report | ||
{ | ||
protected function init() | ||
{ | ||
$this->category = 'UserSettings_VisitorSettings'; | ||
} | ||
|
||
protected function getBasicResolutionDisplayProperties(ViewDataTable $view) | ||
{ | ||
$view->config->show_search = false; | ||
$view->config->show_exclude_low_population = false; | ||
|
||
$view->requestConfig->filter_limit = 5; | ||
|
||
if ($view->isViewDataTableId(Graph::ID)) { | ||
$view->config->max_graph_elements = 5; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.