Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorMatthieu Napoli <matthieu@mnapoli.fr>2015-02-09 06:20:42 +0300
committerMatthieu Napoli <matthieu@mnapoli.fr>2015-02-09 06:20:42 +0300
commit5723e93aaeeee34914abc41869c24a1e10476f31 (patch)
treec99491c32822281aab067f0ea9c5378623e80778 /core
parent47772c937bf32baa1ad2af3dbf96e70354a64d59 (diff)
parent8a15d3a0ee47d24582843cd0c157d69ff16a8907 (diff)
Merge branch 'master' into removed-registry
Conflicts: CHANGELOG.md
Diffstat (limited to 'core')
-rw-r--r--core/API/Proxy.php2
-rw-r--r--core/API/Request.php8
-rw-r--r--core/Archive.php2
-rw-r--r--core/ArchiveProcessor/Rules.php19
-rw-r--r--core/Piwik.php2
-rw-r--r--core/Plugin/ComponentFactory.php4
-rw-r--r--core/Plugin/Controller.php67
-rw-r--r--core/Plugin/Manager.php6
-rw-r--r--core/Plugin/Report.php2
-rw-r--r--core/Tracker/PageUrl.php17
-rw-r--r--core/Updates/2.11.0-b4.php49
-rw-r--r--core/Url.php2
-rw-r--r--core/UrlHelper.php1
-rw-r--r--core/Version.php2
-rw-r--r--core/ViewDataTable/Config.php6
-rw-r--r--core/ViewDataTable/Factory.php2
-rw-r--r--core/WidgetsList.php2
17 files changed, 144 insertions, 49 deletions
diff --git a/core/API/Proxy.php b/core/API/Proxy.php
index f442949a3c..0345693b62 100644
--- a/core/API/Proxy.php
+++ b/core/API/Proxy.php
@@ -415,7 +415,7 @@ class Proxy extends Singleton
}
/**
- * Includes the class API by looking up plugins/UserSettings/API.php
+ * Includes the class API by looking up plugins/xxx/API.php
*
* @param string $fileName api class name eg. "API"
* @throws Exception
diff --git a/core/API/Request.php b/core/API/Request.php
index 631b7c089c..8fd3518093 100644
--- a/core/API/Request.php
+++ b/core/API/Request.php
@@ -46,7 +46,7 @@ use Piwik\Log;
*
* **Basic Usage**
*
- * $request = new Request('method=UserSettings.getLanguage&idSite=1&date=yesterday&period=week'
+ * $request = new Request('method=UserLanguage.getLanguage&idSite=1&date=yesterday&period=week'
* . '&format=xml&filter_limit=5&filter_offset=0')
* $result = $request->process();
* echo $result;
@@ -54,7 +54,7 @@ use Piwik\Log;
* **Getting a unrendered DataTable**
*
* // use the convenience method 'processRequest'
- * $dataTable = Request::processRequest('UserSettings.getLanguage', array(
+ * $dataTable = Request::processRequest('UserLanguage.getLanguage', array(
* 'idSite' => 1,
* 'date' => 'yesterday',
* 'period' => 'week',
@@ -78,7 +78,7 @@ class Request
* forwarded to request array before it is returned.
*
* @param string|array $request The base request string or array, eg,
- * `'module=UserSettings&action=getLanguage'`.
+ * `'module=UserLanguage&action=getLanguage'`.
* @param array $defaultRequest Default query parameters. If a query parameter is absent in `$request`, it will be loaded
* from this. Defaults to `$_GET + $_POST`.
* @return array
@@ -125,7 +125,7 @@ class Request
* Constructor.
*
* @param string|array $request Query string that defines the API call (must at least contain a **method** parameter),
- * eg, `'method=UserSettings.getLanguage&idSite=1&date=yesterday&period=week&format=xml'`
+ * eg, `'method=UserLanguage.getLanguage&idSite=1&date=yesterday&period=week&format=xml'`
* If a request is not provided, then we use the values in the `$_GET` and `$_POST`
* superglobals.
* @param array $defaultRequest Default query parameters. If a query parameter is absent in `$request`, it will be loaded
diff --git a/core/Archive.php b/core/Archive.php
index 307718f52b..60d6791726 100644
--- a/core/Archive.php
+++ b/core/Archive.php
@@ -829,7 +829,7 @@ class Archive
/**
* Returns the name of the plugin that archives a given report.
*
- * @param string $report Archive data name, eg, `'nb_visits'`, `'UserSettings_...'`, etc.
+ * @param string $report Archive data name, eg, `'nb_visits'`, `'DevicesDetection_...'`, etc.
* @return string Plugin name.
* @throws \Exception If a plugin cannot be found or if the plugin for the report isn't
* activated.
diff --git a/core/ArchiveProcessor/Rules.php b/core/ArchiveProcessor/Rules.php
index 1334ad1f9a..df2a8c45af 100644
--- a/core/ArchiveProcessor/Rules.php
+++ b/core/ArchiveProcessor/Rules.php
@@ -10,6 +10,7 @@ namespace Piwik\ArchiveProcessor;
use Exception;
use Piwik\Config;
+use Piwik\Container\StaticContainer;
use Piwik\DataAccess\ArchiveWriter;
use Piwik\Date;
use Piwik\Log;
@@ -228,18 +229,28 @@ class Rules
public static function isArchivingDisabledFor(array $idSites, Segment $segment, $periodLabel)
{
+ $generalConfig = Config::getInstance()->General;
+
if ($periodLabel == 'range') {
- return false;
+ if (!isset($generalConfig['archiving_range_force_on_browser_request'])
+ || $generalConfig['archiving_range_force_on_browser_request'] != false
+ ) {
+ return false;
+ } else {
+ Log::debug("Not forcing archiving for range period.");
+ }
}
+
$processOneReportOnly = !self::shouldProcessReportsAllPlugins($idSites, $segment, $periodLabel);
$isArchivingDisabled = !self::isRequestAuthorizedToArchive() || self::$archivingDisabledByTests;
- if ($processOneReportOnly) {
-
+ if ($processOneReportOnly
+ && $periodLabel != 'range'
+ ) {
// When there is a segment, we disable archiving when browser_archiving_disabled_enforce applies
if (!$segment->isEmpty()
&& $isArchivingDisabled
- && Config::getInstance()->General['browser_archiving_disabled_enforce']
+ && $generalConfig['browser_archiving_disabled_enforce']
&& !SettingsServer::isArchivePhpTriggered() // Only applies when we are not running core:archive command
) {
Log::debug("Archiving is disabled because of config setting browser_archiving_disabled_enforce=1");
diff --git a/core/Piwik.php b/core/Piwik.php
index 8494f7b83a..a9773c7449 100644
--- a/core/Piwik.php
+++ b/core/Piwik.php
@@ -503,7 +503,7 @@ class Piwik
}
/**
- * Returns the current module read from the URL (eg. 'API', 'UserSettings', etc.)
+ * Returns the current module read from the URL (eg. 'API', 'DevicesDetection', etc.)
*
* @return string
*/
diff --git a/core/Plugin/ComponentFactory.php b/core/Plugin/ComponentFactory.php
index 68415e9397..751f1157d4 100644
--- a/core/Plugin/ComponentFactory.php
+++ b/core/Plugin/ComponentFactory.php
@@ -24,7 +24,7 @@ class ComponentFactory
* associated subdirectory.
*
* @param string $pluginName The name of the plugin the component is expected to belong to,
- * eg, `'UserSettings'`.
+ * eg, `'DevicesDetection'`.
* @param string $componentClassSimpleName The component's class name w/o namespace, eg,
* `"GetKeywords"`.
* @param string $componentTypeClass The fully qualified class name of the component type, eg,
@@ -70,7 +70,7 @@ class ComponentFactory
* @param string $componentTypeClass The fully qualified class name of the component type, eg,
* `"Piwik\Plugin\Report"`.
* @param string $pluginName|false The name of the plugin the component is expected to belong to,
- * eg, `'UserSettings'`.
+ * eg, `'DevicesDetection'`.
* @param callback $predicate
* @return mixed The component that satisfies $predicate or null if not found.
*/
diff --git a/core/Plugin/Controller.php b/core/Plugin/Controller.php
index c754a4c18b..b7b1db6d82 100644
--- a/core/Plugin/Controller.php
+++ b/core/Plugin/Controller.php
@@ -580,43 +580,55 @@ abstract class Controller
*/
protected function setGeneralVariablesView($view)
{
- $view->date = $this->strDate;
-
$view->idSite = $this->idSite;
$this->checkSitePermission();
$this->setPeriodVariablesView($view);
- $rawDate = Common::getRequestVar('date');
- $periodStr = Common::getRequestVar('period');
- if ($periodStr != 'range') {
- $date = Date::factory($this->strDate);
- $period = Period\Factory::build($periodStr, $date);
- } else {
- $period = new Range($periodStr, $rawDate, $this->site->getTimezone());
- }
- $view->rawDate = $rawDate;
- $view->prettyDate = self::getCalendarPrettyDate($period);
-
$view->siteName = $this->site->getName();
$view->siteMainUrl = $this->site->getMainUrl();
+ $siteTimezone = $this->site->getTimezone();
+
$datetimeMinDate = $this->site->getCreationDate()->getDatetime();
- $minDate = Date::factory($datetimeMinDate, $this->site->getTimezone());
+ $minDate = Date::factory($datetimeMinDate, $siteTimezone);
$this->setMinDateView($minDate, $view);
- $maxDate = Date::factory('now', $this->site->getTimezone());
+ $maxDate = Date::factory('now', $siteTimezone);
$this->setMaxDateView($maxDate, $view);
+ $rawDate = Common::getRequestVar('date');
+ $periodStr = Common::getRequestVar('period');
+
+ if ($periodStr != 'range') {
+ $date = Date::factory($this->strDate);
+ $validDate = $this->getValidDate($date, $minDate, $maxDate);
+ $period = Period\Factory::build($periodStr, $validDate);
+
+ if ($date->toString() !== $validDate->toString()) {
+ // we to not always change date since it could convert a strDate "today" to "YYYY-MM-DD"
+ // only change $this->strDate if it was not valid before
+ $this->setDate($validDate);
+ }
+ } else {
+ $period = new Range($periodStr, $rawDate, $siteTimezone);
+ }
+
// Setting current period start & end dates, for pre-setting the calendar when "Date Range" is selected
$dateStart = $period->getDateStart();
- if ($dateStart->isEarlier($minDate)) {
- $dateStart = $minDate;
- }
- $dateEnd = $period->getDateEnd();
- if ($dateEnd->isLater($maxDate)) {
- $dateEnd = $maxDate;
+ $dateStart = $this->getValidDate($dateStart, $minDate, $maxDate);
+
+ $dateEnd = $period->getDateEnd();
+ $dateEnd = $this->getValidDate($dateEnd, $minDate, $maxDate);
+
+ if ($periodStr == 'range') {
+ // make sure we actually display the correct calendar pretty date
+ $newRawDate = $dateStart->toString() . ',' . $dateEnd->toString();
+ $period = new Range($periodStr, $newRawDate, $siteTimezone);
}
+ $view->date = $this->strDate;
+ $view->prettyDate = self::getCalendarPrettyDate($period);
+ $view->rawDate = $rawDate;
$view->startDate = $dateStart;
$view->endDate = $dateEnd;
@@ -635,6 +647,19 @@ abstract class Controller
}
}
+ private function getValidDate(Date $date, Date $minDate, Date $maxDate)
+ {
+ if ($date->isEarlier($minDate)) {
+ $date = $minDate;
+ }
+
+ if ($date->isLater($maxDate)) {
+ $date = $maxDate;
+ }
+
+ return $date;
+ }
+
/**
* Assigns a set of generally useful variables to a {@link Piwik\View} instance.
*
diff --git a/core/Plugin/Manager.php b/core/Plugin/Manager.php
index 3d793bf0c1..fd7b02837f 100644
--- a/core/Plugin/Manager.php
+++ b/core/Plugin/Manager.php
@@ -711,7 +711,7 @@ class Manager extends Singleton
*
* array(
* 'UserCountry' => Plugin $pluginObject,
- * 'UserSettings' => Plugin $pluginObject,
+ * 'UserLanguage' => Plugin $pluginObject,
* );
*
* @return Plugin[]
@@ -745,7 +745,7 @@ class Manager extends Singleton
*
* array(
* 'UserCountry' => Plugin $pluginObject,
- * 'UserSettings' => Plugin $pluginObject,
+ * 'UserLanguage' => Plugin $pluginObject,
* );
*
* @return Plugin[]
@@ -768,7 +768,7 @@ class Manager extends Singleton
*
* array(
* 'UserCountry'
- * 'UserSettings'
+ * 'UserLanguage'
* );
*
* @return string[]
diff --git a/core/Plugin/Report.php b/core/Plugin/Report.php
index 3608a5facb..62ed594f8c 100644
--- a/core/Plugin/Report.php
+++ b/core/Plugin/Report.php
@@ -196,7 +196,7 @@ class Report
'Goals_Goals',
'General_Visitors',
'DevicesDetection_DevicesDetection',
- 'UserSettings_VisitorSettings',
+ 'General_VisitorSettings',
'API'
);
diff --git a/core/Tracker/PageUrl.php b/core/Tracker/PageUrl.php
index 0e5da41ba4..bbd98882cd 100644
--- a/core/Tracker/PageUrl.php
+++ b/core/Tracker/PageUrl.php
@@ -11,6 +11,7 @@ namespace Piwik\Tracker;
use Piwik\Common;
use Piwik\Config;
+use Piwik\Piwik;
use Piwik\UrlHelper;
class PageUrl
@@ -86,14 +87,22 @@ class PageUrl
$website = Cache::getCacheWebsiteAttributes($idSite);
$excludedParameters = self::getExcludedParametersFromWebsite($website);
- if (!empty($excludedParameters)) {
- Common::printDebug('Excluding parameters "' . implode(',', $excludedParameters) . '" from URL');
- }
-
$parametersToExclude = array_merge($excludedParameters,
self::$queryParametersToExclude,
$campaignTrackingParameters);
+ /**
+ * Triggered before setting the action url in Piwik\Tracker\Action so plugins can register
+ * parameters to be excluded from the tracking URL (e.g. campaign parameters).
+ *
+ * @param array &$parametersToExclude An array of parameters to exclude from the tracking url.
+ */
+ Piwik::postEvent('Tracker.PageUrl.getQueryParametersToExclude', array(&$parametersToExclude));
+
+ if (!empty($parametersToExclude)) {
+ Common::printDebug('Excluding parameters "' . implode(',', $parametersToExclude) . '" from URL');
+ }
+
$parametersToExclude = array_map('strtolower', $parametersToExclude);
return $parametersToExclude;
}
diff --git a/core/Updates/2.11.0-b4.php b/core/Updates/2.11.0-b4.php
new file mode 100644
index 0000000000..00dc1b23ee
--- /dev/null
+++ b/core/Updates/2.11.0-b4.php
@@ -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\Updates;
+
+use Piwik\DataAccess\ArchiveTableCreator;
+use Piwik\Updater;
+use Piwik\Updates;
+
+class Updates_2_11_0_b4 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 = 'UserLanguage_language' WHERE name = 'UserSettings_language'"] = false;
+ }
+
+ return $sqls;
+ }
+
+ static function update()
+ {
+ $pluginManager = \Piwik\Plugin\Manager::getInstance();
+
+ try {
+ $pluginManager->activatePlugin('UserLanguage');
+ } catch(\Exception $e) {
+ }
+
+ Updater::updateDatabase(__FILE__, self::getSql());
+ }
+
+}
diff --git a/core/Url.php b/core/Url.php
index 297932416c..04131c9827 100644
--- a/core/Url.php
+++ b/core/Url.php
@@ -28,7 +28,7 @@ use Piwik\Session;
* public function myControllerAction()
* {
* $url = Url::getCurrentQueryStringWithParametersModified(array(
- * 'module' => 'UserSettings',
+ * 'module' => 'DevicesDetection',
* 'action' => 'index'
* ));
* Url::redirectToUrl($url);
diff --git a/core/UrlHelper.php b/core/UrlHelper.php
index 4eedce07a9..a0bc340bbd 100644
--- a/core/UrlHelper.php
+++ b/core/UrlHelper.php
@@ -416,6 +416,7 @@ class UrlHelper
|| strpos($query, sprintf('?%s=', $variableName)) !== false
// search engines with no keyword
+ || $searchEngineName == 'Ixquick'
|| $searchEngineName == 'Google Images'
|| $searchEngineName == 'DuckDuckGo')
) {
diff --git a/core/Version.php b/core/Version.php
index eab5ff373f..f67f64b677 100644
--- a/core/Version.php
+++ b/core/Version.php
@@ -20,7 +20,7 @@ final class Version
* The current Piwik version.
* @var string
*/
- const VERSION = '2.11.0-b3';
+ const VERSION = '2.11.0-b4';
public function isStableVersion($version)
{
diff --git a/core/ViewDataTable/Config.php b/core/ViewDataTable/Config.php
index 1706e4b15f..220a253518 100644
--- a/core/ViewDataTable/Config.php
+++ b/core/ViewDataTable/Config.php
@@ -586,7 +586,7 @@ class Config
* references the one that is currently being displayed, it will not be added to the related
* report list.
*
- * @param string $relatedReport The plugin and method of the report, eg, `'UserSettings.getBrowser'`.
+ * @param string $relatedReport The plugin and method of the report, eg, `'DevicesDetection.getBrowsers'`.
* @param string $title The report's display name, eg, `'Browsers'`.
* @param array $queryParams Any extra query parameters to set in releated report's URL, eg,
* `array('idGoal' => 'ecommerceOrder')`.
@@ -620,8 +620,8 @@ class Config
* titles, eg,
* ```
* array(
- * 'UserSettings.getBrowser' => 'Browsers',
- * 'UserSettings.getConfiguration' => 'Configurations'
+ * 'DevicesDetection.getBrowsers' => 'Browsers',
+ * 'Resolution.getConfiguration' => 'Configurations'
* )
* ```
*/
diff --git a/core/ViewDataTable/Factory.php b/core/ViewDataTable/Factory.php
index 01d7113498..a5de6b3f06 100644
--- a/core/ViewDataTable/Factory.php
+++ b/core/ViewDataTable/Factory.php
@@ -80,7 +80,7 @@ class Factory
* If nothing is configured for the report and `null` is supplied for this
* argument, **table** is used.
* @param bool|false|string $apiAction The API method for the report that will be displayed, eg,
- * `'UserSettings.getBrowser'`.
+ * `'DevicesDetection.getBrowsers'`.
* @param bool|false|string $controllerAction The controller name and action dedicated to displaying the report. This
* action is used when reloading reports or changing the report visualization.
* Defaulted to `$apiAction` if `false` is supplied.
diff --git a/core/WidgetsList.php b/core/WidgetsList.php
index c474061606..e91a0f2b38 100644
--- a/core/WidgetsList.php
+++ b/core/WidgetsList.php
@@ -138,7 +138,7 @@ class WidgetsList extends Singleton
'VisitsSummary_VisitsSummary',
'Live!',
'General_Visitors',
- 'UserSettings_VisitorSettings',
+ 'General_VisitorSettings',
'DevicesDetection_DevicesDetection',
'General_Actions',
'Events_Events',