3 * Copyright (C) 2010 Roland Mas, Olaf Lenz
4 * Copyright (C) 2011 France Telecom
6 * This file is part of FusionForge.
8 * FusionForge is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * FusionForge is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 require_once("$IP/includes/db/DatabasePostgres.php");
24 class DatabaseForge extends DatabasePostgres {
25 function __construct($server=false, $user=false, $password=false, $dbName=false, $failFunction=false, $flags=0) {
27 $wgDBtype = "postgres";
28 return parent::__construct($server, $user, $password, $dbName, $failFunction, $flags);
31 function fieldInfo($table, $field) {
34 $table = 'plugin_mediawiki_interwiki';
37 return DatabasePostgres::fieldInfo($table, $field);
42 $save_wgDBmwschema = $wgDBmwschema;
43 $wgDBmwschema = 'public';
44 $v = DatabasePostgres::fieldInfo($table, $field);
45 $wgDBmwschema = $save_wgDBmwschema;
49 function open($server, $user, $password, $dbName) {
50 $v = DatabasePostgres::open($server, $user, $password, $dbName);
53 if ($this->schemaExists($wgDBmwschema)) {
54 if (method_exists ($this,"addIdentifierQuotes")) {
55 $safeschema = $this->addIdentifierQuotes($wgDBmwschema);
57 $safeschema = $wgDBmwschema;
59 $this->doQuery("SET search_path TO $safeschema,public");
65 function query($sql, $fname='', $tempIgnore=false) {
67 $chk = "ALTER TABLE interwiki ";
69 if (substr($sql, 0, $csz) == $chk) {
70 $sql = "ALTER TABLE public.plugin_mediawiki_interwiki " .
73 return DatabasePostgres::query($sql, $fname,$tempIgnore);
76 function tableName($name, $format='quoted') {
81 $v = 'plugin_mediawiki_interwiki';
84 return DatabasePostgres::tableName($name, $format);
87 if ($wgDBmwschema != 'public') {