[ticket/10969] Remove remove_remarks(&$sql) and remove_comments(&$output).

Merge their bodies into phpbb_remove_comments($input).

PHPBB3-10969
This commit is contained in:
Andreas Fischer 2012-07-08 21:36:12 +02:00
parent 576cd6dd1e
commit cb245b1faf
2 changed files with 3 additions and 37 deletions

View file

@ -2291,21 +2291,6 @@ function auto_prune($forum_id, $prune_mode, $prune_flags, $prune_days, $prune_fr
return; return;
} }
/**
* remove_comments will strip the sql comment lines out of an uploaded sql file
* specifically for mssql and postgres type files in the install....
*
* @deprecated Use phpbb_remove_comments() instead.
*/
function remove_comments(&$output)
{
// Remove /* */ comments (http://ostermiller.org/findcomment.html)
$output = preg_replace('#/\*(.|[\r\n])*?\*/#', "\n", $output);
// Return by reference and value.
return $output;
}
/** /**
* Cache moderators, called whenever permissions are changed via admin_permissions. Changes of username * Cache moderators, called whenever permissions are changed via admin_permissions. Changes of username
* and group names must be carried through for the moderators table * and group names must be carried through for the moderators table

View file

@ -471,19 +471,6 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
return false; return false;
} }
/**
* Removes comments from schema files
*
* @deprecated Use phpbb_remove_comments() instead.
*/
function remove_remarks(&$sql)
{
// Remove # style comments
$sql = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $sql));
// Return by reference
}
/** /**
* Removes "/* style" as well as "# style" comments from $input. * Removes "/* style" as well as "# style" comments from $input.
* *
@ -493,17 +480,11 @@ function remove_remarks(&$sql)
*/ */
function phpbb_remove_comments($input) function phpbb_remove_comments($input)
{ {
if (!function_exists('remove_comments')) // Remove /* */ comments (http://ostermiller.org/findcomment.html)
{ $input = preg_replace('#/\*(.|[\r\n])*?\*/#', "\n", $input);
global $phpbb_root_path, $phpEx;
require($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
}
// Remove /* */ comments
remove_comments($input);
// Remove # style comments // Remove # style comments
remove_remarks($input); $input = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $input));
return $input; return $input;
} }