From 086ae52d12011746a75f5588e877347bc0457352 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 21 Mar 2008 11:49:34 +0100 Subject: Update auf MediaWiki 1.12.0 --- maintenance/archives/patch-image_reditects.sql | 0 maintenance/archives/patch-protected_titles.sql | 12 ++++++++++++ maintenance/archives/populateSha1.php | 22 +++++++++++++++++----- 3 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 maintenance/archives/patch-image_reditects.sql create mode 100644 maintenance/archives/patch-protected_titles.sql (limited to 'maintenance/archives') diff --git a/maintenance/archives/patch-image_reditects.sql b/maintenance/archives/patch-image_reditects.sql new file mode 100644 index 00000000..e69de29b diff --git a/maintenance/archives/patch-protected_titles.sql b/maintenance/archives/patch-protected_titles.sql new file mode 100644 index 00000000..5307cbdd --- /dev/null +++ b/maintenance/archives/patch-protected_titles.sql @@ -0,0 +1,12 @@ +-- Protected titles - nonexistent pages that have been protected +CREATE TABLE /*$wgDBprefix*/protected_titles ( + pt_namespace int NOT NULL, + pt_title varchar(255) NOT NULL, + pt_user int unsigned NOT NULL, + pt_reason tinyblob, + pt_timestamp binary(14) NOT NULL, + pt_expiry varbinary(14) NOT NULL default '', + pt_create_perm varbinary(60) NOT NULL, + PRIMARY KEY (pt_namespace,pt_title), + KEY pt_timestamp (pt_timestamp) +) /*$wgDBTableOptions*/; diff --git a/maintenance/archives/populateSha1.php b/maintenance/archives/populateSha1.php index a34d36d3..45f29c43 100644 --- a/maintenance/archives/populateSha1.php +++ b/maintenance/archives/populateSha1.php @@ -4,7 +4,7 @@ $optionsWithArgs = array( 'method' ); require_once( dirname(__FILE__).'/../commandLine.inc' ); -$method = isset( $args['method'] ) ? $args['method'] : 'normal'; +$method = isset( $options['method'] ) ? $options['method'] : 'normal'; $t = -microtime( true ); $fname = 'populateSha1.php'; @@ -14,30 +14,42 @@ $imageTable = $dbw->tableName( 'image' ); $oldimageTable = $dbw->tableName( 'oldimage' ); $batch = array(); -$cmd = 'mysql -u ' . wfEscapeShellArg( $wgDBuser ) . ' -p' . wfEscapeShellArg( $wgDBpassword, $wgDBname ); +$cmd = 'mysql -u' . wfEscapeShellArg( $wgDBuser ) . + ' -h' . wfEscapeShellArg( $wgDBserver ) . + ' -p' . wfEscapeShellArg( $wgDBpassword, $wgDBname ); if ( $method == 'pipe' ) { + echo "Using pipe method\n"; $pipe = popen( $cmd, 'w' ); - fwrite( $pipe, "-- hello\n" ); } +$numRows = $res->numRows(); +$i = 0; foreach ( $res as $row ) { + if ( $i % 100 == 0 ) { + printf( "Done %d of %d, %5.3f%% \r", $i, $numRows, $i / $numRows * 100 ); + wfWaitForSlaves( 5 ); + } $file = wfLocalFile( $row->img_name ); + if ( !$file ) { + continue; + } $sha1 = File::sha1Base36( $file->getPath() ); if ( strval( $sha1 ) !== '' ) { $sql = "UPDATE $imageTable SET img_sha1=" . $dbw->addQuotes( $sha1 ) . " WHERE img_name=" . $dbw->addQuotes( $row->img_name ); if ( $method == 'pipe' ) { - fwrite( $pipe, $sql ); + fwrite( $pipe, "$sql;\n" ); } else { $dbw->query( $sql, $fname ); } } + $i++; } if ( $method == 'pipe' ) { fflush( $pipe ); pclose( $pipe ); } $t += microtime( true ); -print "Done in $t seconds\n"; +printf( "\nDone %d files in %.1f seconds\n", $numRows, $t ); ?> -- cgit v1.2.2