diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2018-10-07 22:51:40 +0300 |
---|---|---|
committer | diosmosis <diosmosis@users.noreply.github.com> | 2018-10-07 22:51:40 +0300 |
commit | 89d8479ac242b2ffc98053fe504ce882086c6999 (patch) | |
tree | 6e47c9898547520ab52bf842ca6be84f36c6e153 | |
parent | 5470c4f46cbc00ee704ffee6bfae965412771ad3 (diff) |
Add possibility to manage and view Intranet websites (#13473)3.6.1-b3
* Add possibility to manage and view Intranet websites #7724
* more tweaks
* ui tests
* fix some tests
* added missing name
* remove intranet setting, added test for tracking
* fix various tests
* remove test
* Update RequestProcessor.php
* Update en.json
* fix some tests
* do not throw exception if site does not exist
* seeing just now it is fine to trigger exception
* debug error
* log only certain requests
* Update piwik.php
* Update JsProxyTest.php
* trying to fix tests
* remove debug code
* trying to fix tests
41 files changed, 734 insertions, 40 deletions
diff --git a/config/global.ini.php b/config/global.ini.php index 49578eddb2..b689e782b0 100644 --- a/config/global.ini.php +++ b/config/global.ini.php @@ -869,6 +869,7 @@ Plugins[] = CorePluginsAdmin Plugins[] = CoreAdminHome Plugins[] = CoreHome Plugins[] = WebsiteMeasurable +Plugins[] = IntranetMeasurable Plugins[] = Diagnostics Plugins[] = CoreVisualizations Plugins[] = Proxy diff --git a/core/Tracker/Visit.php b/core/Tracker/Visit.php index 06382c26d7..737c24c380 100644 --- a/core/Tracker/Visit.php +++ b/core/Tracker/Visit.php @@ -66,11 +66,6 @@ class Visit implements VisitInterface protected $visitProperties; /** - * @var VisitorRecognizer - */ - private $visitorRecognizer; - - /** * @var ArchiveInvalidator */ private $invalidator; @@ -79,7 +74,6 @@ class Visit implements VisitInterface { $requestProcessors = StaticContainer::get('Piwik\Plugin\RequestProcessors'); $this->requestProcessors = $requestProcessors->getRequestProcessors(); - $this->visitorRecognizer = StaticContainer::get('Piwik\Tracker\VisitorRecognizer'); $this->visitProperties = null; $this->userSettings = StaticContainer::get('Piwik\Tracker\Settings'); $this->invalidator = StaticContainer::get('Piwik\Archive\ArchiveInvalidator'); diff --git a/core/Tracker/VisitorRecognizer.php b/core/Tracker/VisitorRecognizer.php index 7727156727..4b3be310a2 100644 --- a/core/Tracker/VisitorRecognizer.php +++ b/core/Tracker/VisitorRecognizer.php @@ -77,6 +77,11 @@ class VisitorRecognizer $this->eventDispatcher = $eventDispatcher; } + public function setTrustCookiesOnly($trustCookiesOnly) + { + $this->trustCookiesOnly = $trustCookiesOnly; + } + public function findKnownVisitor($configId, VisitProperties $visitProperties, Request $request) { $idSite = $request->getIdSite(); diff --git a/core/Updates/3.6.1-b2.php b/core/Updates/3.6.1-b2.php index 1236c0f167..70ed561b28 100644 --- a/core/Updates/3.6.1-b2.php +++ b/core/Updates/3.6.1-b2.php @@ -33,6 +33,7 @@ class Updates_3_6_1_b2 extends Updates { return array( $this->migration->db->addColumn('site', 'creator_login', ' VARCHAR(100) NULL'), + $this->migration->plugin->activate('IntranetMeasurable'), ); } diff --git a/plugins/Dashboard/tests/UI/expected-screenshots/DashboardManager_removed.png b/plugins/Dashboard/tests/UI/expected-screenshots/DashboardManager_removed.png index b9103ffa9f..2c120280ea 100644 --- a/plugins/Dashboard/tests/UI/expected-screenshots/DashboardManager_removed.png +++ b/plugins/Dashboard/tests/UI/expected-screenshots/DashboardManager_removed.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:39063e4f7ec00b88c3cc8e39df49f4c6591608a4fa7756415ca685c41467fa06 -size 417224 +oid sha256:65caea6e601e5e47179910f7734a43fb69012039d389f0d230ad11cc063ecc37 +size 417251 diff --git a/plugins/Dashboard/tests/UI/expected-screenshots/Dashboard_loaded_token_auth.png b/plugins/Dashboard/tests/UI/expected-screenshots/Dashboard_loaded_token_auth.png index 74f8709f82..ae84d07882 100644 --- a/plugins/Dashboard/tests/UI/expected-screenshots/Dashboard_loaded_token_auth.png +++ b/plugins/Dashboard/tests/UI/expected-screenshots/Dashboard_loaded_token_auth.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:79cfbfb8706295ef09dc07b66224511092a60b4ad6b21179de96775706e34e16 -size 618446 +oid sha256:c23d08478368cd1cf5e6c04514c52a591943731baf4d818f15fa10c7443b1e5e +size 618492 diff --git a/plugins/IntranetMeasurable/.gitignore b/plugins/IntranetMeasurable/.gitignore new file mode 100644 index 0000000000..c8c9480010 --- /dev/null +++ b/plugins/IntranetMeasurable/.gitignore @@ -0,0 +1 @@ +tests/System/processed/*xml
\ No newline at end of file diff --git a/plugins/IntranetMeasurable/IntranetMeasurable.php b/plugins/IntranetMeasurable/IntranetMeasurable.php new file mode 100644 index 0000000000..ed79e1bf66 --- /dev/null +++ b/plugins/IntranetMeasurable/IntranetMeasurable.php @@ -0,0 +1,18 @@ +<?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\IntranetMeasurable; + +class IntranetMeasurable extends \Piwik\Plugin +{ + public function isTrackerPlugin() + { + return true; + } + +} diff --git a/plugins/IntranetMeasurable/MeasurableSettings.php b/plugins/IntranetMeasurable/MeasurableSettings.php new file mode 100644 index 0000000000..8320736dc1 --- /dev/null +++ b/plugins/IntranetMeasurable/MeasurableSettings.php @@ -0,0 +1,23 @@ +<?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\IntranetMeasurable; + +use Piwik\Settings\Setting; + +class MeasurableSettings extends \Piwik\Plugins\WebsiteMeasurable\MeasurableSettings +{ + /** @var Setting */ + public $trustvisitorcookies; + + protected function shouldShowSettingsForType($type) + { + return $type === Type::ID; + } + +} diff --git a/plugins/IntranetMeasurable/Tracker/RequestProcessor.php b/plugins/IntranetMeasurable/Tracker/RequestProcessor.php new file mode 100644 index 0000000000..a97c09893e --- /dev/null +++ b/plugins/IntranetMeasurable/Tracker/RequestProcessor.php @@ -0,0 +1,46 @@ +<?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\IntranetMeasurable\Tracker; + +use Piwik\Container\StaticContainer; +use Piwik\Exception\UnexpectedWebsiteFoundException; +use Piwik\Plugins\IntranetMeasurable\Type; +use Piwik\Tracker\Cache; +use Piwik\Tracker\Request; + +class RequestProcessor extends \Piwik\Tracker\RequestProcessor +{ + private $didEnableSetting = false; + private $settingName = 'ini.Tracker.trust_visitors_cookies'; + + public function manipulateRequest(Request $request) + { + try { + $site = Cache::getCacheWebsiteAttributes($request->getIdSite()); + } catch (UnexpectedWebsiteFoundException $e) { + return; + } + $isIntranetSite = !empty($site['type']) && $site['type'] === Type::ID; + + if ($isIntranetSite && !StaticContainer::get($this->settingName)) { + $this->setTrustCookiesSetting(1); + $this->didEnableSetting = true; + } elseif ($this->didEnableSetting) { + // we reset it in case of bulk tracking with different sites etc + $this->setTrustCookiesSetting(0); + $this->didEnableSetting = false; + } + } + + private function setTrustCookiesSetting($value) + { + StaticContainer::get('Piwik\Tracker\VisitorRecognizer')->setTrustCookiesOnly($value); + StaticContainer::getContainer()->set($this->settingName, $value); + } +} diff --git a/plugins/IntranetMeasurable/Type.php b/plugins/IntranetMeasurable/Type.php new file mode 100644 index 0000000000..a6636e2771 --- /dev/null +++ b/plugins/IntranetMeasurable/Type.php @@ -0,0 +1,20 @@ +<?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\IntranetMeasurable; + +class Type extends \Piwik\Measurable\Type +{ + const ID = 'intranet'; + protected $name = 'IntranetMeasurable_Intranet'; + protected $namePlural = 'IntranetMeasurable_Intranets'; + protected $description = 'IntranetMeasurable_IntranetDescription'; + protected $howToSetupUrl = '?module=CoreAdminHome&action=trackingCodeGenerator'; + +} + diff --git a/plugins/IntranetMeasurable/lang/en.json b/plugins/IntranetMeasurable/lang/en.json new file mode 100644 index 0000000000..f14e75b7c5 --- /dev/null +++ b/plugins/IntranetMeasurable/lang/en.json @@ -0,0 +1,7 @@ +{ + "IntranetMeasurable": { + "Intranet": "Intranet Website", + "Intranets": "Intranet Websites", + "IntranetDescription": "An intranet measurable is just like a website but hosted on an internal network." + } +} diff --git a/plugins/IntranetMeasurable/plugin.json b/plugins/IntranetMeasurable/plugin.json new file mode 100644 index 0000000000..c3a1800532 --- /dev/null +++ b/plugins/IntranetMeasurable/plugin.json @@ -0,0 +1,4 @@ +{ + "name": "IntranetMeasurable", + "description": "Analytics for the web: lets you measure and analyze intranet websites." +}
\ No newline at end of file diff --git a/plugins/IntranetMeasurable/tests/Fixtures/IntranetSitesWithVisits.php b/plugins/IntranetMeasurable/tests/Fixtures/IntranetSitesWithVisits.php new file mode 100644 index 0000000000..25fac65727 --- /dev/null +++ b/plugins/IntranetMeasurable/tests/Fixtures/IntranetSitesWithVisits.php @@ -0,0 +1,94 @@ +<?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\IntranetMeasurable\tests\Fixtures; + +use Piwik\Date; +use Piwik\Plugins\IntranetMeasurable\Type; +use Piwik\Tests\Framework\Fixture; + +/** + * Generates tracker testing data for our TrackingTest + * + * This Simple fixture adds one website and tracks one visit with couple pageviews and an ecommerce conversion + */ +class IntranetSitesWithVisits extends Fixture +{ + public $dateTime = '2013-01-23 01:23:45'; + public $idSite = 1; + public $idSiteNotIntranet = 2; + + public function setUp() + { + $this->setUpWebsites(); + $this->trackVisits($this->idSite); + $this->trackVisits($this->idSiteNotIntranet); + } + + public function tearDown() + { + // empty + } + + private function setUpWebsites() + { + if (!self::siteCreated($this->idSite)) { + Fixture::createWebsite( + '2014-01-02 03:04:05', $ecommerce = 0, $siteName = false, $siteUrl = false, + $siteSearch = 1, $searchKeywordParameters = null, + $searchCategoryParameters = null, $timezone = null, Type::ID + ); + } + + if (!self::siteCreated($this->idSiteNotIntranet)) { + Fixture::createWebsite('2014-01-02 03:04:05'); + } + } + + private function configureSameDevice(\PiwikTracker $t) + { + // to make purpose of test more clear we configure the device partially... + $t->setIp('56.11.55.70'); + $t->setResolution(500, 200); + $t->setPlugins(true, false, true, false, true); + $t->setUserAgent('Mozilla/5.0 (Windows NT 6.0) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1'); + + return $t; + } + + protected function trackVisits($idSite) + { + // two visits... intranet will trust visitorId and generate two visits + // regular website will only generate one visit and prefer configId + $t = self::getTracker($idSite, $this->dateTime, $defaultInit = true); + $this->configureSameDevice($t); + $t->randomVisitorId = '1234567890123456'; + + $t->setForceVisitDateTime(Date::factory($this->dateTime)->addHour(0.1)->getDatetime()); + $t->setUrl('http://example.com/'); + self::checkResponse($t->doTrackPageView('Viewing homepage')); + + $t->setForceVisitDateTime(Date::factory($this->dateTime)->addHour(0.2)->getDatetime()); + $t->setUrl('http://example.com/sub/page'); + self::checkResponse($t->doTrackPageView('Second page view')); + + // different IP and different device but same visitor id... should still match this as unique visitor for intranet site + // but not the other site + $t = self::getTracker($idSite, $this->dateTime, $defaultInit = true); + $this->configureSameDevice($t); + $t->randomVisitorId = '1234567890123457'; + + $t->setForceVisitDateTime(Date::factory($this->dateTime)->addHour(0.1)->getDatetime()); + $t->setUrl('http://example.com/sub/page'); + self::checkResponse($t->doTrackPageView('Viewing homepage')); + + $t->setForceVisitDateTime(Date::factory($this->dateTime)->addHour(0.2)->getDatetime()); + $t->setUrl('http://example.com/?search=this is a site search query'); + self::checkResponse($t->doTrackPageView('Site search query')); + } + +}
\ No newline at end of file diff --git a/plugins/IntranetMeasurable/tests/System/TrackingTest.php b/plugins/IntranetMeasurable/tests/System/TrackingTest.php new file mode 100644 index 0000000000..e8f0a5680f --- /dev/null +++ b/plugins/IntranetMeasurable/tests/System/TrackingTest.php @@ -0,0 +1,73 @@ +<?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\IntranetMeasurable\tests\System; + +use Piwik\Plugins\IntranetMeasurable\tests\Fixtures\IntranetSitesWithVisits; +use Piwik\Tests\Framework\TestCase\SystemTestCase; + +/** + * @group IntranetMeasurable + * @group TrackingTest + * @group Plugins + */ +class TrackingTest extends SystemTestCase +{ + /** + * @var IntranetSitesWithVisits + */ + public static $fixture = null; // initialized below class definition + + /** + * @dataProvider getApiForTesting + */ + public function testApi($api, $params) + { + $this->runApiTests($api, $params); + } + + public function getApiForTesting() + { + $api = array( + 'API.get', + ); + + $apiToTest = array(); + $apiToTest[] = array($api, + array( + 'idSite' => self::$fixture->idSite, + 'date' => self::$fixture->dateTime, + 'periods' => array('day'), + 'testSuffix' => '_intranet' + ) + ); + $apiToTest[] = array($api, + array( + 'idSite' => self::$fixture->idSiteNotIntranet, + 'date' => self::$fixture->dateTime, + 'periods' => array('day'), + 'testSuffix' => '_notIntranet' + ) + ); + + return $apiToTest; + } + + public static function getOutputPrefix() + { + return ''; + } + + public static function getPathToTestDirectory() + { + return dirname(__FILE__); + } + +} + +TrackingTest::$fixture = new IntranetSitesWithVisits();
\ No newline at end of file diff --git a/plugins/IntranetMeasurable/tests/System/expected/test__intranet__API.get_day.xml b/plugins/IntranetMeasurable/tests/System/expected/test__intranet__API.get_day.xml new file mode 100644 index 0000000000..6673fc4a55 --- /dev/null +++ b/plugins/IntranetMeasurable/tests/System/expected/test__intranet__API.get_day.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <nb_uniq_visitors>2</nb_uniq_visitors> + <nb_visits>2</nb_visits> + <nb_users>0</nb_users> + <nb_actions>4</nb_actions> + <max_actions>2</max_actions> + <bounce_count>0</bounce_count> + <sum_visit_length>722</sum_visit_length> + <nb_visits_returning>0</nb_visits_returning> + <nb_actions_returning>0</nb_actions_returning> + <nb_uniq_visitors_returning>0</nb_uniq_visitors_returning> + <nb_users_returning>0</nb_users_returning> + <max_actions_returning>0</max_actions_returning> + <bounce_rate_returning>0%</bounce_rate_returning> + <nb_actions_per_visit_returning>0</nb_actions_per_visit_returning> + <avg_time_on_site_returning>0</avg_time_on_site_returning> + <nb_conversions>0</nb_conversions> + <nb_visits_converted>0</nb_visits_converted> + <revenue>0</revenue> + <conversion_rate>0%</conversion_rate> + <nb_conversions_new_visit>0</nb_conversions_new_visit> + <nb_visits_converted_new_visit>0</nb_visits_converted_new_visit> + <revenue_new_visit>0</revenue_new_visit> + <conversion_rate_new_visit>0%</conversion_rate_new_visit> + <nb_conversions_returning_visit>0</nb_conversions_returning_visit> + <nb_visits_converted_returning_visit>0</nb_visits_converted_returning_visit> + <revenue_returning_visit>0</revenue_returning_visit> + <conversion_rate_returning_visit>0%</conversion_rate_returning_visit> + <nb_total_overall_bandwidth>0</nb_total_overall_bandwidth> + <nb_total_pageview_bandwidth>0</nb_total_pageview_bandwidth> + <nb_total_download_bandwidth>0</nb_total_download_bandwidth> + <nb_pageviews>3</nb_pageviews> + <nb_uniq_pageviews>3</nb_uniq_pageviews> + <nb_downloads>0</nb_downloads> + <nb_uniq_downloads>0</nb_uniq_downloads> + <nb_outlinks>0</nb_outlinks> + <nb_uniq_outlinks>0</nb_uniq_outlinks> + <nb_searches>1</nb_searches> + <nb_keywords>1</nb_keywords> + <bounce_rate>0%</bounce_rate> + <nb_actions_per_visit>2</nb_actions_per_visit> + <avg_time_on_site>361</avg_time_on_site> +</result>
\ No newline at end of file diff --git a/plugins/IntranetMeasurable/tests/System/expected/test__notIntranet__API.get_day.xml b/plugins/IntranetMeasurable/tests/System/expected/test__notIntranet__API.get_day.xml new file mode 100644 index 0000000000..416534aa46 --- /dev/null +++ b/plugins/IntranetMeasurable/tests/System/expected/test__notIntranet__API.get_day.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8" ?> +<result> + <nb_uniq_visitors>1</nb_uniq_visitors> + <nb_visits>1</nb_visits> + <nb_users>0</nb_users> + <nb_actions>4</nb_actions> + <max_actions>4</max_actions> + <bounce_count>0</bounce_count> + <sum_visit_length>361</sum_visit_length> + <nb_visits_returning>0</nb_visits_returning> + <nb_actions_returning>0</nb_actions_returning> + <nb_uniq_visitors_returning>0</nb_uniq_visitors_returning> + <nb_users_returning>0</nb_users_returning> + <max_actions_returning>0</max_actions_returning> + <bounce_rate_returning>0%</bounce_rate_returning> + <nb_actions_per_visit_returning>0</nb_actions_per_visit_returning> + <avg_time_on_site_returning>0</avg_time_on_site_returning> + <nb_conversions>0</nb_conversions> + <nb_visits_converted>0</nb_visits_converted> + <revenue>0</revenue> + <conversion_rate>0%</conversion_rate> + <nb_conversions_new_visit>0</nb_conversions_new_visit> + <nb_visits_converted_new_visit>0</nb_visits_converted_new_visit> + <revenue_new_visit>0</revenue_new_visit> + <conversion_rate_new_visit>0%</conversion_rate_new_visit> + <nb_conversions_returning_visit>0</nb_conversions_returning_visit> + <nb_visits_converted_returning_visit>0</nb_visits_converted_returning_visit> + <revenue_returning_visit>0</revenue_returning_visit> + <conversion_rate_returning_visit>0%</conversion_rate_returning_visit> + <nb_total_overall_bandwidth>0</nb_total_overall_bandwidth> + <nb_total_pageview_bandwidth>0</nb_total_pageview_bandwidth> + <nb_total_download_bandwidth>0</nb_total_download_bandwidth> + <nb_pageviews>3</nb_pageviews> + <nb_uniq_pageviews>2</nb_uniq_pageviews> + <nb_downloads>0</nb_downloads> + <nb_uniq_downloads>0</nb_uniq_downloads> + <nb_outlinks>0</nb_outlinks> + <nb_uniq_outlinks>0</nb_uniq_outlinks> + <nb_searches>1</nb_searches> + <nb_keywords>1</nb_keywords> + <bounce_rate>0%</bounce_rate> + <nb_actions_per_visit>4</nb_actions_per_visit> + <avg_time_on_site>361</avg_time_on_site> +</result>
\ No newline at end of file diff --git a/plugins/IntranetMeasurable/tests/UI/.gitignore b/plugins/IntranetMeasurable/tests/UI/.gitignore new file mode 100644 index 0000000000..f39be478e7 --- /dev/null +++ b/plugins/IntranetMeasurable/tests/UI/.gitignore @@ -0,0 +1,2 @@ +/processed-ui-screenshots +/screenshot-diffs
\ No newline at end of file diff --git a/plugins/IntranetMeasurable/tests/UI/IntranetMeasurable_spec.js b/plugins/IntranetMeasurable/tests/UI/IntranetMeasurable_spec.js new file mode 100644 index 0000000000..c898da7214 --- /dev/null +++ b/plugins/IntranetMeasurable/tests/UI/IntranetMeasurable_spec.js @@ -0,0 +1,51 @@ +/*! + * Piwik - free/libre analytics platform + * + * Site selector screenshot tests. + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ +describe("IntranetMeasurable", function () { + this.timeout(0); + this.fixture = "Piwik\\Plugins\\SitesManager\\tests\\Fixtures\\ManySites"; + + var url = "?module=SitesManager&action=index&idSite=1&period=day&date=yesterday&showaddsite=false"; + + before(function () { + testEnvironment.pluginsToLoad = ['IntranetMeasurable']; + + testEnvironment.save(); + }); + + function assertScreenshotEquals(screenshotName, done, test, selector) + { + expect.screenshot(screenshotName).to.be.captureSelector(selector, test, done); + } + + it("should show intranet selection", function (done) { + assertScreenshotEquals("add_new_dialog", done, function (page) { + page.load(url); + page.click('.SitesManager .addSite:first'); + }, '.modal.open'); + }); + + it("should load intranet specific fields", function (done) { + assertScreenshotEquals("intranet_create", done, function (page) { + page.click('.modal.open .btn:contains(Intranet)'); + page.evaluate(function () { + $('.form-help:contains(UTC time is)').hide(); + }); + page.wait(250); + }, '.editingSite'); + }); + + it("should load intranet specific fields", function (done) { + assertScreenshotEquals("intranet_created", done, function (page) { + page.sendKeys('.editingSite [placeholder="Name"]', 'My intranet'); + page.sendKeys('.editingSite [name="urls"]', 'https://www.example.com'); + page.click('.editingSiteFooter input.btn'); + }, '.site[type=intranet]'); + }); + +});
\ No newline at end of file diff --git a/plugins/IntranetMeasurable/tests/UI/expected-screenshots/.gitkeep b/plugins/IntranetMeasurable/tests/UI/expected-screenshots/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/plugins/IntranetMeasurable/tests/UI/expected-screenshots/.gitkeep diff --git a/plugins/IntranetMeasurable/tests/UI/expected-screenshots/IntranetMeasurable_add_new_dialog.png b/plugins/IntranetMeasurable/tests/UI/expected-screenshots/IntranetMeasurable_add_new_dialog.png new file mode 100644 index 0000000000..0066cb93a6 --- /dev/null +++ b/plugins/IntranetMeasurable/tests/UI/expected-screenshots/IntranetMeasurable_add_new_dialog.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a2c31cfc730449d51a42dc9b737af474c7d0e09e2000a902398ff3353b877a2 +size 11525 diff --git a/plugins/IntranetMeasurable/tests/UI/expected-screenshots/IntranetMeasurable_intranet_create.png b/plugins/IntranetMeasurable/tests/UI/expected-screenshots/IntranetMeasurable_intranet_create.png new file mode 100644 index 0000000000..361342b60d --- /dev/null +++ b/plugins/IntranetMeasurable/tests/UI/expected-screenshots/IntranetMeasurable_intranet_create.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c6dd2153069832ada0e3ac5106b959147d9fcb204e972b078bab8163b6c77ffd +size 247555 diff --git a/plugins/IntranetMeasurable/tests/UI/expected-screenshots/IntranetMeasurable_intranet_created.png b/plugins/IntranetMeasurable/tests/UI/expected-screenshots/IntranetMeasurable_intranet_created.png new file mode 100644 index 0000000000..145cdfcd4d --- /dev/null +++ b/plugins/IntranetMeasurable/tests/UI/expected-screenshots/IntranetMeasurable_intranet_created.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:965315308d66ab9d40b520e4a7bbf9254b6df4a622236dac9d66a373e3d1bd0b +size 14386 diff --git a/plugins/IntranetMeasurable/tests/UI/expected-screenshots/IntranetMeasurable_intranet_reloaded.png b/plugins/IntranetMeasurable/tests/UI/expected-screenshots/IntranetMeasurable_intranet_reloaded.png new file mode 100644 index 0000000000..5a2630d3de --- /dev/null +++ b/plugins/IntranetMeasurable/tests/UI/expected-screenshots/IntranetMeasurable_intranet_reloaded.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bcc87f8a8ae38808f008c8945cf9d353359a31c2b45526ea45ec2513d7743edb +size 258493 diff --git a/plugins/SitesManager/SitesManager.php b/plugins/SitesManager/SitesManager.php index 8c77fe78e7..76576f84ed 100644 --- a/plugins/SitesManager/SitesManager.php +++ b/plugins/SitesManager/SitesManager.php @@ -162,6 +162,7 @@ class SitesManager extends \Piwik\Plugin $array['sitesearch_category_parameters'] = $this->getTrackerSearchCategoryParameters($website); $array['timezone'] = $this->getTimezoneFromWebsite($website); $array['ts_created'] = $website['ts_created']; + $array['type'] = $website['type']; } /** diff --git a/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_loaded.png b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_loaded.png index daa9172431..0db92c30ef 100644 --- a/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_loaded.png +++ b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_loaded.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:13bb0b46c784cc0351ef9ecd3b0df4a1d73e3ed723f6b09327a4ca48374b7794 -size 170243 +oid sha256:a9445d71546bb4e54fd3a555cbb0fa2048b72193dd2ff6addd46768c9fd99e26 +size 184243 diff --git a/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_page_1.png b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_page_1.png index d6568fb2af..2fa307c54e 100644 --- a/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_page_1.png +++ b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_page_1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3e99ecde5ef09992789bf65fe4637b94b1ade0a15bdac019f8ee9c25891101b9 -size 175143 +oid sha256:ee5bc2bcf319ec6d3648fc0b81c8c132259c78839576698272d58c3fb4b94a7d +size 188593 diff --git a/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_page_1_again.png b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_page_1_again.png index e7e3f52b9c..9324e70e6e 100644 --- a/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_page_1_again.png +++ b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_page_1_again.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8a981370541c453b1f083b32e4ecfb1553d27f06627c9ab946d90e43564221dd -size 175165 +oid sha256:a1b449a3b400295e8be4ea971c18b397ba9fb6fa86159ccc045a90ca1131dffb +size 188746 diff --git a/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_page_2.png b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_page_2.png index 4473de1f61..19bdd8ce5d 100644 --- a/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_page_2.png +++ b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_page_2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1c604a68139ece0e6a7b62bfb62adee646056d66a6f9d14834064d7feb26770b -size 176904 +oid sha256:3326127c0cd1eef67be6ce3ea824eeff79e3b96d91f37195715a7bd6ce211f7d +size 190483 diff --git a/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_search.png b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_search.png index 2e12376d6b..7d8b4b1adc 100644 --- a/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_search.png +++ b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_search.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e17697a106bac0358fa6951fa77819cca47b91521b9c624c2c2ceb243505719d -size 168447 +oid sha256:1ae3dea0fbdc20b296fbc7186e8919259236ca4cbf1998936688029abeb011f5 +size 182456 diff --git a/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_search_no_result.png b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_search_no_result.png index 8570c22b95..0fc9c6798f 100644 --- a/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_search_no_result.png +++ b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_search_no_result.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:238224decfa68bfc3f6c1f2bc7d244b1aae18da067073960150ed87b978f8524 -size 44695 +oid sha256:dc478746d93c12cbed265b66536a5fa80ca0f34e79bb645f6f0af007d75eca12 +size 45092 diff --git a/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_search_page_1.png b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_search_page_1.png index 8f2bfbca46..09c61f98ca 100644 --- a/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_search_page_1.png +++ b/plugins/SitesManager/tests/UI/expected-screenshots/SitesManager_search_page_1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f2581dfa9c981be6b3cb25f2e218a21695286b1b83e16df11964aea29cb90388 -size 173221 +oid sha256:cc492dc9b8da8cc933eb1eabd02011c21865146642f1d38d8bba490a01a38113 +size 186784 diff --git a/tests/PHPUnit/Integration/JsProxyTest.php b/tests/PHPUnit/Integration/JsProxyTest.php index 0fbab1890f..17e2430401 100644 --- a/tests/PHPUnit/Integration/JsProxyTest.php +++ b/tests/PHPUnit/Integration/JsProxyTest.php @@ -14,8 +14,14 @@ use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * @group Core */ -class JsProxyTest extends \PHPUnit_Framework_TestCase +class JsProxyTest extends IntegrationTestCase { + public function setUp() + { + parent::setUp(); + Fixture::createWebsite('2014-01-01 02:03:04'); + } + public function testPiwikJs() { $curlHandle = curl_init(); @@ -60,7 +66,7 @@ class JsProxyTest extends \PHPUnit_Framework_TestCase $responseInfo = curl_getinfo($curlHandle); curl_close($curlHandle); - $this->assertEquals(200, $responseInfo["http_code"], var_export($responseInfo, true)); + $this->assertEquals(200, $responseInfo["http_code"], var_export($responseInfo, true) . $fullResponse); $expected = "R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="; $processed = base64_encode($fullResponse); if ($expected != $processed) { diff --git a/tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getAvailableMeasurableTypes.xml b/tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getAvailableMeasurableTypes.xml index b7081fb4fa..ad6e2349cf 100644 --- a/tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getAvailableMeasurableTypes.xml +++ b/tests/PHPUnit/System/expected/test_apiGetReportMetadata__API.getAvailableMeasurableTypes.xml @@ -247,4 +247,251 @@ https://www.example.org/</placeholder> </row> </settings> </row> + <row> + <id>intranet</id> + <name>Intranet Website</name> + <description>An intranet measurable is just like a website but hosted on an internal network.</description> + <howToSetupUrl>?module=CoreAdminHome&action=trackingCodeGenerator</howToSetupUrl> + <settings> + <row> + <pluginName>IntranetMeasurable</pluginName> + <title>IntranetMeasurable</title> + <settings> + <row> + <name>urls</name> + <title>URLs</title> + <value> + </value> + <defaultValue> + </defaultValue> + <type>array</type> + <uiControl>textarea</uiControl> + <uiControlAttributes> + <cols>25</cols> + <rows>3</rows> + <placeholder>http://example.com/ +https://www.example.org/</placeholder> + </uiControlAttributes> + <availableValues /> + <description /> + <inlineHelp>It is recommended, but not required, to specify the various URLs, one per line, that your visitors use to access this website. Alias URLs for a website will not appear in the Referrers > Websites report. Note that it is not necessary to specify the URLs with and without 'www' as Matomo automatically considers both.</inlineHelp> + <templateFile /> + <introduction /> + <condition /> + </row> + <row> + <name>exclude_unknown_urls</name> + <title>Only track visits and actions when the action URL starts with one of the above URLs.</title> + <value>0</value> + <defaultValue>0</defaultValue> + <type>boolean</type> + <uiControl>checkbox</uiControl> + <uiControlAttributes> + </uiControlAttributes> + <availableValues /> + <description /> + <inlineHelp>When enabled, Matomo will only track internal actions when the Page URL is one of the known URLs for your website. This prevents people from spamming your analytics with URLs for other websites.<br />The domain and the path has to be an exact match and each valid subdomain has to be specified separately. For example when the known URLs are 'http://example.com/path' and 'http://good.example.com', tracking requests for 'http://example.com/otherpath' or 'http://bad.example.com' are ignored.</inlineHelp> + <templateFile /> + <introduction /> + <condition /> + </row> + <row> + <name>keep_url_fragment</name> + <title>Keep Page URL fragments when tracking Page URLs</title> + <value>0</value> + <defaultValue>0</defaultValue> + <type>string</type> + <uiControl>select</uiControl> + <uiControlAttributes> + </uiControlAttributes> + <availableValues> + <row>No (Default)</row> + <row>Yes</row> + <row>No</row> + </availableValues> + <description /> + <inlineHelp /> + <templateFile /> + <introduction /> + <condition /> + </row> + <row> + <name>excluded_ips</name> + <title>Excluded IPs</title> + <value> + </value> + <defaultValue> + </defaultValue> + <type>array</type> + <uiControl>textarea</uiControl> + <uiControlAttributes> + <cols>20</cols> + <rows>4</rows> + <placeholder>127.0.0.1</placeholder> + </uiControlAttributes> + <availableValues /> + <description /> + <inlineHelp>Enter the list of IPs, one per line, that you wish to exclude from being tracked by Matomo. You can use CIDR notation eg. 1.2.3.4/24 or you can use wildcards, eg. 1.2.3.* or 1.2.*.*<br /><br />Your current IP address is <i>127.0.0.1</i></inlineHelp> + <templateFile /> + <introduction /> + <condition /> + </row> + <row> + <name>excluded_parameters</name> + <title>Excluded Parameters</title> + <value> + </value> + <defaultValue> + </defaultValue> + <type>array</type> + <uiControl>textarea</uiControl> + <uiControlAttributes> + <cols>20</cols> + <rows>4</rows> + </uiControlAttributes> + <availableValues /> + <description /> + <inlineHelp>Enter the list of URL Query Parameters, one per line, to exclude from the Page URLs reports. Regular expressions such as /^sess.*|.*[dD]ate$/ are suported.<br /><br />Matomo will automatically exclude the common session parameters (phpsessid, sessionid, ...).</inlineHelp> + <templateFile /> + <introduction /> + <condition /> + </row> + <row> + <name>excluded_user_agents</name> + <title>Excluded User Agents</title> + <value> + </value> + <defaultValue> + </defaultValue> + <type>array</type> + <uiControl>textarea</uiControl> + <uiControlAttributes> + <cols>20</cols> + <rows>4</rows> + </uiControlAttributes> + <availableValues /> + <description /> + <inlineHelp>Enter the list of user agents to exclude from being tracked by Matomo.<br /><br />If the visitor's user agent string contains any of the strings you specify, the visitor will be excluded from Matomo.<br />You can use this to exclude some bots from being tracked.</inlineHelp> + <templateFile /> + <introduction /> + <condition /> + </row> + <row> + <name>sitesearch</name> + <title>Site Search</title> + <value>1</value> + <defaultValue>1</defaultValue> + <type>integer</type> + <uiControl>select</uiControl> + <uiControlAttributes> + </uiControlAttributes> + <availableValues> + <row key="1">Site Search tracking enabled</row> + <row key="0">Do not track Site Search</row> + </availableValues> + <description /> + <inlineHelp>You can use Matomo to track and report what visitors are searching in your website's internal search engine.</inlineHelp> + <templateFile /> + <introduction /> + <condition /> + </row> + <row> + <name>use_default_site_search_params</name> + <title>Use <a href='#globalSettings'>default</a> Site Search parameters</title> + <value>1</value> + <defaultValue>1</defaultValue> + <type>boolean</type> + <uiControl>checkbox</uiControl> + <uiControlAttributes> + </uiControlAttributes> + <availableValues /> + <description>Query parameter (Default): q,query,s,search,searchword,k,keyword & Category parameter: </description> + <inlineHelp /> + <templateFile /> + <introduction /> + <condition>1 && sitesearch</condition> + </row> + <row> + <name>sitesearch_keyword_parameters</name> + <title>Query parameter</title> + <value> + </value> + <defaultValue> + </defaultValue> + <type>array</type> + <uiControl>text</uiControl> + <uiControlAttributes> + </uiControlAttributes> + <availableValues /> + <description /> + <inlineHelp>Enter a comma separated list of all query parameter names containing the site search keyword.</inlineHelp> + <templateFile /> + <introduction /> + <condition>sitesearch && !use_default_site_search_params</condition> + </row> + <row> + <name>sitesearch_category_parameters</name> + <title>Category parameter</title> + <value> + </value> + <defaultValue> + </defaultValue> + <type>array</type> + <uiControl>text</uiControl> + <uiControlAttributes> + </uiControlAttributes> + <availableValues /> + <description /> + <inlineHelp>(optional)<br /><br />You may enter a comma-separated list of query parameters specifying the search category.</inlineHelp> + <templateFile /> + <introduction /> + <condition>1 && sitesearch && !use_default_site_search_params</condition> + </row> + <row> + <name>ecommerce</name> + <title>Ecommerce</title> + <value>0</value> + <defaultValue>0</defaultValue> + <type>integer</type> + <uiControl>select</uiControl> + <uiControlAttributes> + </uiControlAttributes> + <availableValues> + <row>Not an Ecommerce site</row> + <row>Ecommerce enabled</row> + </availableValues> + <description /> + <inlineHelp>When enabled, the "Goals" report will have a new "Ecommerce" section.<br />Matomo allows for advanced Ecommerce Analytics tracking & reporting. Learn more about <a href='https://matomo.org/docs/ecommerce-analytics/' target='_blank'> Ecommerce Analytics</a>.</inlineHelp> + <templateFile /> + <introduction /> + <condition /> + </row> + </settings> + </row> + <row> + <pluginName>ExampleSettingsPlugin</pluginName> + <title>ExampleSettingsPlugin</title> + <settings> + <row> + <name>contact_email</name> + <title>Contact email addresses</title> + <value> + </value> + <defaultValue> + </defaultValue> + <type>array</type> + <uiControl>textarea</uiControl> + <uiControlAttributes> + </uiControlAttributes> + <availableValues /> + <description /> + <inlineHelp /> + <templateFile /> + <introduction /> + <condition /> + </row> + </settings> + </row> + </settings> + </row> </result>
\ No newline at end of file diff --git a/tests/UI/expected-screenshots/EmptySite_emptySiteDashboard_ignored.png b/tests/UI/expected-screenshots/EmptySite_emptySiteDashboard_ignored.png index 3761193d1e..11261dad38 100644 --- a/tests/UI/expected-screenshots/EmptySite_emptySiteDashboard_ignored.png +++ b/tests/UI/expected-screenshots/EmptySite_emptySiteDashboard_ignored.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d24417efabdca2b4a901bbc2c703337f2500a32dcd5bfba7e6bb2e7412b16299 -size 325025 +oid sha256:70da4ac81c11a90e327bbf0b0d38ccb49ed269d41bed7d1ee606dcd20a839bd8 +size 325057 diff --git a/tests/UI/expected-screenshots/MeasurableManager_add_new_dialog.png b/tests/UI/expected-screenshots/MeasurableManager_add_new_dialog.png index ce9bdb0c35..b65f9cf96b 100644 --- a/tests/UI/expected-screenshots/MeasurableManager_add_new_dialog.png +++ b/tests/UI/expected-screenshots/MeasurableManager_add_new_dialog.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:483ab9e85e123dd7d7cdf0809a51121148252678873f4d6dae9a2a5c898db849 -size 168312 +oid sha256:3fbe9f8c726534f3b773de59d4e4351604ffbca32f09b0a3b877f5f1221a9e3d +size 169761 diff --git a/tests/UI/expected-screenshots/Theme_home.png b/tests/UI/expected-screenshots/Theme_home.png index 2bbf3dfb02..9ab7d06b80 100644 --- a/tests/UI/expected-screenshots/Theme_home.png +++ b/tests/UI/expected-screenshots/Theme_home.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9734226645c012f582c7e6a2f07b6b5e19961d9e926d85584a3171e27bf3d3de -size 623145 +oid sha256:b31aa38b49ac5040101692650b3a59accca120bbeffe0f62e7ee3a535f641d4e +size 623030 diff --git a/tests/UI/expected-screenshots/UIIntegrationTest_admin_home.png b/tests/UI/expected-screenshots/UIIntegrationTest_admin_home.png index eafcaf107f..d8cf7c8af5 100644 --- a/tests/UI/expected-screenshots/UIIntegrationTest_admin_home.png +++ b/tests/UI/expected-screenshots/UIIntegrationTest_admin_home.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d7ee7481d0ac6c14b4aa1d22fc94a53af2c7bbedfb84b7ffc7a14add5d86f26e -size 135666 +oid sha256:82c9c088dc5578e0e6b1417f32b81a5363b5de800d64559708de28fc0967a558 +size 135714 diff --git a/tests/UI/expected-screenshots/UIIntegrationTest_admin_manage_websites.png b/tests/UI/expected-screenshots/UIIntegrationTest_admin_manage_websites.png index cb408b67c9..b6813487fa 100644 --- a/tests/UI/expected-screenshots/UIIntegrationTest_admin_manage_websites.png +++ b/tests/UI/expected-screenshots/UIIntegrationTest_admin_manage_websites.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:71a95bc4c1b9f79954c084d8d42d5dcfc3283e3e9adc0f3637e92f730d4e3685 -size 197962 +oid sha256:1bb172a2a2dc74fa8350f4908a5a1caefd1a9e0f8de81e04f1d4d7ebad8797d3 +size 212071 diff --git a/tests/UI/expected-screenshots/UIIntegrationTest_admin_plugins.png b/tests/UI/expected-screenshots/UIIntegrationTest_admin_plugins.png index 71cc492140..1f39286ad7 100644 --- a/tests/UI/expected-screenshots/UIIntegrationTest_admin_plugins.png +++ b/tests/UI/expected-screenshots/UIIntegrationTest_admin_plugins.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5eed1b04841b1aeb985d5de66ac36527fc0209da9d11b3403dca30b5c11be02c -size 1028028 +oid sha256:77a4889ff5351564c0c75c72527c7c6329af0406b8ec2df33366c7255a44b01e +size 1038888 diff --git a/tests/UI/expected-screenshots/UIIntegrationTest_admin_plugins_no_internet.png b/tests/UI/expected-screenshots/UIIntegrationTest_admin_plugins_no_internet.png index ff0100ba35..83497d4ee7 100644 --- a/tests/UI/expected-screenshots/UIIntegrationTest_admin_plugins_no_internet.png +++ b/tests/UI/expected-screenshots/UIIntegrationTest_admin_plugins_no_internet.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ce3e381230d857d7928d8e13e3c2e712375ad615471d534374be314ca458186f -size 1027505 +oid sha256:630f78ed4c4595afe97d851695480de199a438fcfe21bafe9881dd3dc4cce426 +size 1039115 |