preg_quote lines for /* comment parsed SQL ... was causing failure on install for mssql ...

git-svn-id: file:///svn/phpbb/trunk@1977 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-01-28 00:57:27 +00:00
parent 1aad3f884a
commit ebfc14b774

View file

@ -32,32 +32,34 @@
// remove_comments will strip the sql comment lines out of an uploaded sql file // remove_comments will strip the sql comment lines out of an uploaded sql file
// specifically for mssql and postgres type files in the install.... // specifically for mssql and postgres type files in the install....
// //
function remove_comments($sql) function remove_comments(&$output)
{ {
$lines = explode("\n", $sql); $lines = explode("\n", $output);
$output = "";
// try to keep mem. use down // try to keep mem. use down
$sql = "";
$linecount = count($lines); $linecount = count($lines);
$output = "";
$in_comment = false; $in_comment = false;
for($i = 0; $i < $linecount; $i++) for($i = 0; $i < $linecount; $i++)
{ {
if( ereg("^\/\*", $lines[$i]) ) if( preg_match("/^\/\*/", preg_quote($lines[$i])) )
{ {
$in_comment = true; $in_comment = true;
} }
if( ereg("\*\/$", $lines[$i]) )
{
$in_comment = false;
$i++;
}
if( !$in_comment ) if( !$in_comment )
{ {
$output .= $lines[$i] . "\n"; $output .= $lines[$i] . "\n";
} }
$lines[$i] = '';
if( preg_match("/\*\/$/", preg_quote($lines[$i])) )
{
$in_comment = false;
} }
}
unset($lines);
return $output; return $output;
} }
// //