[ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Summary view] [Print] [Text view]
1 <?php 2 3 $IP = getenv( 'MW_INSTALL_PATH' ); 4 if ( $IP === false ) { 5 $IP = __DIR__ . '/../..'; 6 } 7 8 require_once( "$IP/maintenance/Maintenance.php" ); 9 10 /** 11 * @ingroup Maintenance 12 */ 13 class CleanupArchiveUserText extends Maintenance { 14 public function __construct() { 15 parent::__construct(); 16 $this->mDescription = "Update the archive table where users were previously renamed, but their archive contributions were not"; 17 } 18 19 public function execute() { 20 $dbw = wfGetDB( DB_MASTER ); 21 do { 22 $res = $dbw->select( 23 array( 'archive', 'user' ), 24 array( 'DISTINCT ar_user_text', 'user_name', 'ar_user' ), 25 array( 26 'ar_user_text <> user_name', 27 'ar_user = user_id', 28 ), 29 __METHOD__, 30 array( 'LIMIT' => 50 ) 31 ); 32 $results = 0; 33 foreach( $res as $row ) { 34 $results++; 35 $this->output( "User:{$row->ar_user_text} => User:{$row->user_name} " ); 36 $dbw->update( 37 'archive', 38 array( 'ar_user_text' => $row->user_name ), 39 array( 40 'ar_user_text' => $row->ar_user_text, 41 'ar_user' => $row->ar_user, 42 ), 43 __METHOD__, 44 array( 'LIMIT' => 50 ) 45 ); 46 $affected = $dbw->affectedRows(); 47 $this->output( "$affected rows\n" ); 48 wfWaitForSlaves(); 49 } 50 } while ( $results === 50 ); 51 } 52 53 public function getDbType() { 54 return Maintenance::DB_ADMIN; 55 } 56 } 57 58 $maintClass = "CleanupArchiveUserText"; 59 require_once( RUN_MAINTENANCE_IF_MAIN );
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |