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
path: root/misc
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@googlemail.com>2014-04-01 07:18:22 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-04-01 07:18:22 +0400
commitd41fe2ae92d734b78d67e43335b839b66fb20def (patch)
tree9aeff24639fe2a1930bf6973d22ab33e5a55d88e /misc
parent99ff035e0893806945d7e0216f0a8fdbc11c757a (diff)
fixes #4934 should make it work on windows if php.exe is in path
Diffstat (limited to 'misc')
-rwxr-xr-xmisc/log-analytics/import_logs.py23
1 files changed, 20 insertions, 3 deletions
diff --git a/misc/log-analytics/import_logs.py b/misc/log-analytics/import_logs.py
index fad2d63573..b06422b2f3 100755
--- a/misc/log-analytics/import_logs.py
+++ b/misc/log-analytics/import_logs.py
@@ -622,14 +622,31 @@ class Configuration(object):
'../../misc/cron/updatetoken.php'),
)
- command = ['php', updatetokenfile]
+ phpBinary = 'php'
+
+ is_windows = sys.platform.startswith('win')
+ if is_windows:
+ try:
+ processWin = subprocess.Popen('where php.exe', stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ [stdout, stderr] = processWin.communicate()
+ if processWin.returncode == 0:
+ phpBinary = stdout.strip()
+ else:
+ fatal_error("We couldn't detect PHP. It might help to add your php.exe to the path or alternatively run the importer using the --login and --password option")
+ except:
+ fatal_error("We couldn't detect PHP. You can run the importer using the --login and --password option to fix this issue")
+
+
+ command = [phpBinary, updatetokenfile]
if self.options.enable_testmode:
command.append('--testmode')
- process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ command = subprocess.list2cmdline(command)
+ process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
[stdout, stderr] = process.communicate()
if process.returncode != 0:
- fatal_error("`" + ' '.join(command) + "` failed with error: " + stderr + ".\nReponse code was: " + str(process.returncode))
+ fatal_error("`" + command + "` failed with error: " + stderr + ".\nReponse code was: " + str(process.returncode) + ". You can alternatively run the importer using the --login and --password option")
+
filename = stdout
credentials = open(filename, 'r').readline()