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
diff options
context:
space:
mode:
authorsgiehl <stefan@matomo.org>2020-06-04 15:48:58 +0300
committersgiehl <stefan@matomo.org>2020-06-04 16:21:37 +0300
commit5653219ad5d6e7c68fe76a9cd6bbb9ae653d9e27 (patch)
treec089ccda4aa00e58847a79058896d8242dd3710e /plugins
parenta35070be5146539999fdd02d5323f466d314192b (diff)
parente0fb7b40b7ddf42da70e63224c43524380f57e48 (diff)
Merge branch '3.x-dev' into 4.x-dev
Diffstat (limited to 'plugins')
-rw-r--r--plugins/CoreAdminHome/Tasks.php14
-rw-r--r--plugins/CoreAdminHome/tests/Integration/TasksTest.php1
-rw-r--r--plugins/CustomJsTracker/TrackingCode/PluginTrackerFiles.php4
-rw-r--r--plugins/Installation/Controller.php1
-rw-r--r--plugins/Installation/Onboarding.php77
-rw-r--r--plugins/Live/javascripts/live.js4
-rw-r--r--plugins/Morpheus/stylesheets/uibase/_header.less11
-rw-r--r--plugins/SitesManager/SitesManager.php12
-rw-r--r--plugins/UsersManager/API.php10
-rw-r--r--plugins/UsersManager/UsersManager.php5
-rw-r--r--plugins/UsersManager/tests/System/ApiTest.php31
11 files changed, 151 insertions, 19 deletions
diff --git a/plugins/CoreAdminHome/Tasks.php b/plugins/CoreAdminHome/Tasks.php
index c3afd5562d..aa026de425 100644
--- a/plugins/CoreAdminHome/Tasks.php
+++ b/plugins/CoreAdminHome/Tasks.php
@@ -32,6 +32,7 @@ use Piwik\Scheduler\Schedule\SpecificTime;
use Piwik\Settings\Storage\Backend\MeasurableSettingsTable;
use Piwik\Tracker\Failures;
use Piwik\Site;
+use Piwik\Tracker\FingerprintSalt;
use Piwik\Tracker\Visit\ReferrerSpamFilter;
use Psr\Log\LoggerInterface;
use Piwik\SettingsPiwik;
@@ -67,6 +68,8 @@ class Tasks extends \Piwik\Plugin\Tasks
// sure all archives that need to be invalidated get invalidated
$this->daily('invalidateOutdatedArchives', null, self::HIGH_PRIORITY);
+ $this->daily('deleteOldFingerprintSalts', null, self::HIGH_PRIORITY);
+
// general data purge on older archive tables, executed daily
$this->daily('purgeOutdatedArchives', null, self::HIGH_PRIORITY);
@@ -89,6 +92,11 @@ class Tasks extends \Piwik\Plugin\Tasks
$this->scheduleTrackingCodeReminderChecks();
}
+ public function deleteOldFingerprintSalts()
+ {
+ StaticContainer::get(FingerprintSalt::class)->deleteOldSalts();
+ }
+
public function invalidateOutdatedArchives()
{
if (!Rules::isBrowserTriggerEnabled()) {
@@ -278,6 +286,12 @@ class Tasks extends \Piwik\Plugin\Tasks
if (empty($purgedDates[$yesterdayStr])) {
$this->archivePurger->purgeInvalidatedArchivesFrom($yesterday);
}
+
+ // handle year start table
+ $yearStart = $today->toString('Y-01');
+ if (empty($purgedDates[$yearStart])) {
+ $this->archivePurger->purgeInvalidatedArchivesFrom(Date::factory($yearStart . '-01'));
+ }
}
public function optimizeArchiveTable()
diff --git a/plugins/CoreAdminHome/tests/Integration/TasksTest.php b/plugins/CoreAdminHome/tests/Integration/TasksTest.php
index 68459951b6..e3611596f0 100644
--- a/plugins/CoreAdminHome/tests/Integration/TasksTest.php
+++ b/plugins/CoreAdminHome/tests/Integration/TasksTest.php
@@ -133,6 +133,7 @@ class TasksTest extends IntegrationTestCase
$expected = [
'invalidateOutdatedArchives.',
+ 'deleteOldFingerprintSalts.',
'purgeOutdatedArchives.',
'purgeInvalidatedArchives.',
'purgeOrphanedArchives.',
diff --git a/plugins/CustomJsTracker/TrackingCode/PluginTrackerFiles.php b/plugins/CustomJsTracker/TrackingCode/PluginTrackerFiles.php
index 9928932e26..98fee4696f 100644
--- a/plugins/CustomJsTracker/TrackingCode/PluginTrackerFiles.php
+++ b/plugins/CustomJsTracker/TrackingCode/PluginTrackerFiles.php
@@ -41,9 +41,7 @@ class PluginTrackerFiles
$dirs = array();
$manager = Plugin\Manager::getInstance();
foreach ($manager->getPluginsLoadedAndActivated() as $pluginName => $plugin) {
- if ($plugin->isTrackerPlugin()) {
- $dirs[$pluginName] = rtrim(Plugin\Manager::getPluginDirectory($pluginName), '/') . '/';
- }
+ $dirs[$pluginName] = rtrim(Plugin\Manager::getPluginDirectory($pluginName), '/') . '/';
}
return $dirs;
}
diff --git a/plugins/Installation/Controller.php b/plugins/Installation/Controller.php
index 4452c914b4..b39e03c621 100644
--- a/plugins/Installation/Controller.php
+++ b/plugins/Installation/Controller.php
@@ -290,6 +290,7 @@ class Controller extends \Piwik\Plugin\ControllerAdmin
$newsletterPiwikORG,
$newsletterProfessionalServices
);
+ Onboarding::sendSysAdminMail($email);
$this->redirectToNextStep(__FUNCTION__);
} catch (Exception $e) {
diff --git a/plugins/Installation/Onboarding.php b/plugins/Installation/Onboarding.php
new file mode 100644
index 0000000000..90bc2f12d8
--- /dev/null
+++ b/plugins/Installation/Onboarding.php
@@ -0,0 +1,77 @@
+<?php
+/**
+ * Matomo - free/libre analytics platform
+ *
+ * @link https://matomo.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+namespace Piwik\Plugins\Installation;
+
+use Piwik\Mail;
+use Piwik\Option;
+use Piwik\Piwik;
+
+class Onboarding
+{
+ const OPTION_NAME_INSTALL_MAIL = 'install_mail_sent';
+
+ public static function sendSysAdminMail($email)
+ {
+ if (!Piwik::isValidEmailString($email)) {
+ return;
+ }
+ if (Option::get(self::OPTION_NAME_INSTALL_MAIL)) {
+ return;
+ }
+ Option::set(self::OPTION_NAME_INSTALL_MAIL, 1);
+
+ $message = 'Hey there,<br>
+<br>
+Thank you for installing Matomo On-Premises, the #1 Google Analytics alternative that protects your data.<br>
+<br>
+You’re receiving this email from your Matomo instance because you\'re the Super User and you have just finished installing Matomo On-Premise. You’re the only person who will receive this email. The mail was sent from your Matomo.<br>
+<br>
+It’s now our job to ensure you get the best possible Matomo experience without any disruptions, so we hope to answer the three most common problems we find users ask when starting out with Matomo.<br>
+<br>
+<strong>1. Speed up your Matomo by generating your reports in the background</strong><br>
+This is a common problem for first time users that can easily be fixed in a few minutes. What you’ll need to do is set up auto-archiving of your reports. I have provided you with a link of step-by-step instructions on how to do this below:<br>
+<a href="https://matomo.org/docs/setup-auto-archiving/">&gt;&gt; Set up auto-archiving of your reports</a><br><br>
+<strong>2. Get the server size right for your traffic</strong><br>
+Matomo is a platform designed to be fast, no matter the size of your database and how many visits you’re tracking. Here we can recommend the best infrastructure to host your Matomo.<br>
+<a href="https://matomo.org/docs/requirements/#recommended-servers-sizing-cpu-ram-disks">&gt;&gt; Learn the recommended server configuration and sizing to run Matomo with speed</a><br>
+<br>
+<strong>3. Next, make sure your data is secure</strong><br>
+Privacy and security are of utmost importance to the Matomo team and we want to make sure security is up to the standard you need.<br>
+Below is a link that will give your Matomo administrator a list of tips and best practices to improve security.<br>
+<a href="https://matomo.org/docs/security/">&gt;&gt; Tips for staying secure in Matomo</a><br>
+<br>
+<strong>Need more help?</strong><br>
+<ul><li>Join our forum</li>
+<li>If there is a feature you’d like to see in Matomo, submit a request through Github</li>
+<li>And if you want first-hand assistance from our expert team, support plans are available for your business</li>
+</ul>
+<br>
+It’s so great to have you be part of the Matomo community! We hope to deliver you the valuable insights you need to make better data-driven decisions for your website.<br>
+<br>
+Happy Analytics,<br>
+<br>
+Matthieu<br>
+Matomo Founder<br>
+<br>
+';
+
+ $mail = new Mail();
+ $mail->addTo($email);
+ $mail->setSubject('Congratulations for setting up Matomo');
+ $mail->setBodyHtml($message);
+
+ try {
+ $mail->send();
+ } catch (\Exception $e) {
+ // Mail might not be configured yet and it won't work...
+ }
+ }
+
+
+}
diff --git a/plugins/Live/javascripts/live.js b/plugins/Live/javascripts/live.js
index 3e329e8183..80bce4098f 100644
--- a/plugins/Live/javascripts/live.js
+++ b/plugins/Live/javascripts/live.js
@@ -74,6 +74,8 @@
that._parseResponse(r);
}
+ that.options.interval = parseInt(that.options.interval, 10);
+
// add default interval to last interval if not updated or reset to default if so
if (!that.updated) {
that.currentInterval += that.options.interval;
@@ -168,7 +170,7 @@
return;
}
- this.currentInterval = this.options.interval;
+ this.currentInterval = parseInt(this.options.interval, 10);
if (0 === $(this.element).parents('.widget').length) {
var $rootScope = piwikHelper.getAngularDependency('$rootScope');
diff --git a/plugins/Morpheus/stylesheets/uibase/_header.less b/plugins/Morpheus/stylesheets/uibase/_header.less
index f9d8d2d19f..47c2e31475 100644
--- a/plugins/Morpheus/stylesheets/uibase/_header.less
+++ b/plugins/Morpheus/stylesheets/uibase/_header.less
@@ -18,17 +18,6 @@
}
}
-// IE 10+
-@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
- #root #logo {
- width: 80px;
- }
-
- #root #logo img.default-piwik-logo {
- width: 100%;
- }
-}
-
#javascriptDisabled,
#javascriptDisabled a {
font-weight: bold;
diff --git a/plugins/SitesManager/SitesManager.php b/plugins/SitesManager/SitesManager.php
index 0644e4df37..fbf6af7278 100644
--- a/plugins/SitesManager/SitesManager.php
+++ b/plugins/SitesManager/SitesManager.php
@@ -13,12 +13,14 @@ use Piwik\API\Request;
use Piwik\Common;
use Piwik\Config;
use Piwik\Container\StaticContainer;
+use Piwik\Date;
use Piwik\Exception\UnexpectedWebsiteFoundException;
use Piwik\Option;
use Piwik\Piwik;
use Piwik\Plugins\CoreHome\SystemSummary;
use Piwik\Settings\Storage\Backend\MeasurableSettingsTable;
use Piwik\Tracker\Cache;
+use Piwik\Tracker\FingerprintSalt;
use Piwik\Tracker\Model as TrackerModel;
use Piwik\Session\SessionNamespace;
@@ -197,6 +199,16 @@ class SitesManager extends \Piwik\Plugin
$array['timezone'] = $this->getTimezoneFromWebsite($website);
$array['ts_created'] = $website['ts_created'];
$array['type'] = $website['type'];
+
+ // we make sure to have the fingerprint salts for the last 3 days incl tmrw in the cache so we don't need to
+ // query the DB directly for these days
+ $datesToGenerateSalt = array(Date::now()->addDay(1), Date::now(), Date::now()->subDay(1), Date::now()->subDay(2));
+
+ $fingerprintSaltKey = new FingerprintSalt();
+ foreach ($datesToGenerateSalt as $date) {
+ $dateString = $fingerprintSaltKey->getDateString($date, $array['timezone']);
+ $array[FingerprintSalt::OPTION_PREFIX . $dateString] = $fingerprintSaltKey->getSalt($dateString, $idSite);
+ }
}
public function setTrackerCacheGeneral(&$cache)
diff --git a/plugins/UsersManager/API.php b/plugins/UsersManager/API.php
index 697dfa5566..bc4cb9e08d 100644
--- a/plugins/UsersManager/API.php
+++ b/plugins/UsersManager/API.php
@@ -193,12 +193,18 @@ class API extends \Piwik\Plugin\API
/**
* Gets a user preference
- * @param string $userLogin
+ * @param string $userLogin Optional, defaults to current user log in.
* @param string $preferenceName
* @return bool|string
*/
- public function getUserPreference($userLogin, $preferenceName)
+ public function getUserPreference($userLogin = false, $preferenceName)
{
+ if ($userLogin === false) {
+ // the default value for first parameter is there to have it an optional parameter in the HTTP API
+ // in PHP it won't be optional. Could move parameter to the end of the method but did not want to break
+ // BC
+ $userLogin = Piwik::getCurrentUserLogin();
+ }
Piwik::checkUserHasSuperUserAccessOrIsTheUser($userLogin);
$optionValue = $this->getPreferenceValue($userLogin, $preferenceName);
diff --git a/plugins/UsersManager/UsersManager.php b/plugins/UsersManager/UsersManager.php
index 797590bc98..bcb3c7dc15 100644
--- a/plugins/UsersManager/UsersManager.php
+++ b/plugins/UsersManager/UsersManager.php
@@ -201,8 +201,9 @@ class UsersManager extends \Piwik\Plugin
public static function getPasswordHash($password)
{
- self::checkBasicPasswordStrength($password);
-
+ if (SettingsPiwik::isUserCredentialsSanityCheckEnabled()) {
+ self::checkBasicPasswordStrength($password);
+ }
// if change here, should also edit the installation process
// to change how the root pwd is saved in the config file
return md5($password);
diff --git a/plugins/UsersManager/tests/System/ApiTest.php b/plugins/UsersManager/tests/System/ApiTest.php
index e96dbf9016..580a69e59f 100644
--- a/plugins/UsersManager/tests/System/ApiTest.php
+++ b/plugins/UsersManager/tests/System/ApiTest.php
@@ -9,6 +9,8 @@
namespace Piwik\Plugins\UsersManager\tests\System;
use Piwik\Date;
+use Piwik\API\Request;
+use Piwik\Piwik;
use Piwik\Plugins\UsersManager\API;
use Piwik\Plugins\UsersManager\Model;
use Piwik\Plugins\UsersManager\tests\Fixtures\ManyUsers;
@@ -65,6 +67,35 @@ class ApiTest extends SystemTestCase
}
}
+ public function test_getUserPreference_loginIsOptional()
+ {
+ $response = Request::processRequest('UsersManager.getUserPreference', array(
+ 'preferenceName' => API::PREFERENCE_DEFAULT_REPORT
+ ));
+ $this->assertEquals('1', $response);
+
+ $response = Request::processRequest('UsersManager.getUserPreference', array(
+ 'preferenceName' => API::PREFERENCE_DEFAULT_REPORT_DATE
+ ));
+ $this->assertEquals('yesterday', $response);
+ }
+
+ public function test_getUserPreference_loginCanBeSet()
+ {
+ $response = Request::processRequest('UsersManager.getUserPreference', array(
+ 'userLogin' => Piwik::getCurrentUserLogin(),
+ 'preferenceName' => API::PREFERENCE_DEFAULT_REPORT_DATE
+ ));
+ $this->assertEquals('yesterday', $response);
+
+ // user not exists
+ $response = Request::processRequest('UsersManager.getUserPreference', array(
+ 'userLogin' => 'foo',
+ 'preferenceName' => API::PREFERENCE_DEFAULT_REPORT_DATE
+ ));
+ $this->assertEquals('yesterday', $response);
+ }
+
public function getApiForTesting()
{
$apiToTest = array(