From 4bc46c347e19bc032861aa37cf903a250f247a78 Mon Sep 17 00:00:00 2001 From: Thomas Steur Date: Fri, 31 Jan 2014 02:44:51 +0000 Subject: refs #4564 we have to get the token from the piwik_tests database --- misc/cron/updatetoken.php | 5 +++++ misc/log-analytics/import_logs.py | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'misc') 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] -- cgit v1.2.3