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 Aubry <mattab@users.noreply.github.com>2016-09-29 05:03:02 +0300
committerGitHub <noreply@github.com>2016-09-29 05:03:02 +0300
commitbd5217287e84d8a2fdc457dd07ce63d78c5835b4 (patch)
treeb0c4121eda233d3bfeeae29a482dc8f5a3d6304b /core
parenta8f682a6039e9b765e248c6be531cce54a7903d1 (diff)
2.16.3-rc1 (#10590)2.16.3-rc1
* Fix depraction test: use assertDeprecatedMethodIsRemovedInPiwik3 * Fix Scheduled Reports sent one hour late in daylight saving timezones (#10443) * convert hour to send report to/from UTC, to ensure it isn't affected by daylight savings * adds update script to change existing scheduled reports to use utc time * code improvement * adds missing param * Added new event Archiving.makeNewArchiverObject to allow customising plugin archiving (#10366) * added hook to alllow plugin archiving prevention * cr code style notes * reworked PR to fit CR suggestions * added PHPDoc for hook * Event description more consistent * UI tests: minor changes * Comment out Visitor Log UI tests refs #10536 * Adds test checking if all screenshots are stored in lfs * removed screenshots not stored in lfs * readds screenshots to lfs * 2.16.3-b4 * Issue translation updates against 2.x-dev * language update * Fix bug in widget list remove where the JSON object becomes array * 2.16.3-rc1 * console command custom-piwik-js:update should work when directory is writable and file does not exist yet (#10576) * followup #10449 * Fix test (cherry picked from commit fac3d63) * Prevent chmod(): No such file or directory * Automatically update all marketplace plugins when updating Piwik (#10527) * update plugins and piwik at the same time * make sure plugins are updated with piwik * use only one try/catch * reload plugin information once it has been installed * make sure to clear caches after an update * fix ui tests * make sure to use correct php version without any extras * Additional informations passed in the hook "isExcludedVisit" (issue #10415) (#10564) * Additional informations passed in the hook "isExcludedVisit" (issue #10415) * Added better description to the new parameters * Update VisitExcluded.php * Remove two parameters not needed as better to use the Request object * Update VisitExcluded.php * remove extra two parameters in VisitExcluded constructor to prevent confusion (#10593) * Update our libs to latest https://github.com/piwik/piwik/issues/10526 * Update composer libraries to latest https://github.com/piwik/piwik/issues/10526 * Update log analytics to latest * When updating the config file failed (or when any other file is not writable...), the Updater (for core or plugins) will now automatically throw an error and cancel the update (#10423) * When updating the config file failed (or when any other file is not writable...), the Updater (for core or plugins) will now automatically throw an error and cancel the update * add integration test to check the correct exception is thrown when config not writabel * New integration test for updater * Make test better * When opening the visitor profile, do not apply the segment (#10533) * When opening the visitor profile, do not apply the segment * added ui test for profile but does work for me * next try to make ui test work * add expected screenshot * added missing doc
Diffstat (limited to 'core')
-rw-r--r--core/Config.php16
-rw-r--r--core/Plugin.php17
-rw-r--r--core/Tracker/VisitExcluded.php21
-rw-r--r--core/Updater.php7
-rw-r--r--core/Version.php2
-rw-r--r--core/WidgetsList.php2
6 files changed, 35 insertions, 30 deletions
diff --git a/core/Config.php b/core/Config.php
index 01fa144a5c..f9a95feed0 100644
--- a/core/Config.php
+++ b/core/Config.php
@@ -12,6 +12,7 @@ namespace Piwik;
use Exception;
use Piwik\Application\Kernel\GlobalSettingsProvider;
use Piwik\Container\StaticContainer;
+use Piwik\Exception\MissingFilePermissionException;
use Piwik\ProfessionalServices\Advertising;
/**
@@ -375,15 +376,18 @@ class Config
*/
protected function writeConfig($clear = true)
{
- if ($this->doNotWriteConfigInTests) {
- return;
- }
-
$output = $this->dumpConfig();
if ($output !== null
&& $output !== false
) {
- $success = @file_put_contents($this->getLocalPath(), $output);
+
+ if ($this->doNotWriteConfigInTests) {
+ // simulate whether it would be successful
+ $success = is_writable($this->getLocalPath());
+ } else {
+ $success = @file_put_contents($this->getLocalPath(), $output);
+ }
+
if ($success === false) {
throw $this->getConfigNotWritableException();
}
@@ -411,6 +415,6 @@ class Config
public function getConfigNotWritableException()
{
$path = "config/" . basename($this->getLocalPath());
- return new Exception(Piwik::translate('General_ConfigFileIsNotWritable', array("(" . $path . ")", "")));
+ return new MissingFilePermissionException(Piwik::translate('General_ConfigFileIsNotWritable', array("(" . $path . ")", "")));
}
}
diff --git a/core/Plugin.php b/core/Plugin.php
index ff938a659f..f5a2854d4f 100644
--- a/core/Plugin.php
+++ b/core/Plugin.php
@@ -137,17 +137,22 @@ class Plugin
if ($cache->contains($cacheId)) {
$this->pluginInformation = $cache->fetch($cacheId);
} else {
- $metadataLoader = new MetadataLoader($pluginName);
- $this->pluginInformation = $metadataLoader->load();
-
- if ($this->hasDefinedPluginInformationInPluginClass() && $metadataLoader->hasPluginJson()) {
- throw new \Exception('Plugin ' . $pluginName . ' has defined the method getInformation() and as well as having a plugin.json file. Please delete the getInformation() method from the plugin class. Alternatively, you may delete the plugin directory from plugins/' . $pluginName);
- }
+ $this->reloadPluginInformation();
$cache->save($cacheId, $this->pluginInformation);
}
}
+ public function reloadPluginInformation()
+ {
+ $metadataLoader = new MetadataLoader($this->pluginName);
+ $this->pluginInformation = $metadataLoader->load();
+
+ if ($this->hasDefinedPluginInformationInPluginClass() && $metadataLoader->hasPluginJson()) {
+ throw new \Exception('Plugin ' . $this->pluginName . ' has defined the method getInformation() and as well as having a plugin.json file. Please delete the getInformation() method from the plugin class. Alternatively, you may delete the plugin directory from plugins/' . $this->pluginName);
+ }
+ }
+
private function createCacheIfNeeded()
{
if (is_null($this->cache)) {
diff --git a/core/Tracker/VisitExcluded.php b/core/Tracker/VisitExcluded.php
index a644d4479f..303d45c23b 100644
--- a/core/Tracker/VisitExcluded.php
+++ b/core/Tracker/VisitExcluded.php
@@ -28,25 +28,16 @@ class VisitExcluded
/**
* @param Request $request
- * @param bool|string $ip
- * @param bool|string $userAgent
*/
- public function __construct(Request $request, $ip = false, $userAgent = false)
+ public function __construct(Request $request)
{
$this->spamFilter = new ReferrerSpamFilter();
- if (false === $ip) {
- $ip = $request->getIp();
- }
-
- if (false === $userAgent) {
- $userAgent = $request->getUserAgent();
- }
-
$this->request = $request;
$this->idSite = $request->getIdSite();
- $this->userAgent = $userAgent;
- $this->ip = $ip;
+ $userAgent = $request->getUserAgent();
+ $this->userAgent = Common::unsanitizeInputValue($userAgent);
+ $this->ip = $request->getIp();
}
/**
@@ -89,8 +80,10 @@ class VisitExcluded
* @param bool &$excluded Whether the request should be excluded or not. Initialized
* to `false`. Event subscribers should set it to `true` in
* order to exclude the request.
+ * @param Request $request The request object which contains all of the request's information
+ *
*/
- Piwik::postEvent('Tracker.isExcludedVisit', array(&$excluded));
+ Piwik::postEvent('Tracker.isExcludedVisit', array(&$excluded, $this->request));
/*
* Following exclude operations happen after the hook.
diff --git a/core/Updater.php b/core/Updater.php
index 00cba745b2..8a67c0bd00 100644
--- a/core/Updater.php
+++ b/core/Updater.php
@@ -10,6 +10,7 @@ namespace Piwik;
use Piwik\Columns\Updater as ColumnUpdater;
use Piwik\Container\StaticContainer;
+use Piwik\Exception\MissingFilePermissionException;
use Piwik\Updater\UpdateObserver;
use Zend_Db_Exception;
@@ -257,8 +258,8 @@ class Updater
$this->markComponentSuccessfullyUpdated($componentName, $fileVersion);
} catch (UpdaterErrorException $e) {
$this->executeListenerHook('onError', array($componentName, $fileVersion, $e));
-
throw $e;
+
} catch (\Exception $e) {
$warningMessages[] = $e->getMessage();
@@ -581,7 +582,9 @@ class Updater
// make sure to check for them here
if ($e instanceof Zend_Db_Exception) {
throw new UpdaterErrorException($e->getMessage(), $e->getCode(), $e);
- } else {
+ } else if ($e instanceof MissingFilePermissionException) {
+ throw new UpdaterErrorException($e->getMessage(), $e->getCode(), $e);
+ }{
throw $e;
}
}
diff --git a/core/Version.php b/core/Version.php
index 2cf7565c10..9206f9e905 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.16.3-b4';
+ const VERSION = '2.16.3-rc1';
public function isStableVersion($version)
{
diff --git a/core/WidgetsList.php b/core/WidgetsList.php
index bafc94323d..150b133dd3 100644
--- a/core/WidgetsList.php
+++ b/core/WidgetsList.php
@@ -81,7 +81,7 @@ class WidgetsList extends Singleton
$v = array_merge($widgets[$category], $v);
}
- $widgets[$category] = $v;
+ $widgets[$category] = array_values($v);
}
$cache->save($cacheId, $widgets);