From e7a10986ca1312fbd3d23aea92bbe523ac5e7ed1 Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Thu, 11 Jan 2007 16:05:29 +0000 Subject: [PATCH] Overhaul postgres update section - standardize version - start 1.10 section. --- maintenance/updaters.inc | 58 +++++++++++++++++++++++++++++++++------- 1 file changed, 48 insertions(+), 10 deletions(-) diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc index 1beffc585e..0468de7b7c 100644 --- a/maintenance/updaters.inc +++ b/maintenance/updaters.inc @@ -1007,21 +1007,31 @@ function do_postgres_updates() { ## Default to the oldest supported version $version = 1.7; + $thisver = array(); if ($wgDatabase->tableExists("mediawiki_version")) { $version = "1.8"; $sql = "SELECT mw_version FROM mediawiki_version ORDER BY cdate DESC LIMIT 1"; $tempversion = pg_fetch_result($wgDatabase->doQuery($sql),0,0); - $thisver = array(); if (preg_match('/(\d+\.\d+)/', $tempversion, $thisver)) { $version = $thisver[1]; } } - print " Detected version: $version "; + print " Detected version: $version\n"; + + ## Transform to a standard format + if (! preg_match('/(\d+)\.(\d+)/', $version, $thisver)) { + die ("Sorry, could not figure out what version \"$version\" means"); + } + $oldversion = $version; + $version = sprintf("%03d%03d",$thisver[1],$thisver[2]); + print " Standardized version: $version\n"; + $upgrade = ''; - if ($version <= 1.7) { - $upgrade = <<query("BEGIN;\n\n $upgrade\n\nCOMMIT;\n"); return; -- 2.20.1