aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/develop/create_schema_files.php183
-rw-r--r--phpBB/install/install_install.php24
-rw-r--r--phpBB/install/schemas/firebird_schema.sql5
-rw-r--r--phpBB/install/schemas/mssql_schema.sql8
-rw-r--r--phpBB/install/schemas/mysql_40_schema.sql5
-rw-r--r--phpBB/install/schemas/mysql_41_schema.sql5
-rw-r--r--phpBB/install/schemas/oracle_schema.sql8
-rw-r--r--phpBB/install/schemas/postgres_schema.sql7
-rw-r--r--phpBB/install/schemas/sqlite_schema.sql5
-rw-r--r--tests/test_framework/phpbb_database_test_connection_manager.php15
10 files changed, 23 insertions, 242 deletions
diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php
index f9d2e2e0de..b1e981795f 100644
--- a/phpBB/develop/create_schema_files.php
+++ b/phpBB/develop/create_schema_files.php
@@ -57,187 +57,4 @@ $fp = fopen($schema_path . 'schema.json', 'wb');
fwrite($fp, json_encode($schema_data, JSON_PRETTY_PRINT));
fclose($fp);
-foreach ($supported_dbms as $dbms)
-{
- $fp = fopen($schema_path . $dbms . '_schema.sql', 'wb');
-
- // Write Header
- switch ($dbms)
- {
- case 'mysql_40':
- case 'mysql_41':
- case 'sqlite':
- case 'sqlite3':
- fwrite($fp, "# DO NOT EDIT THIS FILE, IT IS GENERATED\n");
- fwrite($fp, "#\n");
- fwrite($fp, "# To change the contents of this file, edit\n");
- fwrite($fp, "# phpBB/develop/create_schema_files.php and\n");
- fwrite($fp, "# run it.\n");
- break;
-
- case 'mssql':
- case 'oracle':
- case 'postgres':
- fwrite($fp, "/*\n");
- fwrite($fp, " * DO NOT EDIT THIS FILE, IT IS GENERATED\n");
- fwrite($fp, " *\n");
- fwrite($fp, " * To change the contents of this file, edit\n");
- fwrite($fp, " * phpBB/develop/create_schema_files.php and\n");
- fwrite($fp, " * run it.\n");
- fwrite($fp, " */\n\n");
- break;
- }
-
- $line = '';
- switch ($dbms)
- {
- case 'oracle':
- $line .= custom_data('oracle') . "\n";
- break;
-
- case 'postgres':
- $line .= "BEGIN;\n\n";
- $line .= custom_data('postgres') . "\n";
- $line .= "COMMIT;\n\n";
- break;
- }
-
- fwrite($fp, $line);
- fclose($fp);
-}
-
-/**
-* Data put into the header for various dbms
-*/
-function custom_data($dbms)
-{
- switch ($dbms)
- {
- case 'oracle':
- return <<<EOF
-/*
- This first section is optional, however its probably the best method
- of running phpBB on Oracle. If you already have a tablespace and user created
- for phpBB you can leave this section commented out!
-
- The first set of statements create a phpBB tablespace and a phpBB user,
- make sure you change the password of the phpBB user before you run this script!!
-*/
-
-/*
-CREATE TABLESPACE "PHPBB"
- LOGGING
- DATAFILE 'E:\ORACLE\ORADATA\LOCAL\PHPBB.ora'
- SIZE 10M
- AUTOEXTEND ON NEXT 10M
- MAXSIZE 100M;
-
-CREATE USER "PHPBB"
- PROFILE "DEFAULT"
- IDENTIFIED BY "phpbb_password"
- DEFAULT TABLESPACE "PHPBB"
- QUOTA UNLIMITED ON "PHPBB"
- ACCOUNT UNLOCK;
-
-GRANT ANALYZE ANY TO "PHPBB";
-GRANT CREATE SEQUENCE TO "PHPBB";
-GRANT CREATE SESSION TO "PHPBB";
-GRANT CREATE TABLE TO "PHPBB";
-GRANT CREATE TRIGGER TO "PHPBB";
-GRANT CREATE VIEW TO "PHPBB";
-GRANT "CONNECT" TO "PHPBB";
-
-COMMIT;
-DISCONNECT;
-
-CONNECT phpbb/phpbb_password;
-*/
-EOF;
-
- break;
-
- case 'postgres':
- return <<<EOF
-/*
- Domain definition
-*/
-CREATE DOMAIN varchar_ci AS varchar(255) NOT NULL DEFAULT ''::character varying;
-
-/*
- Operation Functions
-*/
-CREATE FUNCTION _varchar_ci_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) = LOWER($2)' LANGUAGE SQL STRICT;
-CREATE FUNCTION _varchar_ci_not_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) != LOWER($2)' LANGUAGE SQL STRICT;
-CREATE FUNCTION _varchar_ci_less_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) < LOWER($2)' LANGUAGE SQL STRICT;
-CREATE FUNCTION _varchar_ci_less_equal(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) <= LOWER($2)' LANGUAGE SQL STRICT;
-CREATE FUNCTION _varchar_ci_greater_than(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) > LOWER($2)' LANGUAGE SQL STRICT;
-CREATE FUNCTION _varchar_ci_greater_equals(varchar_ci, varchar_ci) RETURNS boolean AS 'SELECT LOWER($1) >= LOWER($2)' LANGUAGE SQL STRICT;
-
-/*
- Operators
-*/
-CREATE OPERATOR <(
- PROCEDURE = _varchar_ci_less_than,
- LEFTARG = varchar_ci,
- RIGHTARG = varchar_ci,
- COMMUTATOR = >,
- NEGATOR = >=,
- RESTRICT = scalarltsel,
- JOIN = scalarltjoinsel);
-
-CREATE OPERATOR <=(
- PROCEDURE = _varchar_ci_less_equal,
- LEFTARG = varchar_ci,
- RIGHTARG = varchar_ci,
- COMMUTATOR = >=,
- NEGATOR = >,
- RESTRICT = scalarltsel,
- JOIN = scalarltjoinsel);
-
-CREATE OPERATOR >(
- PROCEDURE = _varchar_ci_greater_than,
- LEFTARG = varchar_ci,
- RIGHTARG = varchar_ci,
- COMMUTATOR = <,
- NEGATOR = <=,
- RESTRICT = scalargtsel,
- JOIN = scalargtjoinsel);
-
-CREATE OPERATOR >=(
- PROCEDURE = _varchar_ci_greater_equals,
- LEFTARG = varchar_ci,
- RIGHTARG = varchar_ci,
- COMMUTATOR = <=,
- NEGATOR = <,
- RESTRICT = scalargtsel,
- JOIN = scalargtjoinsel);
-
-CREATE OPERATOR <>(
- PROCEDURE = _varchar_ci_not_equal,
- LEFTARG = varchar_ci,
- RIGHTARG = varchar_ci,
- COMMUTATOR = <>,
- NEGATOR = =,
- RESTRICT = neqsel,
- JOIN = neqjoinsel);
-
-CREATE OPERATOR =(
- PROCEDURE = _varchar_ci_equal,
- LEFTARG = varchar_ci,
- RIGHTARG = varchar_ci,
- COMMUTATOR = =,
- NEGATOR = <>,
- RESTRICT = eqsel,
- JOIN = eqjoinsel,
- HASHES,
- MERGES,
- SORT1= <);
-
-EOF;
- break;
- }
-
- return '';
-}
-
echo 'done';
diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php
index 576cbba3ca..5f8c0c277c 100644
--- a/phpBB/install/install_install.php
+++ b/phpBB/install/install_install.php
@@ -1153,21 +1153,25 @@ class install_install extends module
// How should we treat this schema?
$delimiter = $available_dbms[$data['dbms']]['DELIM'];
- $sql_query = @file_get_contents($dbms_schema);
- $sql_query = preg_replace('#phpbb_#i', $data['table_prefix'], $sql_query);
- $sql_query = phpbb_remove_comments($sql_query);
- $sql_query = split_sql_file($sql_query, $delimiter);
- foreach ($sql_query as $sql)
+ if (file_exists($dbms_schema))
{
- //$sql = trim(str_replace('|', ';', $sql));
- if (!$db->sql_query($sql))
+ $sql_query = @file_get_contents($dbms_schema);
+ $sql_query = preg_replace('#phpbb_#i', $data['table_prefix'], $sql_query);
+ $sql_query = phpbb_remove_comments($sql_query);
+ $sql_query = split_sql_file($sql_query, $delimiter);
+
+ foreach ($sql_query as $sql)
{
- $error = $db->sql_error();
- $this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__);
+ //$sql = trim(str_replace('|', ';', $sql));
+ if (!$db->sql_query($sql))
+ {
+ $error = $db->sql_error();
+ $this->p_master->db_error($error['message'], $sql, __LINE__, __FILE__);
+ }
}
+ unset($sql_query);
}
- unset($sql_query);
// Ok we have the db info go ahead and work on building the table
$db_table_schema = @file_get_contents('schemas/schema.json');
diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql
deleted file mode 100644
index 28649dc54c..0000000000
--- a/phpBB/install/schemas/firebird_schema.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-# DO NOT EDIT THIS FILE, IT IS GENERATED
-#
-# To change the contents of this file, edit
-# phpBB/develop/create_schema_files.php and
-# run it.
diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql
deleted file mode 100644
index f88513cf0e..0000000000
--- a/phpBB/install/schemas/mssql_schema.sql
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * DO NOT EDIT THIS FILE, IT IS GENERATED
- *
- * To change the contents of this file, edit
- * phpBB/develop/create_schema_files.php and
- * run it.
- */
-
diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql
deleted file mode 100644
index 28649dc54c..0000000000
--- a/phpBB/install/schemas/mysql_40_schema.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-# DO NOT EDIT THIS FILE, IT IS GENERATED
-#
-# To change the contents of this file, edit
-# phpBB/develop/create_schema_files.php and
-# run it.
diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql
deleted file mode 100644
index 28649dc54c..0000000000
--- a/phpBB/install/schemas/mysql_41_schema.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-# DO NOT EDIT THIS FILE, IT IS GENERATED
-#
-# To change the contents of this file, edit
-# phpBB/develop/create_schema_files.php and
-# run it.
diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql
index 61f5d5f961..2473d31aab 100644
--- a/phpBB/install/schemas/oracle_schema.sql
+++ b/phpBB/install/schemas/oracle_schema.sql
@@ -1,12 +1,4 @@
/*
- * DO NOT EDIT THIS FILE, IT IS GENERATED
- *
- * To change the contents of this file, edit
- * phpBB/develop/create_schema_files.php and
- * run it.
- */
-
-/*
This first section is optional, however its probably the best method
of running phpBB on Oracle. If you already have a tablespace and user created
for phpBB you can leave this section commented out!
diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index 3fc8589844..65caba8d1c 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -1,10 +1,3 @@
-/*
- * DO NOT EDIT THIS FILE, IT IS GENERATED
- *
- * To change the contents of this file, edit
- * phpBB/develop/create_schema_files.php and
- * run it.
- */
BEGIN;
diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql
deleted file mode 100644
index 28649dc54c..0000000000
--- a/phpBB/install/schemas/sqlite_schema.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-# DO NOT EDIT THIS FILE, IT IS GENERATED
-#
-# To change the contents of this file, edit
-# phpBB/develop/create_schema_files.php and
-# run it.
diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php
index 0d0f08f1f5..92e2080dba 100644
--- a/tests/test_framework/phpbb_database_test_connection_manager.php
+++ b/tests/test_framework/phpbb_database_test_connection_manager.php
@@ -342,14 +342,17 @@ class phpbb_database_test_connection_manager
$filename = $directory . $schema . '_schema.sql';
- $queries = file_get_contents($filename);
- $sql = phpbb_remove_comments($queries);
+ if (file_exists($filename))
+ {
+ $queries = file_get_contents($filename);
+ $sql = phpbb_remove_comments($queries);
- $sql = split_sql_file($sql, $this->dbms['DELIM']);
+ $sql = split_sql_file($sql, $this->dbms['DELIM']);
- foreach ($sql as $query)
- {
- $this->pdo->exec($query);
+ foreach ($sql as $query)
+ {
+ $this->pdo->exec($query);
+ }
}
// Ok we have the db info go ahead and work on building the table