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,
26 $dbName=false, $failFunction=false, $flags=0) {
29 $wgDBtype = "postgres";
30 return parent::__construct($server, $user,
31 $password, $dbName, $failFunction, $flags);
34 function fieldInfo($table, $field) {
37 $table = 'plugin_mediawiki_interwiki';
40 return DatabasePostgres::fieldInfo($table, $field);
45 $save_wgDBmwschema = $wgDBmwschema;
46 $wgDBmwschema = 'public';
47 $v = DatabasePostgres::fieldInfo($table, $field);
48 $wgDBmwschema = $save_wgDBmwschema;
52 function open($server, $user, $password, $dbName) {
53 $v = DatabasePostgres::open($server, $user, $password, $dbName);
56 if ($this->schemaExists($wgDBmwschema)) {
57 if (method_exists ($this,"addIdentifierQuotes")) {
58 $safeschema = $this->addIdentifierQuotes($wgDBmwschema);
60 $safeschema = $wgDBmwschema;
62 $this->doQuery("SET search_path TO $safeschema,public");
68 function query($sql, $fname='', $tempIgnore=false) {
70 $chk = "ALTER TABLE interwiki ";
72 if (substr($sql, 0, $csz) == $chk) {
73 $sql = "ALTER TABLE public.plugin_mediawiki_interwiki " .
76 return DatabasePostgres::query($sql, $fname,$tempIgnore);
79 function tableName($name, $format='quoted') {
84 $v = 'plugin_mediawiki_interwiki';
87 return DatabasePostgres::tableName($name, $format);
90 if ($wgDBmwschema != 'public') {
99 // c-file-style: "bsd"