diff --git a/lam/templates/massDoUpload.php b/lam/templates/massDoUpload.php
index 2be86315..bf8d968f 100644
--- a/lam/templates/massDoUpload.php
+++ b/lam/templates/massDoUpload.php
@@ -58,10 +58,11 @@ echo "\n
// create accounts
$accounts = unserialize($_SESSION['ldap']->decrypt($_SESSION['mass_accounts']));
if (($_SESSION['mass_counter'] < sizeof($accounts)) || !isset($_SESSION['mass_postActions']['finished'])) {
- $maxTime = get_cfg_var('max_execution_time') - 5;
- $refreshTime = get_cfg_var('max_execution_time') + 1;
$startTime = time();
- echo "\n";
+ $maxTime = get_cfg_var('max_execution_time') - 5;
+ if ($maxTime > 60) $maxTime = 60;
+ $refreshTime = $maxTime + 7;
+ echo "\n";
echo "\n
\n";
echo "" . _("LDAP upload in progress. Please wait.") . "
\n";
echo "\n";
@@ -70,7 +71,7 @@ if (($_SESSION['mass_counter'] < sizeof($accounts)) || !isset($_SESSION['mass_po
echo "
";
flush(); // send HTML to browser
// add accounts to LDAP
- while (($_SESSION['mass_counter'] < sizeof($accounts)) && ($startTime + $maxTime > time())) {
+ while (($_SESSION['mass_counter'] < sizeof($accounts)) && (($startTime + $maxTime) > time())) {
// create accounts as long as max_execution_time is not near
$attrs = $accounts[$_SESSION['mass_counter']];
$dn = $attrs['dn'];
@@ -101,7 +102,7 @@ if (($_SESSION['mass_counter'] < sizeof($accounts)) || !isset($_SESSION['mass_po
echo " | \n";
echo "";
flush();
- while (!isset($_SESSION['mass_postActions']['finished']) && ($startTime + $maxTime > time())) {
+ while (!isset($_SESSION['mass_postActions']['finished']) && (($startTime + $maxTime) > time())) {
$return = doUploadPostActions($_SESSION['mass_scope'], $data, $_SESSION['mass_ids'], $_SESSION['mass_failed']);
if ($return['status'] == 'finished') {
$_SESSION['mass_postActions']['finished'] = true;