Skip to content

Commit

Permalink
Merge pull request matomo-org#6827 from piwik/move_resolution_report
Browse files Browse the repository at this point in the history
Moved resolution reports to a new plugin
  • Loading branch information
Stefan Giehl committed Dec 13, 2014
2 parents 56ef81b + 1e66303 commit 00ea13b
Show file tree
Hide file tree
Showing 168 changed files with 1,373 additions and 636 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ This is a changelog for Piwik platform developers. All changes for our HTTP API'
* The API method `UserSettings.getOS` is deprecated and will be removed from May 1st 2015. Use `DevicesDetection.getOsVersions` instead
* The API method `UserSettings.getMobileVsDesktop` is deprecated and will be removed from May 1st 2015. Use `DevicesDetection.getType` instead
* The API method `UserSettings.getBrowserType` is deprecated and will be removed from May 1st 2015. Use `DevicesDetection.getBrowserEngines` instead
* The API method `UserSettings.getResolution` is deprecated and will be removed from May 1st 2015. Use `Resolution.getResolution` instead
* The API method `UserSettings.getConfiguration` is deprecated and will be removed from May 1st 2015. Use `Resolution.getConfiguration` instead
* The API method `UserSettings.getWideScreen` has been removed

### Library updates
Expand Down
1 change: 1 addition & 0 deletions config/global.ini.php
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,7 @@
Plugins[] = Contents
Plugins[] = TestRunner
Plugins[] = BulkTracking
Plugins[] = Resolution

[PluginsInstalled]
PluginsInstalled[] = Login
Expand Down
2 changes: 1 addition & 1 deletion core/Plugin/Segment.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function setCategory($category)

/**
* Set (overwrite) the segment display name. This name will be visible in the API and the UI. It should be a
* translation key such as 'Actions_ColumnEntryPageTitle' or 'UserSettings_ColumnResolution'.
* translation key such as 'Actions_ColumnEntryPageTitle' or 'Resolution_ColumnResolution'.
* @param string $name
* @api
*/
Expand Down
50 changes: 50 additions & 0 deletions core/Updates/2.10.0-b7.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?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_b7 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());

$pluginManager = \Piwik\Plugin\Manager::getInstance();

