Projekt

Allgemein

Profil

GX-Bug #54246 » ImportSQL_Fix.patch

Till Tepelmann, 16.11.2017 18:25

Unterschiede anzeigen:

src/gambio_installer/includes/import_sql.php (revision )
17 17
  Released under the GNU General Public License
18 18
  -------------------------------------------------------------- */
19 19

  
20
function countFromIndex($array, $index)
21
{
22
	$values = array_values($array);
23
	$count = count($values);
24
	$search = 0;
25
	for($i=0; $i<$count; $i++)
26
	{
27
		$search++;
28
		if($values[$i] === $index) break;
29
	}
30
	return $count-$search;
31
}
32

  
20 33
$t_output = array();
21 34

  
22 35
if(!empty($_GET['sql_part']) && xtc_in_array('database', $_POST['install']))
......
59 72
	}
60 73

  
61 74
	$GLOBALS['total_executed_queries'] = 0;
62
	$t_max_queries_per_request = 2000;
75
	$t_max_queries_per_request = 20;
63 76
	$t_next_sql = $_GET['sql_part'];
64 77
	
65 78
	while($GLOBALS['total_executed_queries'] < $t_max_queries_per_request && $t_next_sql !== '')
......
97 110
	}
98 111
	elseif($t_next_sql != '' && $t_sql_file != '')
99 112
	{
100
		$t_output['progress'] = floor(100 / count($t_files_sorted_array) * ($i + 1));
113
		$t_output['progress'] =  floor((count($t_files_sorted_array) - countFromIndex($t_files_sorted_array,$t_sql_file) ) * 100 / count($t_files_sorted_array));
101 114
		$t_output['next_sql'] = $t_next_sql;
102 115
	}
103 116
	else
    (1-1/1)