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:
@@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -64,6 +64,9 @@ 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);
|
||||
//start to upgrade
|
||||
$checksum = System::verifyChecksum();
|
||||
if ($checksum === false) {
|
||||
CLI::logging(CLI::error("checksum.txt not found, integrity check is not possible") . "\n");
|
||||
@@ -117,5 +120,7 @@ function run_upgrade($command, $args)
|
||||
} else {
|
||||
CLI::logging("Upgrade successful\n");
|
||||
}
|
||||
//setting flag to false
|
||||
$flag = G::isPMUnderUpdating(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,12 +56,6 @@ class workspaceTools {
|
||||
*/
|
||||
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);
|
||||
CLI::logging("> Updating database...\n");
|
||||
$this->upgradeDatabase();
|
||||
@@ -89,8 +83,6 @@ class workspaceTools {
|
||||
$stop = microtime(true);
|
||||
$final = $stop - $start;
|
||||
CLI::logging("<*> Process Updating cache view carried out in $final seconds.\n");
|
||||
//setting flag to false
|
||||
$_SERVER['Updating'] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -258,11 +258,6 @@
|
||||
if ( DEBUG_TIME_LOG ) G::logTimeByPage(); //log this page
|
||||
die;
|
||||
break;
|
||||
case 'update':
|
||||
header ("location: /update/updating.php");
|
||||
if ( DEBUG_TIME_LOG ) G::logTimeByPage();
|
||||
die;
|
||||
break;
|
||||
default :
|
||||
if (substr($realPath, 0, 12) == 'rest-service') {
|
||||
$isRestRequest = true;
|
||||
@@ -278,13 +273,13 @@
|
||||
// the request correspond to valid php page, now parse the URI
|
||||
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");
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user