* (bug 12283) Special:Newpages forgets parameters
* (bug 12031) All namespaces doesn't work in Special:Newpages
* (bug 585) Only create searchindex replica table for parser tests if db is MySQL
+* Allow --record option if parserTests.php to work when using Postgres
== Parser changes in 1.12 ==
* and all that fun stuff
*/
function start() {
+ global $wgDBtype;
parent::start();
$this->db->begin();
if( ! $this->db->tableExists( 'testrun' ) or ! $this->db->tableExists( 'testitem') ) {
print "WARNING> `testrun` table not found in database. Trying to create table.\n";
- dbsource( dirname(__FILE__) . '/testRunner.sql', $this->db );
+ if ($wgDBtype === 'postgres')
+ dbsource( dirname(__FILE__) . '/testRunner.postgres.sql', $this->db );
+ else
+ dbsource( dirname(__FILE__) . '/testRunner.sql', $this->db );
echo "OK, resuming.\n";
}
'tr_uname' => php_uname()
),
__METHOD__ );
- $this->curRun = $this->db->insertId();
+ if ($wgDBtype === 'postgres')
+ $this->curRun = $this->db->currentSequenceValue('testrun_id_seq');
+ else
+ $this->curRun = $this->db->insertId();
}
/**
--- /dev/null
+--
+-- Optional tables for parserTests recording mode
+-- With --record option, success data will be saved to these tables,
+-- and comparisons of what's changed from the previous run will be
+-- displayed at the end of each run.
+--
+-- This file is for the Postgres version of the tables
+--
+
+-- Note: "if exists" will not work on older versions of Postgres
+DROP TABLE IF EXISTS testitem;
+DROP TABLE IF EXISTS testrun;
+DROP SEQUENCE IF EXISTS testrun_id_seq;
+
+CREATE SEQUENCE testrun_id_seq;
+CREATE TABLE testrun (
+ tr_id INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('testrun_id_seq'),
+ tr_date TIMESTAMPTZ,
+ tr_mw_version TEXT,
+ tr_php_version TEXT,
+ tr_db_version TEXT,
+ tr_uname TEXT
+);
+
+CREATE TABLE testitem (
+ ti_run INTEGER NOT NULL REFERENCES testrun(tr_id) ON DELETE CASCADE,
+ ti_name TEXT NOT NULL,
+ ti_success SMALLINT NOT NULL
+);
+CREATE UNIQUE INDEX testitem_uniq ON testitem(ti_run, ti_name);