Skip to content

Commit 04164af

Browse files
committed
[ticket/12747] Drop support for Firebird
PHPBB3-12747
1 parent 70d4ede commit 04164af

26 files changed

Lines changed: 9 additions & 1145 deletions

phpBB/develop/create_schema_files.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
$schema_path = dirname(__FILE__) . '/../install/schemas/';
2222
$supported_dbms = array(
23-
'firebird',
2423
'mssql',
2524
'mysql_40',
2625
'mysql_41',
@@ -67,7 +66,6 @@
6766
{
6867
case 'mysql_40':
6968
case 'mysql_41':
70-
case 'firebird':
7169
case 'sqlite':
7270
case 'sqlite3':
7371
fwrite($fp, "# DO NOT EDIT THIS FILE, IT IS GENERATED\n");

phpBB/docs/INSTALL.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ <h1>Install</h1>
136136
<li>PostgreSQL 8.3+</li>
137137
<li>SQLite 2.8.2+</li>
138138
<li>SQLite 3.6.15+</li>
139-
<li>Firebird 2.1+</li>
140139
<li>MS SQL Server 2000 or above (directly or via ODBC or the native adapter)</li>
141140
<li>Oracle</li>
142141
</ul>

phpBB/docs/README.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ <h1>Readme</h1>
323323

324324
<p>Please remember that running any application on a development (unstable, e.g. a beta release) version of PHP can lead to strange/unexpected results which may appear to be bugs in the application. Therefore, we recommend you upgrade to the newest stable version of PHP before running phpBB3. If you are running a development version of PHP please check any bugs you find on a system running a stable release before submitting.</p>
325325

326-
<p>This board has been developed and tested under Linux and Windows (amongst others) running Apache using MySQL 3.23, 4.x, 5.x, MariaDB 5.x, MSSQL Server 2000, PostgreSQL 8.x, Oracle 8, SQLite 2 and Firebird. Versions of PHP used range from 5.3.x to 5.4.x without problem.</p>
326+
<p>This board has been developed and tested under Linux and Windows (amongst others) running Apache using MySQL 3.23, 4.x, 5.x, MariaDB 5.x, MSSQL Server 2000, PostgreSQL 8.x, Oracle 8, SQLite 2 and SQLite 3. Versions of PHP used range from 5.3.x to 5.4.x without problem.</p>
327327

328328
<a name="phpsec"></a><h3>7.i. Notice on PHP security issues</h3>
329329

phpBB/docs/coding-guidelines.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ <h4>Constants</h4>
736736
<a name="sql"></a><h3>2.iii. SQL/SQL Layout</h3>
737737

738738
<h4>Common SQL Guidelines: </h4>
739-
<p>All SQL should be cross-DB compatible, if DB specific SQL is used alternatives must be provided which work on all supported DB's (MySQL3/4/5, MSSQL (7.0 and 2000), PostgreSQL (8.3+), Firebird, SQLite, Oracle8, ODBC (generalised if possible)).</p>
739+
<p>All SQL should be cross-DB compatible, if DB specific SQL is used alternatives must be provided which work on all supported DB's (MySQL3/4/5, MSSQL (7.0 and 2000), PostgreSQL (8.3+), SQLite, Oracle8, ODBC (generalised if possible)).</p>
740740
<p>All SQL commands should utilise the DataBase Abstraction Layer (DBAL)</p>
741741

742742
<h4>SQL code layout:</h4>

phpBB/includes/acp/acp_database.php

Lines changed: 0 additions & 248 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,6 @@ function main($id, $mode)
119119
case 'mssqlnative':
120120
$extractor = new mssql_extractor($format, $filename, $time, $download, $store);
121121
break;
122-
123-
case 'firebird':
124-
$extractor = new firebird_extractor($format, $filename, $time, $download, $store);
125-
break;
126122
}
127123

128124
$extractor->write_start($table_prefix);
@@ -141,7 +137,6 @@ function main($id, $mode)
141137
{
142138
case 'sqlite':
143139
case 'sqlite3':
144-
case 'firebird':
145140
$extractor->flush('DELETE FROM ' . $table_name . ";\n");
146141
break;
147142

@@ -338,20 +333,6 @@ function main($id, $mode)
338333
}
339334
break;
340335

341-
case 'firebird':
342-
$delim = ";\n";
343-
while (($sql = $fgetd($fp, $delim, $read, $seek, $eof)) !== false)
344-
{
345-
$query = trim($sql);
346-
if (substr($query, 0, 8) === 'SET TERM')
347-
{
348-
$delim = $query[9] . "\n";
349-
continue;
350-
}
351-
$db->sql_query($query);
352-
}
353-
break;
354-
355336
case 'postgres':
356337
$delim = ";\n";
357338
while (($sql = $fgetd($fp, $delim, $read, $seek, $eof)) !== false)
@@ -2110,235 +2091,6 @@ function write_start($prefix)
21102091
}
21112092
}
21122093

