PM-2409 "No muestra ningun mensaje de error al ejecutar..." SOLVED

Issue:
    No muestra ningun mensaje de error al ejecutar messageeventcron.php con un workspace inexistente
Cause:
    No se valida el workspace
Solution:
    Se agrega validacion para verificar si el workspace existe, esto para:
        - cron.php
        - messageeventcron.php
This commit is contained in:
Victor Saisa Lopez
2015-04-24 14:09:22 -04:00
parent 6c7e0d77c9
commit 44d7a1e0ea
2 changed files with 10 additions and 2 deletions

View File

@@ -5,7 +5,7 @@
*/ */
if ( !defined('PATH_SEP') ) { if ( !defined('PATH_SEP') ) {
define('PATH_SEP', ( substr(PHP_OS, 0, 3) == 'WIN' ) ? '\\' : '/'); define("PATH_SEP", (substr(PHP_OS, 0, 3) == "WIN")? "\\" : "/");
} }
$docuroot = explode(PATH_SEP, str_replace('engine' . PATH_SEP . 'methods' . PATH_SEP . 'services', '', dirname(__FILE__))); $docuroot = explode(PATH_SEP, str_replace('engine' . PATH_SEP . 'methods' . PATH_SEP . 'services', '', dirname(__FILE__)));
@@ -129,7 +129,7 @@ if ($force || !$bCronIsRunning) {
$oDirectory = dir(PATH_DB); $oDirectory = dir(PATH_DB);
$cws = 0; $cws = 0;
while($sObject = $oDirectory->read()) { while (($sObject = $oDirectory->read()) !== false) {
if (($sObject != ".") && ($sObject != "..")) { if (($sObject != ".") && ($sObject != "..")) {
if (is_dir(PATH_DB . $sObject)) { if (is_dir(PATH_DB . $sObject)) {
if (file_exists(PATH_DB . $sObject . PATH_SEP . "db.php")) { if (file_exists(PATH_DB . $sObject . PATH_SEP . "db.php")) {
@@ -141,6 +141,10 @@ if ($force || !$bCronIsRunning) {
} }
} }
} else { } else {
if (!is_dir(PATH_DB . $ws) || !file_exists(PATH_DB . $ws . PATH_SEP . "db.php")) {
throw new Exception("Error: The workspace \"$ws\" does not exist");
}
$cws = 1; $cws = 1;
system("php -f \"" . dirname(__FILE__) . PATH_SEP . "cron_single.php\" $ws \"$sDate\" \"$dateSystem\" $argsx", $retval); system("php -f \"" . dirname(__FILE__) . PATH_SEP . "cron_single.php\" $ws \"$sDate\" \"$dateSystem\" $argsx", $retval);

View File

@@ -114,6 +114,10 @@ try {
} }
} }
} else { } else {
if (!is_dir(PATH_DB . $workspace) || !file_exists(PATH_DB . $workspace . PATH_SEP . "db.php")) {
throw new Exception("Error: The workspace \"$workspace\" does not exist");
}
$countw++; $countw++;
passthru("php -f \"$messageEventCronSinglePath\" $workspace \"" . base64_encode(PATH_HOME) . "\" \"" . base64_encode(PATH_TRUNK) . "\" \"" . base64_encode(PATH_OUTTRUNK) . "\""); passthru("php -f \"$messageEventCronSinglePath\" $workspace \"" . base64_encode(PATH_HOME) . "\" \"" . base64_encode(PATH_TRUNK) . "\" \"" . base64_encode(PATH_OUTTRUNK) . "\"");