diff --git a/gulliver/system/class.bootstrap.php b/gulliver/system/class.bootstrap.php index 12bdad1d6..ebb6450bd 100644 --- a/gulliver/system/class.bootstrap.php +++ b/gulliver/system/class.bootstrap.php @@ -611,9 +611,12 @@ class Bootstrap * 0 to delete the temporary file flag * 1 to set the temporary file flag. * 2 or bigger to check if the temporary file exists. + * @content Contains the content of the temporary file + * true to all workspace + * nameWorkspace to specific workspace * return true if the file exists, otherwise false. */ - public function isPMUnderUpdating($setFlag = 2) + public function isPMUnderUpdating($setFlag = 2, $content="true") { if (!defined('PATH_DATA')) { return false; @@ -626,12 +629,16 @@ class Bootstrap } } elseif ($setFlag == 1) { $fp = fopen($fileCheck, 'w'); - $line = fputs($fp, "true"); + $line = fputs($fp, $content); } // checking temporary file if ($setFlag >= 1) { if (file_exists($fileCheck)) { - return true; + $res['action'] = true; + $fp = fopen($fileCheck, "r"); + $res['workspace'] = fread($fp, filesize($fileCheck)); + fclose($fp); + return $res; } } return false; diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index 077b4a37f..9f6866d77 100644 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -5122,9 +5122,12 @@ class G * 0 to delete the temporary file flag * 1 to set the temporary file flag. * 2 or bigger to check if the temporary file exists. + * @content Contains the content of the temporary file + * true to all workspace + * nameWorkspace to specific workspace * return true if the file exists, otherwise false. */ - public function isPMUnderUpdating($setFlag = 2) + public function isPMUnderUpdating($setFlag = 2, $content="true") { if (!defined('PATH_DATA')) { return false; @@ -5136,12 +5139,16 @@ class G } } elseif ($setFlag == 1) { $fp = fopen($fileCheck,'w'); - $line = fputs($fp,"true"); + $line = fputs($fp,$content); } //checking temporary file if ($setFlag >= 1) { if (file_exists($fileCheck)) { - return true; + $res['action'] = true; + $fp = fopen($fileCheck, "r"); + $res['workspace'] = fread($fp, filesize($fileCheck)); + fclose($fp); + return $res; } } return false; diff --git a/workflow/engine/bin/tasks/cliUpgrade.php b/workflow/engine/bin/tasks/cliUpgrade.php index 776ceb13f..1d575fc81 100755 --- a/workflow/engine/bin/tasks/cliUpgrade.php +++ b/workflow/engine/bin/tasks/cliUpgrade.php @@ -82,7 +82,14 @@ function run_upgrade($command, $args) CLI::logging("UPGRADE", PROCESSMAKER_PATH . "upgrade.log"); CLI::logging("Checking files integrity...\n"); //setting flag to true to check into sysGeneric.php - $flag = G::isPMUnderUpdating(1); + $workspaces = get_workspaces_from_args($command); + $oneWorkspace = 'true'; + if (count($workspaces) == 1) { + foreach ($workspaces as $index => $workspace) { + $oneWorkspace = $workspace->name; + } + } + $flag = G::isPMUnderUpdating(1, $oneWorkspace); //start to upgrade $checksum = System::verifyChecksum(); if ($checksum === false) { diff --git a/workflow/public_html/bootstrap.php b/workflow/public_html/bootstrap.php index c6f8e69d9..755a627c3 100755 --- a/workflow/public_html/bootstrap.php +++ b/workflow/public_html/bootstrap.php @@ -223,12 +223,14 @@ // the request correspond to valid php page, now parse the URI G::parseURI(getenv("REQUEST_URI"), $isRestRequest); - if(G::isPMUnderUpdating()) - { - header("location: /update/updating.php"); - if ( DEBUG_TIME_LOG ) G::logTimeByPage(); - die; - } + $arrayUpdating = G::isPMUnderUpdating(); + if ($arrayUpdating['action']) { + if ($arrayUpdating['workspace'] == "true" || $arrayUpdating['workspace'] == SYS_TEMP) { + header("location: /update/updating.php"); + if (DEBUG_TIME_LOG) G::logTimeByPage(); + die; + } + } // verify if index.html exists if (!file_exists(PATH_HTML . 'index.html')) { // if not, create it from template diff --git a/workflow/public_html/sysGeneric.php b/workflow/public_html/sysGeneric.php index 950cd1199..087e0461d 100755 --- a/workflow/public_html/sysGeneric.php +++ b/workflow/public_html/sysGeneric.php @@ -484,11 +484,14 @@ if (SYS_TARGET === false) { } // Bootstrap::mylog("sys_temp: ".SYS_TEMP); -if (Bootstrap::isPMUnderUpdating()) { - header( "location: /update/updating.php" ); - if (DEBUG_TIME_LOG) - Bootstrap::logTimeByPage(); - die(); +$arrayUpdating = Bootstrap::isPMUnderUpdating(); +if ($arrayUpdating['action']) { + if ($arrayUpdating['workspace'] == "true" || $arrayUpdating['workspace'] == SYS_TEMP) { + header("location: /update/updating.php"); + if (DEBUG_TIME_LOG) + Bootstrap::logTimeByPage(); + die(); + } } // verify if index.html exists