mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
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:
parent
1aad3f884a
commit
ebfc14b774
1 changed files with 14 additions and 12 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Reference in a new issue