From 71bbd5519e2cb5c23baa0181fc07df825a14cb52 Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Tue, 3 Oct 2006 02:22:57 +0000 Subject: [PATCH] Automatic upgrade for earlier Postgres versions --- config/index.php | 14 ++--- maintenance/updaters.inc | 117 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 122 insertions(+), 9 deletions(-) diff --git a/config/index.php b/config/index.php index 90e36c2aa6..b13e9c3fd8 100644 --- a/config/index.php +++ b/config/index.php @@ -789,14 +789,12 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) { dbsource( "../maintenance/users.sql", $wgDatabase ); } } - if ( $conf->DBtype == 'mysql') { - print "
\n";
-				chdir( ".." );
-				flush();
-				do_all_updates();
-				chdir( "config" );
-				print "
\n"; - } + print "
\n";
+			chdir( ".." );
+			flush();
+			do_all_updates();
+			chdir( "config" );
+			print "
\n"; print "
  • Finished update checks.
  • \n"; } else { # FIXME: Check for errors diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc index 9acf302b6f..d85f1ebed6 100644 --- a/maintenance/updaters.inc +++ b/maintenance/updaters.inc @@ -780,10 +780,15 @@ function do_rc_indices_update() { } function do_all_updates( $doShared = false ) { - global $wgNewTables, $wgNewFields, $wgRenamedTables, $wgSharedDB, $wgDatabase; + global $wgNewTables, $wgNewFields, $wgRenamedTables, $wgSharedDB, $wgDatabase, $wgDBtype; $doUser = !$wgSharedDB || $doShared; + if ($wgDBtype === 'postgres') { + do_postgres_updates(); + return; + } + # Rename tables foreach ( $wgRenamedTables as $tableRecord ) { rename_table( $tableRecord[0], $tableRecord[1], $tableRecord[2] ); @@ -852,4 +857,114 @@ function archive($name) { return "$IP/maintenance/archives/$name"; } } + +function do_postgres_updates() { + global $wgDatabase, $wgVersion; + + $version = "1.7.1"; + + if ($wgDatabase->tableExists("mediawiki_version")) { + $version = "1.8"; + } + + if ($version == '1.7.1') { + $upgrade = <<query($upgrade); + + } ## end version 1.7.1 upgrade + + else { + print "No updates needed"; + } + + return; +} + ?> -- 2.20.1