mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Improved the performance of remove_remarks() by an order of magnitude.
git-svn-id: file:///svn/phpbb/trunk@1063 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
fa76b50795
commit
2ea142d935
1 changed files with 14 additions and 12 deletions
|
@ -659,24 +659,26 @@ function output_table_content($content)
|
||||||
//
|
//
|
||||||
function remove_remarks($sql)
|
function remove_remarks($sql)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$lines = explode("\n", $sql);
|
||||||
|
$linecount = count($lines);
|
||||||
|
$output = "";
|
||||||
|
|
||||||
while($i < strlen($sql))
|
for ($i = 0; $i < $linecount; $i++)
|
||||||
{
|
{
|
||||||
if( $sql[$i] == "#" && ( $sql[$i-1] == "\n" || $i==0 ) )
|
if (($i != ($linecount - 1)) || (strlen($lines[$i]) > 0))
|
||||||
{
|
{
|
||||||
$j = 1;
|
if ($lines[$i][0] != "#")
|
||||||
|
|
||||||
while( $sql[$i + $j] != "\n" )
|
|
||||||
{
|
{
|
||||||
$j++;
|
$output .= $lines[$i] . "\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$output .= "\n";
|
||||||
}
|
}
|
||||||
$sql = substr($sql,0,$i) . substr($sql,$i+$j);
|
|
||||||
}
|
}
|
||||||
$i++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return($sql);
|
return $output;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue