qcobjects-cli
Advanced tools
Comparing version 0.1.36 to 0.1.37
@@ -80,2 +80,11 @@ /** | ||
}, | ||
trimSlash:function (pathname){ | ||
if (pathname.startsWith('/')){ | ||
pathname = pathname.slice(1); | ||
} | ||
if (pathname.endsWith('/')){ | ||
pathname = pathname.slice(0,-1); | ||
} | ||
return pathname.replace('//','/'); | ||
}, | ||
get:function (){ | ||
@@ -92,4 +101,24 @@ var microservice = this; | ||
&& microservice.route.redirect_to !== '')?(microservice.route.redirect_to):(microservice.request.scriptname); | ||
var pathname = this.trimSlash(microservice.request.pathname); | ||
var documentRoot = CONFIG.get('documentRoot',''); | ||
if (documentRoot == './'){ | ||
documentRoot = ''; | ||
} | ||
var commandline = microservice.get_php_headers_list()+` php -q <<- 'EOF' | ||
var scriptFilePath; | ||
if (documentRoot !== ''){ | ||
scriptFilePath = `${documentRoot}/${pathname}/${scriptFileName}`; | ||
} else { | ||
scriptFilePath = `${pathname}/${scriptFileName}`; | ||
} | ||
scriptFilePath = scriptFilePath.replace('//','/'); | ||
if (scriptFilePath.startsWith('/') && !documentRoot.startsWith('/')){ | ||
scriptFilePath = scriptFilePath.slice(1); | ||
} | ||
logger.debug(`Loading PHP file: ${scriptFilePath}`); | ||
var PHPIncludePath = `.:${CONFIG.get('documentRoot')}:${CONFIG.get('projectPath')}`; | ||
var commandline = microservice.get_php_headers_list()+` php -d include_path="${PHPIncludePath}" -q <<- 'EOF' | ||
<?php | ||
@@ -105,7 +134,7 @@ $_payload = file_get_contents(sys_get_temp_dir().'${microservice.tempFileName}'); | ||
unlink(sys_get_temp_dir().'${microservice.tempFileName}'); | ||
@include_once('${scriptFileName}'); | ||
include('${scriptFilePath}'); | ||
?> | ||
EOF` | ||
commandline = fixWinCmd(commandline); | ||
// logger.debug(commandline); | ||
logger.debug(commandline); | ||
try { | ||
@@ -136,4 +165,24 @@ microservice.body = execSync(commandline).toString(); | ||
&& microservice.route.redirect_to !== '')?(microservice.route.redirect_to):(microservice.request.scriptname); | ||
var pathname = this.trimSlash(microservice.request.pathname); | ||
var documentRoot = CONFIG.get('documentRoot',''); | ||
if (documentRoot == './'){ | ||
documentRoot = ''; | ||
} | ||
var commandline = microservice.get_php_headers_list()+` php -q <<- 'EOF' | ||
var scriptFilePath; | ||
if (documentRoot !== ''){ | ||
scriptFilePath = `${documentRoot}/${pathname}/${scriptFileName}`; | ||
} else { | ||
scriptFilePath = `${pathname}/${scriptFileName}`; | ||
} | ||
scriptFilePath = scriptFilePath.replace('//','/'); | ||
if (scriptFilePath.startsWith('/') && !documentRoot.startsWith('/')){ | ||
scriptFilePath = scriptFilePath.slice(1); | ||
} | ||
logger.debug(`Loading PHP file: ${scriptFilePath}`); | ||
var PHPIncludePath = `.:${CONFIG.get('documentRoot')}:${CONFIG.get('projectPath')}`; | ||
var commandline = microservice.get_php_headers_list()+` php -d include_path="${PHPIncludePath}" -q <<- 'EOF' | ||
<?php | ||
@@ -149,3 +198,3 @@ $_payload = file_get_contents(sys_get_temp_dir().'${microservice.tempFileName}'); | ||
unlink(sys_get_temp_dir().'${microservice.tempFileName}'); | ||
@include_once('${scriptFileName}'); | ||
@include('${scriptFilePath}'); | ||
?> | ||
@@ -152,0 +201,0 @@ EOF` |
{ | ||
"name": "qcobjects-cli", | ||
"version": "0.1.36", | ||
"version": "0.1.37", | ||
"description": "qcobjects cli command line tool", | ||
@@ -5,0 +5,0 @@ "main": "qcobjects-cli.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
91564
2121