diff options
Diffstat (limited to 'misc')
-rw-r--r-- | misc/cron/updatetoken.php | 5 | ||||
-rwxr-xr-x | misc/log-analytics/import_logs.py | 11 |
2 files changed, 15 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] |