BUG 9814 Proposal pivot skin: UNDER CONSTRUCTION

PROBLEM  There is not a page to show up if PM is under updating.
SOLUTION Add a page to be displayed only if PM is updating.
This commit is contained in:
Ralph Asendeteufrer
2012-10-16 10:17:25 -04:00
parent e8e6b94d3b
commit 011b9f7445
4 changed files with 37 additions and 15 deletions

View File

@@ -5491,6 +5491,36 @@ function getDirectorySize($path,$maxmtime=0)
} }
return $text;//TODO: perhaps it shouls return an array to don't loose the original string text return $text;//TODO: perhaps it shouls return an array to don't loose the original string text
} }
/**
* isPMUnderUpdating, Used to set a file flag tio check if PM is upgrading.
*
* @setFlag Contains the flag to set or unset the temporary file:
* 0 to delete the temporary file flag
* 1 to set the temporary file flag.
* 2 or bigger to check if the temporary file exists.
* return true if the file exists, otherwise false.
*/
function isPMUnderUpdating($setFlag = 2)
{
$fileCheck = PATH_TRUNK."UPDATE.dat";
if($setFlag == 0){
if (file_exists($fileCheck)){
unlink ($fileCheck);
}
}
else if($setFlag == 1){
$fp = fopen($fileCheck,'w');
$line = fputs($fp,"true");
}
//checking temporary file
if($setFlag >= 1){
if ( file_exists($fileCheck)){
return true;
}
}
return false;
}
} }
/** /**

View File

@@ -64,6 +64,9 @@ function run_upgrade($command, $args)
{ {
CLI::logging("UPGRADE", PROCESSMAKER_PATH . "upgrade.log"); CLI::logging("UPGRADE", PROCESSMAKER_PATH . "upgrade.log");
CLI::logging("Checking files integrity...\n"); CLI::logging("Checking files integrity...\n");
//setting flag to true to check into sysGeneric.php
$flag = G::isPMUnderUpdating(1);
//start to upgrade
$checksum = System::verifyChecksum(); $checksum = System::verifyChecksum();
if ($checksum === false) { if ($checksum === false) {
CLI::logging(CLI::error("checksum.txt not found, integrity check is not possible") . "\n"); CLI::logging(CLI::error("checksum.txt not found, integrity check is not possible") . "\n");
@@ -117,5 +120,7 @@ function run_upgrade($command, $args)
} else { } else {
CLI::logging("Upgrade successful\n"); CLI::logging("Upgrade successful\n");
} }
//setting flag to false
$flag = G::isPMUnderUpdating(0);
} }

View File

@@ -56,12 +56,6 @@ class workspaceTools {
*/ */
public function upgrade($first=false, $buildCacheView=false, $workSpace=SYS_SYS) public function upgrade($first=false, $buildCacheView=false, $workSpace=SYS_SYS)
{ {
//setting flag to true to check into sysGeneric.php by usign G::virtualURI
date_default_timezone_get();
//$final = date('F d, Y h:i:s', mktime(date('h'), date('i')+3, date('s')+30,date("m"),date("d"),date("Y")));
//$_SERVER['timeRemainUpdate'] = $final;
$_SERVER['Updating'] = true;
//updating
$start = microtime(true); $start = microtime(true);
CLI::logging("> Updating database...\n"); CLI::logging("> Updating database...\n");
$this->upgradeDatabase(); $this->upgradeDatabase();
@@ -89,8 +83,6 @@ class workspaceTools {
$stop = microtime(true); $stop = microtime(true);
$final = $stop - $start; $final = $stop - $start;
CLI::logging("<*> Process Updating cache view carried out in $final seconds.\n"); CLI::logging("<*> Process Updating cache view carried out in $final seconds.\n");
//setting flag to false
$_SERVER['Updating'] = true;
} }
/** /**

View File

@@ -258,11 +258,6 @@
if ( DEBUG_TIME_LOG ) G::logTimeByPage(); //log this page if ( DEBUG_TIME_LOG ) G::logTimeByPage(); //log this page
die; die;
break; break;
case 'update':
header ("location: /update/updating.php");
if ( DEBUG_TIME_LOG ) G::logTimeByPage();
die;
break;
default : default :
if (substr($realPath, 0, 12) == 'rest-service') { if (substr($realPath, 0, 12) == 'rest-service') {
$isRestRequest = true; $isRestRequest = true;
@@ -278,13 +273,13 @@
// the request correspond to valid php page, now parse the URI // the request correspond to valid php page, now parse the URI
G::parseURI(getenv("REQUEST_URI"), $isRestRequest); G::parseURI(getenv("REQUEST_URI"), $isRestRequest);
if(isset($_SERVER['Updating']) && $_SERVER['Updating'] == true) //if(isset($_SERVER['Updating']) && $_SERVER['Updating'] == true)
if(G::isPMUnderUpdating())
{ {
header("location: /update/updating.php"); header("location: /update/updating.php");
if ( DEBUG_TIME_LOG ) G::logTimeByPage(); if ( DEBUG_TIME_LOG ) G::logTimeByPage();
die; die;
} }
// verify if index.html exists // verify if index.html exists
if (!file_exists(PATH_HTML . 'index.html')) { // if not, create it from template if (!file_exists(PATH_HTML . 'index.html')) { // if not, create it from template