From: Tim Starling Date: Sat, 13 Sep 2003 06:21:46 +0000 (+0000) Subject: removing unreliable version check before ALTER TABLE X-Git-Tag: 1.1.0~275 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=045bc0b2bdcaee6b20837429983da16e81a65e88;p=lhc%2Fweb%2Fwiklou.git removing unreliable version check before ALTER TABLE --- diff --git a/update.php b/update.php index 4683e72d8f..a9da4c7c21 100644 --- a/update.php +++ b/update.php @@ -31,6 +31,27 @@ $wgAlterSpecs = array(); do_revision_updates(); +alter_ipblocks(); + +# +# Run ALTER TABLE queries. +# +if ( count( $wgAlterSpecs ) ) { + $rconn = mysql_connect( $wgDBserver, $wgDBadminuser, $wgDBadminpassword ); + mysql_select_db( $wgDBname ); + print "\n"; + foreach ( $wgAlterSpecs as $table => $specs ) { + $sql = "ALTER TABLE $table $specs"; + print "$sql;\n"; + $res = mysql_query( $sql, $rconn ); + if ( $res === false ) { + print "MySQL error: " . mysql_error( $rconn ) . "\n"; + } + } + mysql_close( $rconn ); +} + + # # Copy files into installation directories # @@ -104,28 +125,8 @@ function readconsole() { } function do_revision_updates() { - global $wgSoftwareRevision, $wgAlterSpecs, $wgDBserver, $wgDBadminuser; - global $wgDBadminpassword, $wgDBname; - + global $wgSoftwareRevision; if ( $wgSoftwareRevision < 1001 ) { update_passwords(); } - if ( $wgSoftwareRevision < 1002 ) { alter_ipblocks(); } - - # Run ALTER TABLE queries. - - if ( count( $wgAlterSpecs ) ) { - $rconn = mysql_connect( $wgDBserver, $wgDBadminuser, $wgDBadminpassword ); - mysql_select_db( $wgDBname ); - print "\n"; - foreach ( $wgAlterSpecs as $table => $specs ) { - $sql = "ALTER TABLE $table $specs"; - print "$sql;\n"; - $res = mysql_query( $sql, $rconn ); - if ( $res === false ) { - print "MySQL error: " . mysql_error( $rconn ) . "\n"; - } - } - mysql_close( $rconn ); - } } function update_passwords() { @@ -155,7 +156,6 @@ function update_passwords() { function alter_ipblocks() { global $wgAlterSpecs; - $fname = "Update script: alter_ipblocks"; if ( field_exists( "ipblocks", "ipb_id" ) ) { return;