aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_install.php
diff options
context:
space:
mode:
authorPatrick Webster <noxwizard@phpbb.com>2011-09-28 01:52:08 -0500
committerPatrick Webster <noxwizard@phpbb.com>2011-09-28 01:52:08 -0500
commit26e84b12e817dd5e86a82c379a03a67f9f1bacd1 (patch)
treef08bd0fbd7c50f9f153c72bc6d0df1bf706ba8a1 /phpBB/includes/functions_install.php
parent4bc11db0ffc3b387e4ad38b0d9ceccfa58f2738d (diff)
downloadforums-26e84b12e817dd5e86a82c379a03a67f9f1bacd1.tar
forums-26e84b12e817dd5e86a82c379a03a67f9f1bacd1.tar.gz
forums-26e84b12e817dd5e86a82c379a03a67f9f1bacd1.tar.bz2
forums-26e84b12e817dd5e86a82c379a03a67f9f1bacd1.tar.xz
forums-26e84b12e817dd5e86a82c379a03a67f9f1bacd1.zip
[ticket/10349] Use new schema comment function in installer
This is what now runs in the unit tests. The COMMENTS field in the dbms data is no longer needed, so it has been removed. PHPBB3-10349
Diffstat (limited to 'phpBB/includes/functions_install.php')
-rw-r--r--phpBB/includes/functions_install.php20
1 files changed, 9 insertions, 11 deletions
diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php
index 992e8d6bb0..270fa0f0b3 100644
--- a/phpBB/includes/functions_install.php
+++ b/phpBB/includes/functions_install.php
@@ -50,7 +50,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'firebird',
'MODULE' => 'interbase',
'DELIM' => ';;',
- 'COMMENTS' => 'remove_remarks',
'DRIVER' => 'firebird',
'AVAILABLE' => true,
'2.0.x' => false,
@@ -60,7 +59,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'mysql_41',
'MODULE' => 'mysqli',
'DELIM' => ';',
- 'COMMENTS' => 'remove_remarks',
'DRIVER' => 'mysqli',
'AVAILABLE' => true,
'2.0.x' => true,
@@ -70,7 +68,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'mysql',
'MODULE' => 'mysql',
'DELIM' => ';',
- 'COMMENTS' => 'remove_remarks',
'DRIVER' => 'mysql',
'AVAILABLE' => true,
'2.0.x' => true,
@@ -80,7 +77,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'mssql',
'MODULE' => 'mssql',
'DELIM' => 'GO',
- 'COMMENTS' => 'remove_comments',
'DRIVER' => 'mssql',
'AVAILABLE' => true,
'2.0.x' => true,
@@ -90,7 +86,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'mssql',
'MODULE' => 'odbc',
'DELIM' => 'GO',
- 'COMMENTS' => 'remove_comments',
'DRIVER' => 'mssql_odbc',
'AVAILABLE' => true,
'2.0.x' => true,
@@ -100,7 +95,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'mssql',
'MODULE' => 'sqlsrv',
'DELIM' => 'GO',
- 'COMMENTS' => 'remove_comments',
'DRIVER' => 'mssqlnative',
'AVAILABLE' => true,
'2.0.x' => false,
@@ -110,7 +104,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'oracle',
'MODULE' => 'oci8',
'DELIM' => '/',
- 'COMMENTS' => 'remove_comments',
'DRIVER' => 'oracle',
'AVAILABLE' => true,
'2.0.x' => false,
@@ -120,7 +113,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'postgres',
'MODULE' => 'pgsql',
'DELIM' => ';',
- 'COMMENTS' => 'remove_comments',
'DRIVER' => 'postgres',
'AVAILABLE' => true,
'2.0.x' => true,
@@ -130,7 +122,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'sqlite',
'MODULE' => 'sqlite',
'DELIM' => ';',
- 'COMMENTS' => 'remove_remarks',
'DRIVER' => 'sqlite',
'AVAILABLE' => true,
'2.0.x' => false,
@@ -514,11 +505,18 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
}
/**
-* remove_remarks will strip the sql comment lines out of an uploaded sql file
+* Removes comments from schema files
+*
*/
-function remove_remarks(&$sql)
+function remove_comments($sql)
{
+ // Remove /* */ comments (http://ostermiller.org/findcomment.html)
+ $sql = preg_replace('#/\*(.|[\r\n])*?\*/#', "\n", $sql);
+
+ // Remove # style comments
$sql = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $sql));
+
+ return $sql;
}
/**