SQLs are performed up to an execution time of 45s, then a page reload is induced to avoid fcgi/cgi/modphp timeouts.

This commit is contained in:
f0o
2015-09-02 14:30:15 +01:00
parent 501cf5a6ef
commit 9ca926b9c6
3 changed files with 12 additions and 11 deletions

View File

@@ -34,7 +34,7 @@ while (!feof($sql_fh)) {
if (isset($_SESSION['offset']) && $limit < $_REQUEST['offset']) { if (isset($_SESSION['offset']) && $limit < $_REQUEST['offset']) {
continue; continue;
} }
elseif ( abs($limit-$_REQUEST['offset']) > 6) { elseif ( time()-$_SESSION['last'] > 45 ) {
$_SESSION['offset'] = $limit; $_SESSION['offset'] = $limit;
$GLOBALS['refresh'] = '<b>Installing, please wait..</b><sub>'.date('r').'</sub><script>window.location.href = "install.php?offset='.$limit.'";</script>'; $GLOBALS['refresh'] = '<b>Installing, please wait..</b><sub>'.date('r').'</sub><script>window.location.href = "install.php?offset='.$limit.'";</script>';
return; return;

View File

@@ -317,6 +317,7 @@ elseif($stage == "2") {
$config['db_name']=$dbname; $config['db_name']=$dbname;
$config['db']['extension']='mysqli'; $config['db']['extension']='mysqli';
$sql_file = '../build.sql'; $sql_file = '../build.sql';
$_SESSION['last'] = time();
ob_end_flush(); ob_end_flush();
ob_start(); ob_start();
if ($_SESSION['offset'] < 100 && $_REQUEST['offset'] < 94) { if ($_SESSION['offset'] < 100 && $_REQUEST['offset'] < 94) {
@@ -325,11 +326,11 @@ elseif($stage == "2") {
else { else {
require '../includes/sql-schema/update.php'; require '../includes/sql-schema/update.php';
} }
$_SESSION['out'] .= ob_get_clean().PHP_EOL; $_SESSION['out'] .= ob_get_clean();
ob_end_clean(); ob_end_clean();
ob_start(); ob_start();
echo $GLOBALS['refresh']; echo $GLOBALS['refresh'];
echo "<pre>".$_SESSION['out']."</pre>"; echo "<pre>".trim($_SESSION['out'])."</pre>";
?> ?>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">

View File

@@ -91,19 +91,19 @@ if ($tmp[0] <= $db_rev) {
return; return;
} }
$limit = @$limit?: $_REQUEST['offset']; $limit = 150; //magic marker far enough in the future
foreach ($filelist as $file) { foreach ($filelist as $file) {
list($filename,$extension) = explode('.', $file, 2); list($filename,$extension) = explode('.', $file, 2);
if ($filename > $db_rev) { if ($filename > $db_rev) {
if (isset($_SESSION['stage']) ) { if (isset($_SESSION['stage']) ) {
$limit++; $limit++;
if ( abs($limit-$_REQUEST['offset']) > 6) { if ( time()-$_SESSION['last'] > 45 ) {
$_SESSION['offset'] = $limit; $_SESSION['offset'] = $limit;
$GLOBALS['refresh'] = '<b>Updating, please wait..</b><sub>'.date('r').'</sub><script>window.location.href = "install.php?offset='.$limit.'";</script>'; $GLOBALS['refresh'] = '<b>Updating, please wait..</b><sub>'.date('r').'</sub><script>window.location.href = "install.php?offset='.$limit.'";</script>';
return; return;
}
} }
}
if (!$updating) { if (!$updating) {
echo "-- Updating database schema\n"; echo "-- Updating database schema\n";