2113-
class firebird_extractor extends base_extractor
2114-
{
2115-
function write_start($prefix)
2116-
{
2117-
$sql_data = "--\n";
2118-
$sql_data .= "-- phpBB Backup Script\n";
2119-
$sql_data .= "-- Dump of tables for $prefix\n";
2120-
$sql_data .= "-- DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n";
2121-
$sql_data .= "--\n";
2122-
$this->flush($sql_data);
2123-
}
2124-
2125-
function write_data($table_name)
2126-
{
2127-
global $db;
2128-
$ary_type = $ary_name = array();
2129-
2130-
// Grab all of the data from current table.
2131-
$sql = "SELECT *
2132-
FROM $table_name";
2133-
$result = $db->sql_query($sql);
2134-
2135-
$i_num_fields = ibase_num_fields($result);
2136-
2137-
for ($i = 0; $i < $i_num_fields; $i++)
2138-
{
2139-
$info = ibase_field_info($result, $i);
2140-
$ary_type[$i] = $info['type'];
2141-
$ary_name[$i] = $info['name'];
2142-
}
2143-
2144-
while ($row = $db->sql_fetchrow($result))
2145-
{
2146-
$schema_vals = $schema_fields = array();
2147-
2148-
// Build the SQL statement to recreate the data.
2149-
for ($i = 0; $i < $i_num_fields; $i++)
2150-
{
2151-
$str_val = $row[strtolower($ary_name[$i])];
2152-
2153-
if (preg_match('#char|text|bool|varbinary|blob#i', $ary_type[$i]))
2154-
{
2155-
$str_quote = '';
2156-
$str_empty = "''";
2157-
$str_val = sanitize_data_generic(str_replace("'", "''", $str_val));
2158-
}
2159-
else if (preg_match('#date|timestamp#i', $ary_type[$i]))
2160-
{
2161-
if (empty($str_val))
2162-
{
2163-
$str_quote = '';
2164-
}
2165-
else
2166-
{
2167-
$str_quote = "'";
2168-
}
2169-
}
2170-
else
2171-
{
2172-
$str_quote = '';
2173-
$str_empty = 'NULL';
2174-
}
2175-
2176-
if (empty($str_val) && $str_val !== '0')
2177-
{
2178-
$str_val = $str_empty;
2179-
}
2180-
2181-
$schema_vals[$i] = $str_quote . $str_val . $str_quote;
2182-
$schema_fields[$i] = '"' . $ary_name[$i] . '"';
2183-
}
2184-
2185-
// Take the ordered fields and their associated data and build it
2186-
// into a valid sql statement to recreate that field in the data.
2187-
$sql_data = "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\n";
2188-
2189-
$this->flush($sql_data);
2190-
}
2191-
$db->sql_freeresult($result);
2192-
}
2193-
2194-
function write_table($table_name)
2195-
{
2196-
global $db;
2197-
2198-
$sql_data = '-- Table: ' . $table_name . "\n";
2199-
$sql_data .= "DROP TABLE $table_name;\n";
2200-
2201-
$data_types = array(7 => 'SMALLINT', 8 => 'INTEGER', 10 => 'FLOAT', 12 => 'DATE', 13 => 'TIME', 14 => 'CHARACTER', 27 => 'DOUBLE PRECISION', 35 => 'TIMESTAMP', 37 => 'VARCHAR', 40 => 'CSTRING', 261 => 'BLOB', 701 => 'DECIMAL', 702 => 'NUMERIC');
2202-
2203-
$sql_data .= "\nCREATE TABLE $table_name (\n";
2204-
2205-
$sql = 'SELECT DISTINCT R.RDB$FIELD_NAME as FNAME, R.RDB$NULL_FLAG as NFLAG, R.RDB$DEFAULT_SOURCE as DSOURCE, F.RDB$FIELD_TYPE as FTYPE, F.RDB$FIELD_SUB_TYPE as STYPE, F.RDB$FIELD_LENGTH as FLEN
2206-
FROM RDB$RELATION_FIELDS R
2207-
JOIN RDB$FIELDS F ON R.RDB$FIELD_SOURCE=F.RDB$FIELD_NAME
2208-
LEFT JOIN RDB$FIELD_DIMENSIONS D ON R.RDB$FIELD_SOURCE = D.RDB$FIELD_NAME
2209-
WHERE F.RDB$SYSTEM_FLAG = 0
2210-
AND R.RDB$RELATION_NAME = \''. $table_name . '\'
2211-
ORDER BY R.RDB$FIELD_POSITION';
2212-
$result = $db->sql_query($sql);
2213-
2214-
$rows = array();
2215-
while ($row = $db->sql_fetchrow($result))
2216-
{
2217-
$line = "\t" . '"' . $row['fname'] . '" ' . $data_types[$row['ftype']];
2218-
2219-
if ($row['ftype'] == 261 && $row['stype'] == 1)
2220-
{
2221-
$line .= ' SUB_TYPE TEXT';
2222-
}
2223-
2224-
if ($row['ftype'] == 37 || $row['ftype'] == 14)
2225-
{
2226-
$line .= ' (' . $row['flen'] . ')';
2227-
}
2228-
2229-
if (!empty($row['dsource']))
2230-
{
2231-
$line .= ' ' . $row['dsource'];
2232-
}
2233-
2234-
if (!empty($row['nflag']))
2235-
{
2236-
$line .= ' NOT NULL';
2237-
}
2238-
$rows[] = $line;
2239-
}
2240-
$db->sql_freeresult($result);
2241-
2242-
$sql_data .= implode(",\n", $rows);
2243-
$sql_data .= "\n);\n";
2244-
$keys = array();
2245-
2246-
$sql = 'SELECT I.RDB$FIELD_NAME as NAME
2247-
FROM RDB$RELATION_CONSTRAINTS RC, RDB$INDEX_SEGMENTS I, RDB$INDICES IDX
2248-
WHERE (I.RDB$INDEX_NAME = RC.RDB$INDEX_NAME)
2249-
AND (IDX.RDB$INDEX_NAME = RC.RDB$INDEX_NAME)
2250-
AND (RC.RDB$RELATION_NAME = \''. $table_name . '\')
2251-
ORDER BY I.RDB$FIELD_POSITION';
2252-
$result = $db->sql_query($sql);
2253-
2254-
while ($row = $db->sql_fetchrow($result))
2255-
{
2256-
$keys[] = $row['name'];
2257-
}
2258-
2259-
if (sizeof($keys))
2260-
{
2261-
$sql_data .= "\nALTER TABLE $table_name ADD PRIMARY KEY (" . implode(', ', $keys) . ');';
2262-
}
2263-
2264-
$db->sql_freeresult($result);
2265-
2266-
$sql = 'SELECT I.RDB$INDEX_NAME as INAME, I.RDB$UNIQUE_FLAG as UFLAG, S.RDB$FIELD_NAME as FNAME
2267-
FROM RDB$INDICES I JOIN RDB$INDEX_SEGMENTS S ON S.RDB$INDEX_NAME=I.RDB$INDEX_NAME
2268-
WHERE (I.RDB$SYSTEM_FLAG IS NULL OR I.RDB$SYSTEM_FLAG=0)
2269-
AND I.RDB$FOREIGN_KEY IS NULL
2270-
AND I.RDB$RELATION_NAME = \''. $table_name . '\'
2271-
AND I.RDB$INDEX_NAME NOT STARTING WITH \'RDB$\'
2272-
ORDER BY S.RDB$FIELD_POSITION';
2273-
$result = $db->sql_query($sql);
2274-
2275-
$index = array();
2276-
while ($row = $db->sql_fetchrow($result))
2277-
{
2278-
$index[$row['iname']]['unique'] = !empty($row['uflag']);
2279-
$index[$row['iname']]['values'][] = $row['fname'];
2280-
}
2281-
2282-
foreach ($index as $index_name => $data)
2283-
{
2284-
$sql_data .= "\nCREATE ";
2285-
if ($data['unique'])
2286-
{
2287-
$sql_data .= 'UNIQUE ';
2288-
}
2289-
$sql_data .= "INDEX $index_name ON $table_name(" . implode(', ', $data['values']) . ");";
2290-
}
2291-
$sql_data .= "\n";
2292-
2293-
$db->sql_freeresult($result);
2294-
2295-
$sql = 'SELECT D1.RDB$DEPENDENT_NAME as DNAME, D1.RDB$FIELD_NAME as FNAME, D1.RDB$DEPENDENT_TYPE, R1.RDB$RELATION_NAME
2296-
FROM RDB$DEPENDENCIES D1
2297-
LEFT JOIN RDB$RELATIONS R1 ON ((D1.RDB$DEPENDENT_NAME = R1.RDB$RELATION_NAME) AND (NOT (R1.RDB$VIEW_BLR IS NULL)))
2298-
WHERE (D1.RDB$DEPENDED_ON_TYPE = 0)
2299-
AND (D1.RDB$DEPENDENT_TYPE <> 3)
2300-
AND (D1.RDB$DEPENDED_ON_NAME = \'' . $table_name . '\')
2301-
UNION SELECT DISTINCT F2.RDB$RELATION_NAME, D2.RDB$FIELD_NAME, D2.RDB$DEPENDENT_TYPE, R2.RDB$RELATION_NAME FROM RDB$DEPENDENCIES D2, RDB$RELATION_FIELDS F2
2302-
LEFT JOIN RDB$RELATIONS R2 ON ((F2.RDB$RELATION_NAME = R2.RDB$RELATION_NAME) AND (NOT (R2.RDB$VIEW_BLR IS NULL)))
2303-
WHERE (D2.RDB$DEPENDENT_TYPE = 3)
2304-
AND (D2.RDB$DEPENDENT_NAME = F2.RDB$FIELD_SOURCE)
2305-
AND (D2.RDB$DEPENDED_ON_NAME = \'' . $table_name . '\')
2306-
ORDER BY 1, 2';
2307-
$result = $db->sql_query($sql);
2308-
while ($row = $db->sql_fetchrow($result))
2309-
{
2310-
$sql = 'SELECT T1.RDB$DEPENDED_ON_NAME as GEN, T1.RDB$FIELD_NAME, T1.RDB$DEPENDED_ON_TYPE
2311-
FROM RDB$DEPENDENCIES T1
2312-
WHERE (T1.RDB$DEPENDENT_NAME = \'' . $row['dname'] . '\')
2313-
AND (T1.RDB$DEPENDENT_TYPE = 2 AND T1.RDB$DEPENDED_ON_TYPE = 14)
2314-
UNION ALL SELECT DISTINCT D.RDB$DEPENDED_ON_NAME, D.RDB$FIELD_NAME, D.RDB$DEPENDED_ON_TYPE
2315-
FROM RDB$DEPENDENCIES D, RDB$RELATION_FIELDS F
2316-
WHERE (D.RDB$DEPENDENT_TYPE = 3)
2317-
AND (D.RDB$DEPENDENT_NAME = F.RDB$FIELD_SOURCE)
2318-
AND (F.RDB$RELATION_NAME = \'' . $row['dname'] . '\')
2319-
ORDER BY 1,2';
2320-
$result2 = $db->sql_query($sql);
2321-
$row2 = $db->sql_fetchrow($result2);
2322-
$db->sql_freeresult($result2);
2323-
$gen_name = $row2['gen'];
2324-
2325-
$sql_data .= "\nDROP GENERATOR " . $gen_name . ";";
2326-
$sql_data .= "\nSET TERM ^ ;";
2327-
$sql_data .= "\nCREATE GENERATOR " . $gen_name . "^";
2328-
$sql_data .= "\nSET GENERATOR " . $gen_name . " TO 0^\n";
2329-
$sql_data .= "\nCREATE TRIGGER {$row['dname']} FOR $table_name";
2330-
$sql_data .= "\nBEFORE INSERT\nAS\nBEGIN";
2331-
$sql_data .= "\n NEW.{$row['fname']} = GEN_ID(" . $gen_name . ", 1);";
2332-
$sql_data .= "\nEND^\n";
2333-
$sql_data .= "\nSET TERM ; ^\n";
2334-
}
2335-
2336-
$this->flush($sql_data);
2337-
2338-
$db->sql_freeresult($result);
2339-
}
2340-
}
2341-
23422094
// get how much space we allow for a chunk of data, very similar to phpMyAdmin's way of doing things ;-) (hey, we only do this for MySQL anyway :P)
23432095
function get_usable_memory()
23442096
{

phpBB/includes/acp/acp_icons.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,6 @@ function main($id, $mode)
542542
{
543543
case 'sqlite':
544544
case 'sqlite3':
545-
case 'firebird':
546545
$db->sql_query('DELETE FROM ' . $table);
547546
break;
548547

phpBB/includes/acp/acp_main.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,6 @@ function main($id, $mode)
273273
{
274274
case 'sqlite':
275275
case 'sqlite3':
276-
case 'firebird':
277276
$db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE);
278277
break;
279278

@@ -379,7 +378,6 @@ function main($id, $mode)
379378
{
380379
case 'sqlite':
381380
case 'sqlite3':
382-
case 'firebird':
383381
$db->sql_query("DELETE FROM $table");
384382
break;
385383

phpBB/includes/acp/acp_profile.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,11 +1267,6 @@ function add_field_ident($field_ident, $sql_type)
12671267

12681268
break;
12691269

1270-
case 'firebird':
1271-
$sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . ' ADD "' . strtoupper($field_ident) . '" ' . $sql_type;
1272-
1273-
break;
1274-
12751270
case 'oracle':
12761271
$sql = 'ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " ADD $field_ident " . $sql_type;
12771272

phpBB/includes/acp/acp_reasons.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ function main($id, $mode)
252252
// Teh standard
253253
case 'postgres':
254254
case 'oracle':
255-
case 'firebird':
256255
case 'sqlite':
257256
case 'sqlite3':
258257
// Change the reports using this reason to 'other'

phpBB/includes/functions_admin.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2445,7 +2445,6 @@ function phpbb_cache_moderators($db, $cache, $auth)
24452445
{
24462446
case 'sqlite':
24472447
case 'sqlite3':
2448-
case 'firebird':
24492448
$db->sql_query('DELETE FROM ' . MODERATOR_CACHE_TABLE);
24502449
break;
24512450

@@ -2900,17 +2899,6 @@ function get_database_size()
29002899
}
29012900
break;
29022901

2903-
case 'firebird':
2904-
global $dbname;
2905-
2906-
// if it on the local machine, we can get lucky
2907-
if (file_exists($dbname))
2908-
{
2909-
$database_size = filesize($dbname);
2910-
}
2911-
2912-
break;
2913-
29142902
case 'sqlite':
29152903
case 'sqlite3':
29162904
global $dbhost;

0 commit comments

Comments
 (0)