try {
$pluginManager->activatePlugin('Resolution');
} catch(\Exception $e) {
}
}

}
2 changes: 1 addition & 1 deletion core/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ final class Version
* The current Piwik version.
* @var string
*/
const VERSION = '2.10.0-b6';
const VERSION = '2.10.0-b7';
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
<referrerUrl />
<referrerSearchEngineUrl />
<referrerSearchEngineIcon />
<resolution>1024x768</resolution>
<continent>Europe</continent>
<continentCode>eur</continentCode>
<country>France</country>
Expand All @@ -77,7 +78,6 @@
<location>France</location>
<latitude />
<longitude />
<resolution>1024x768</resolution>
<plugins>flash, java</plugins>
<pluginsIcons>
<row>
Expand Down Expand Up @@ -164,6 +164,7 @@
<referrerUrl />
<referrerSearchEngineUrl />
<referrerSearchEngineIcon />
<resolution>1024x768</resolution>
<continent>Europe</continent>
<continentCode>eur</continentCode>
<country>France</country>
Expand All @@ -175,7 +176,6 @@
<location>France</location>
<latitude />
<longitude />
<resolution>1024x768</resolution>
<plugins>director</plugins>
<pluginsIcons>
<row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
<referrerUrl />
<referrerSearchEngineUrl />
<referrerSearchEngineIcon />
<resolution>1024x768</resolution>
<continent>Europe</continent>
<continentCode>eur</continentCode>
<country>France</country>
Expand All @@ -77,7 +78,6 @@
<location>France</location>
<latitude />
<longitude />
<resolution>1024x768</resolution>
<plugins>flash, java</plugins>
<pluginsIcons>
<row>
Expand Down Expand Up @@ -164,6 +164,7 @@
<referrerUrl />
<referrerSearchEngineUrl />
<referrerSearchEngineIcon />
<resolution>1024x768</resolution>
<continent>Europe</continent>
<continentCode>eur</continentCode>
<country>France</country>
Expand All @@ -175,7 +176,6 @@
<location>France</location>
<latitude />
<longitude />
<resolution>1024x768</resolution>
<plugins>director</plugins>
<pluginsIcons>
<row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
<referrerUrl />
<referrerSearchEngineUrl />
<referrerSearchEngineIcon />
<resolution>1024x768</resolution>
<continent>Europe</continent>
<continentCode>eur</continentCode>
<country>France</country>
Expand All @@ -77,7 +78,6 @@
<location>France</location>
<latitude />
<longitude />
<resolution>1024x768</resolution>
<plugins>flash, java</plugins>
<pluginsIcons>
<row>
Expand Down Expand Up @@ -164,6 +164,7 @@
<referrerUrl />
<referrerSearchEngineUrl />
<referrerSearchEngineIcon />
<resolution>1024x768</resolution>
<continent>Europe</continent>
<continentCode>eur</continentCode>
<country>France</country>
Expand All @@ -175,7 +176,6 @@
<location>France</location>
<latitude />
<longitude />
<resolution>1024x768</resolution>
<plugins>director</plugins>
<pluginsIcons>
<row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
<referrerUrl />
<referrerSearchEngineUrl />
<referrerSearchEngineIcon />
<resolution>1024x768</resolution>
<continent>Europe</continent>
<continentCode>eur</continentCode>
<country>France</country>
Expand All @@ -77,7 +78,6 @@
<location>France</location>
<latitude />
<longitude />
<resolution>1024x768</resolution>
<plugins>flash, java</plugins>
<pluginsIcons>
<row>
Expand Down Expand Up @@ -164,6 +164,7 @@
<referrerUrl />
<referrerSearchEngineUrl />
<referrerSearchEngineIcon />
<resolution>1024x768</resolution>
<continent>Europe</continent>
<continentCode>eur</continentCode>
<country>France</country>
Expand All @@ -175,7 +176,6 @@
<location>France</location>
<latitude />
<longitude />
<resolution>1024x768</resolution>
<plugins>director</plugins>
<pluginsIcons>
<row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
<referrerUrl />
<referrerSearchEngineUrl />
<referrerSearchEngineIcon />
<resolution>1024x768</resolution>
<continent>Europe</continent>
<continentCode>eur</continentCode>
<country>France</country>
Expand All @@ -77,7 +78,6 @@
<location>France</location>
<latitude />
<longitude />
<resolution>1024x768</resolution>
<plugins>flash, java</plugins>
<pluginsIcons>
<row>
Expand Down Expand Up @@ -164,6 +164,7 @@
<referrerUrl />
<referrerSearchEngineUrl />
<referrerSearchEngineIcon />
<resolution>1024x768</resolution>
<continent>Europe</continent>
<continentCode>eur</continentCode>
<country>France</country>
Expand All @@ -175,7 +176,6 @@
<location>France</location>
<latitude />
<longitude />
<resolution>1024x768</resolution>
<plugins>director</plugins>
<pluginsIcons>
<row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
<referrerUrl>http://www.google.com/search?q=this+keyword+should+be+ranked</referrerUrl>
<referrerSearchEngineUrl>http://google.com</referrerSearchEngineUrl>
<referrerSearchEngineIcon>plugins/Referrers/images/searchEngines/google.com.png</referrerSearchEngineIcon>
<resolution>1024x768</resolution>
<continent>Europe</continent>
<continentCode>eur</continentCode>
<country>France</country>
Expand All @@ -150,7 +151,6 @@
<location>France</location>
<latitude />
<longitude />
<resolution>1024x768</resolution>
<plugins>flash, java</plugins>
<pluginsIcons>
<row>
Expand Down
2 changes: 1 addition & 1 deletion plugins/Live/templates/_dataTableViz_visitorLog.twig
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
{% endif %}
{% if visitor.getColumn('operatingSystemIcon') %}&nbsp;
<img src="{{ visitor.getColumn('operatingSystemIcon') }}"
title="{{ visitor.getColumn('operatingSystem') }}, {{ visitor.getColumn('resolution') }}"/>{% endif %}
title="{{ visitor.getColumn('operatingSystem') }}{% if visitor.getColumn('resolution') %}, {{ visitor.getColumn('resolution') }}{% endif %}"/>{% endif %}
{% if visitor.getColumn('visitorTypeIcon') %}
{% if visitor.getColumn('visitorTypeIcon') %}&nbsp;-
<img src="{{ visitor.getColumn('visitorTypeIcon') }}"
Expand Down
2 changes: 1 addition & 1 deletion plugins/Live/templates/getLastVisitsStart.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{{ visitor.serverDatePretty }} - {{ visitor.serverTimePretty }} {% if visitor.visitDuration > 0 %}<em>({{ visitor.visitDurationPretty|raw }})</em>{% endif %}
{% if visitor.countryFlag is defined %}&nbsp;<img src="{{ visitor.countryFlag }}" title="{{ visitor.location }}, {{ 'Provider_ColumnProvider'|translate }} {% if visitor.providerName is defined %}{{ visitor.providerName }}{% endif %}"/>{% endif %}
{% if visitor.browserIcon is defined %}&nbsp;<img src="{{ visitor.browserIcon }}" title="{{ visitor.browserName }}, {{ 'General_Plugins'|translate }}: {{ visitor.plugins }}"/>{% endif %}
{% if visitor.operatingSystemIcon is defined %}&nbsp;<img src="{{ visitor.operatingSystemIcon }}" title="{{ visitor.operatingSystem }}, {{ visitor.resolution }}"/>{% endif %}
{% if visitor.operatingSystemIcon is defined %}&nbsp;<img src="{{ visitor.operatingSystemIcon }}" title="{{ visitor.operatingSystem }}{% if visitor.resolution is defined %}, {{ visitor.resolution }}{% endif %}"/>{% endif %}
&nbsp;
{% if visitor.visitConverted %}
<span title="{{ 'General_VisitConvertedNGoals'|translate(visitor.goalConversions) }}" class='visitorRank'>
Expand Down
2 changes: 1 addition & 1 deletion plugins/Live/templates/getSingleVisitSummary.twig
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
{% if visitData.operatingSystemIcon is defined %}<img src="{{ visitData.operatingSystemIcon }}"/>{% endif %}{% if visitData.operatingSystem is defined %}<span>{{ visitData.operatingSystem }}</span>{% endif %}
</div>
</li>
{% if visitData.resolution is defined %}<li><span>{{ 'UserSettings_ColumnResolution'|translate }}</span><strong>{{ visitData.resolution }}</strong></li>{% endif %}
{% if visitData.resolution is defined %}<li><span>{{ 'Resolution_ColumnResolution'|translate }}</span><strong>{{ visitData.resolution }}</strong></li>{% endif %}
{% if visitData.userId is not empty %}<li><span>{{ 'General_UserId'|translate }}</span><strong>{{ visitData.userId|raw }}</strong></li>{% endif %}
{% if visitReferralSummary is defined %}
{%- set keywordNotDefined = 'General_NotDefined'|translate('General_ColumnKeyword'|translate) -%}
Expand Down
49 changes: 49 additions & 0 deletions plugins/Resolution/API.php
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;
}
}
Loading

0 comments on commit 00ea13b

Please sign in to comment.