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:
-rw-r--r--misc/cron/updatetoken.php5
-rwxr-xr-xmisc/log-analytics/import_logs.py11
-rw-r--r--tests/PHPUnit/Fixtures/ManySitesImportedLogs.php2
3 files changed, 17 insertions, 1 deletions
diff --git a/misc/cron/updatetoken.php b/misc/cron/updatetoken.php
index 351d980c1d..f7cba2ab20 100644
--- a/misc/cron/updatetoken.php
+++ b/misc/cron/updatetoken.php
@@ -29,6 +29,11 @@ if (!Common::isPhpCliMode()) {
return;
}
+$testmode = in_array('--testmode', $_SERVER['argv']);
+if ($testmode) {
+ Config::getInstance()->setTestEnvironment();
+}
+
$token = Db::get()->fetchOne("SELECT token_auth
FROM " . Common::prefixTable("user") . "
WHERE superuser_access = 1
diff --git a/misc/log-analytics/import_logs.py b/misc/log-analytics/import_logs.py
index 14443a7cb0..29f5447a19 100755
--- a/misc/log-analytics/import_logs.py
+++ b/misc/log-analytics/import_logs.py
@@ -490,6 +490,10 @@ class Configuration(object):
help="Make URL path lowercase so paths with the same letters but different cases are "
"treated the same."
)
+ option_parser.add_option(
+ '--enable-testmode', dest='enable_testmode', default=False, action='store_true',
+ help="If set, it will try to get the token_auth from the piwik_tests directory"
+ )
return option_parser
@@ -592,7 +596,12 @@ class Configuration(object):
os.path.join(os.path.dirname(__file__),
'../../misc/cron/updatetoken.php'),
)
- filename = subprocess.check_output("php " + updatetokenfile, shell=True);
+
+ process = "php " + updatetokenfile
+ if self.options.enable_testmode:
+ process = process + " --testmode"
+
+ filename = subprocess.check_output(process, shell=True);
credentials = open(filename, 'r').readline()
credentials = credentials.split('\t')
return credentials[1]
diff --git a/tests/PHPUnit/Fixtures/ManySitesImportedLogs.php b/tests/PHPUnit/Fixtures/ManySitesImportedLogs.php
index d3665dc9bf..9390bab9ec 100644
--- a/tests/PHPUnit/Fixtures/ManySitesImportedLogs.php
+++ b/tests/PHPUnit/Fixtures/ManySitesImportedLogs.php
@@ -128,6 +128,7 @@ class Test_Piwik_Fixture_ManySitesImportedLogs extends Test_Piwik_BaseFixture
// We do not pass the "--token_auth" parameter here to make sure import_logs.py finds the auth_token
// automatically if needed
$opts = array('--idsite' => $this->idSite,
+ '--enable-testmode' => '1',
'--recorders' => '4',
'--recorder-max-payload-size' => '2');
@@ -145,6 +146,7 @@ class Test_Piwik_Fixture_ManySitesImportedLogs extends Test_Piwik_BaseFixture
// We do not pass the "--token_auth" parameter here to make sure import_logs.py finds the auth_token
// automatically if needed
$opts = array('--add-sites-new-hosts' => false,
+ '--enable-testmode' => '1',
'--recorders' => '4',
'--recorder-max-payload-size' => '1');