mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-02 23:07:39 +02: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:
@@ -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]) )
|
|
||||||
{
|
if( !$in_comment )
|
||||||
$in_comment = false;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
Reference in New Issue
Block a user