r46908 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46907‎ | r46908 | r46909 >
Date:10:56, 6 February 2009
Author:ialex
Status:deferred
Tags:
Comment:
Added support for PostgreSQL when using database handler
Modified paths:
  • /trunk/extensions/Configure/CHANGELOG (modified) (history)
  • /trunk/extensions/Configure/Configure.handler-db.php (modified) (history)
  • /trunk/extensions/Configure/Configure.php (modified) (history)
  • /trunk/extensions/Configure/configure.pg.sql (added) (history)

Diff [purge]

Index: trunk/extensions/Configure/CHANGELOG
@@ -1,6 +1,10 @@
22 This file lists changes on this extension.
33 Localisation updates are done on betawiki and aren't listed here.
44
 5+0.12.0 - 6 February 2009
 6+ Added support for PostgreSQL when using database handler.
 7+
 8+
59 0.11.16 - 2 February 2009
610 * Added new section "Pages" on Special:Configure
711 * Changed order of some sections
Index: trunk/extensions/Configure/Configure.handler-db.php
@@ -140,11 +140,11 @@
141141 * @return array
142142 */
143143 public function getOldSettings( $ts ) {
144 - $db = $this->getSlaveDB();
145 - $ret = $db->select(
 144+ $dbr = $this->getSlaveDB();
 145+ $ret = $dbr->select(
146146 array( 'config_setting', 'config_version' ),
147147 array( 'cs_name', 'cv_wiki', 'cs_value' ),
148 - array( 'cv_timestamp' => $ts ),
 148+ array( 'cv_timestamp' => $dbr->timestamp( $ts ) ),
149149 __METHOD__,
150150 array(),
151151 array( 'config_version' => array( 'LEFT JOIN', 'cs_id = cv_id' ) )
@@ -164,7 +164,8 @@
165165 * @return array
166166 */
167167 public function getWikisInVersion( $ts ) {
168 - $wiki = $this->getSlaveDB()->selectField( 'config_version', 'cv_wiki', array( 'cv_timestamp' => $ts ), __METHOD__ );
 168+ $dbr = $this->getSlaveDB();
 169+ $wiki = $dbr->selectField( 'config_version', 'cv_wiki', array( 'cv_timestamp' => $dbr->timestamp( $ts ) ), __METHOD__ );
169170 if ( $wiki === false )
170171 return array();
171172 return array( $wiki );
@@ -217,10 +218,12 @@
218219 $this->saveSettingsForWiki( $settings, $wiki, $ts+1, $reason );
219220
220221 $dbw->begin();
 222+ $newId = $dbw->nextSequenceValue( 'config_version_cv_id_seq' );
221223 $dbw->insert( 'config_version',
222224 array(
 225+ 'cv_id' => $newId,
223226 'cv_wiki' => $wiki,
224 - 'cv_timestamp' => $dbw->timestamp($ts),
 227+ 'cv_timestamp' => $dbw->timestamp( $ts ),
225228 'cv_is_latest' => 1,
226229 'cv_user_text' => $wgUser->getName(),
227230 'cv_user_wiki' => wfWikiId(),
@@ -295,7 +298,7 @@
296299 */
297300 public function versionExists( $ts ) {
298301 $dbr = $this->getSlaveDB();
299 - return (bool)$dbr->selectField( 'config_version', '1', array( 'cv_timestamp' => $ts ), __METHOD__ );
 302+ return (bool)$dbr->selectField( 'config_version', '1', array( 'cv_timestamp' => $dbr->timestamp( $ts ) ), __METHOD__ );
300303 }
301304
302305 /**
Index: trunk/extensions/Configure/Configure.php
@@ -17,7 +17,7 @@
1818 'url' => 'http://www.mediawiki.org/wiki/Extension:Configure',
1919 'description' => 'Allow authorised users to configure the wiki via a web-based interface',
2020 'descriptionmsg' => 'configure-desc',
21 - 'version' => '0.11.16',
 21+ 'version' => '0.12.0',
2222 );
2323
2424 # Configuration part
Index: trunk/extensions/Configure/configure.pg.sql
@@ -0,0 +1,45 @@
 2+--
 3+-- Postgres' SQL schema for Configure extension
 4+--
 5+
 6+-- Information about each configuration version
 7+CREATE SEQUENCE config_version_cv_id_seq;
 8+CREATE TABLE config_version (
 9+
 10+ -- Primary key, used for joins with config_setting table
 11+ cv_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval( 'config_version_cv_id_seq' ),
 12+
 13+ -- wiki concerned by this version
 14+ cv_wiki TEXT NOT NULL,
 15+
 16+ -- TS_MV timestamp of the version
 17+ cv_timestamp TIMESTAMPTZ NOT NULL,
 18+
 19+ -- Whether this is the latest version for cv_wiki, will be used to get
 20+ -- all curent version when loading all the configuration at startup
 21+ cv_is_latest SMALLINT NOT NULL DEFAULT 0,
 22+
 23+ -- Who made the revision, name and wiki ID
 24+ cv_user_text TEXT NOT NULL,
 25+ cv_user_wiki TEXT NOT NULL,
 26+
 27+ -- Reason - not used yet but maybe in the future.
 28+ cv_reason TEXT NOT NULL
 29+);
 30+CREATE INDEX cv_timestamp ON config_version( cv_timestamp );
 31+CREATE INDEX cv_is_latest ON config_version( cv_is_latest );
 32+
 33+-- Configuration settings
 34+CREATE TABLE config_setting (
 35+
 36+ -- foreign key to config_version.cv_id, used for joins
 37+ cs_id INTEGER NOT NULL,
 38+
 39+ -- setting's name
 40+ cs_name TEXT NOT NULL,
 41+
 42+ -- setting's value, in php serialized format
 43+ cs_value TEXT
 44+);
 45+CREATE UNIQUE INDEX cs_id_name ON config_setting( cs_id, cs_name );
 46+CREATE INDEX cs_id ON config_setting( cs_id );
\ No newline at end of file
Property changes on: trunk/extensions/Configure/configure.pg.sql
___________________________________________________________________
Name: svn:eol-style
147 + native

Status & tagging log