r81506 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81505‎ | r81506 | r81507 >
Date:04:14, 4 February 2011
Author:tstarling
Status:ok
Tags:
Comment:
* Added a script which runs all the schema changes on the slave servers
* Added patch-ul_value.sql to the combined patch file
Modified paths:
  • /branches/wmf/1.16wmf4/maintenance/schema-changes-1.17wmf1-initial.sql (modified) (history)
  • /branches/wmf/1.16wmf4/maintenance/upgrade-1.17wmf1-initial.php (added) (history)

Diff [purge]

Index: branches/wmf/1.16wmf4/maintenance/upgrade-1.17wmf1-initial.php
@@ -0,0 +1,87 @@
 2+<?php
 3+
 4+require( dirname( __FILE__ ) . '/commandLine.inc' );
 5+
 6+doAllSchemaChanges();
 7+
 8+function doAllSchemaChanges() {
 9+ global $wgLBFactoryConf, $wgConf;
 10+
 11+ $sectionLoads = $wgLBFactoryConf['sectionLoads'];
 12+ $sectionsByDB = $wgLBFactoryConf['sectionsByDB'];
 13+ $rootPass = trim( wfShellExec( '/home/wikipedia/bin/mysql_root_pass' ) );
 14+
 15+ // Compile wiki lists
 16+ $wikisBySection = array();
 17+ foreach ( $wgConf->getLocalDatabases() as $wiki ) {
 18+ if ( isset( $sectionsByDB[$wiki] ) ) {
 19+ $wikisBySection[$sectionsByDB[$wiki]][] = $wiki;
 20+ } else {
 21+ $wikisBySection['DEFAULT'][] = $wiki;
 22+ }
 23+ }
 24+
 25+ // Do the upgrades
 26+ foreach ( $sectionLoads as $section => $loads ) {
 27+ $master = true;
 28+ foreach ( $loads as $server => $load ) {
 29+ if ( $master ) {
 30+ echo "Skipping $section master $server\n";
 31+ $master = false;
 32+ continue;
 33+ }
 34+
 35+ $db = new DatabaseMysql(
 36+ $server,
 37+ 'root',
 38+ $rootPass,
 39+ false, /* dbName */
 40+ 0, /* flags, no transactions */
 41+ '' /* prefix */
 42+ );
 43+
 44+ foreach ( $wikisBySection[$section] as $wiki ) {
 45+ $db->selectDB( $wiki );
 46+ upgradeWiki( $db );
 47+ }
 48+ }
 49+ }
 50+
 51+ echo "All done (except masters).\n";
 52+}
 53+
 54+function upgradeWiki( $db ) {
 55+ $wiki = $db->getDBname();
 56+ $server = $db->getServer();
 57+
 58+ $upgradeLogRow = $db->selectRow( 'updatelog',
 59+ 'ul_key',
 60+ array( 'ul_key' => '1.17wmf1-initial' ),
 61+ __FUNCTION__ );
 62+ if ( $upgradeLogRow ) {
 63+ echo $db->getDBname() . ": already done\n";
 64+ return;
 65+ }
 66+
 67+ echo "$server $wiki 1.17wmf1-initial";
 68+
 69+ $db->sourceFile( dirname( __FILE__ ) .'/schema-changes-1.17wmf1-initial.sql' );
 70+
 71+ if ( $wiki === 'commonswiki' ) {
 72+ echo " GlobalUsage";
 73+ $db->sourceFile( "$IP/extensions/GlobalUsage/patches/" .
 74+ 'patch-globalimagelinks_wiki_nsid_title.sql' );
 75+ }
 76+
 77+ if ( $wiki === 'mediawikiwiki' ) {
 78+ echo " CodeReview";
 79+ $db->sourceFile( "$IP/extensions/CodeReview/archives/code_signoffs.sql" );
 80+ }
 81+
 82+ $db->insert( 'updatelog',
 83+ array( 'ul_key' => '1.17wmf1-initial' ),
 84+ __FUNCTION__ );
 85+ echo " ok\n";
 86+}
 87+
 88+
Property changes on: branches/wmf/1.16wmf4/maintenance/upgrade-1.17wmf1-initial.php
___________________________________________________________________
Added: svn:eol-style
189 + native
Index: branches/wmf/1.16wmf4/maintenance/schema-changes-1.17wmf1-initial.sql
@@ -65,3 +65,7 @@
6666 ALTER TABLE /*_*/abuse_filter_log MODIFY afl_deleted tinyint(1) NOT NULL DEFAULT 0;
6767 ALTER TABLE /*_*/abuse_filter_log MODIFY afl_patrolled_by int unsigned NOT NULL DEFAULT 0;
6868
 69+-- patch-ul_value.sql
 70+ALTER TABLE /*_*/updatelog
 71+ add ul_value blob;
 72+

Status & tagging log