From 7eede772542de3283c6db4d58926741b2454d7d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B5nis=20Ormisson?= Date: Wed, 3 Jan 2018 10:18:47 +0200 Subject: [PATCH] Allow using full path for file --- application/commands/ImportCommand.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/application/commands/ImportCommand.php b/application/commands/ImportCommand.php index d1258721276..7703a17b989 100644 --- a/application/commands/ImportCommand.php +++ b/application/commands/ImportCommand.php @@ -41,10 +41,16 @@ public function actionIndex($file,$userId=null) } - $surveyFile = __DIR__ . '/../../'.$file; + if($file[0]===DIRECTORY_SEPARATOR){ + // we have root path set + $surveyFile = $file; + }else{ + $surveyFile = __DIR__ . '/../../'.$file; + } + if (!file_exists($surveyFile)) { - echo 'Fatal error: found no survey file'.PHP_EOL;; + echo sprintf('Fatal error: found no survey file at "%s"',$surveyFile).PHP_EOL;; exit(1); }