Index: trunk/extensions/Renameuser/renameUserCleanup.php |
— | — | @@ -30,13 +30,12 @@ |
31 | 31 | require( "$IP/maintenance/Maintenance.php" ); |
32 | 32 | |
33 | 33 | class RenameUserCleanup extends Maintenance { |
34 | | - const BATCH_SIZE = 1000; |
35 | | - |
36 | 34 | public function __construct() { |
37 | 35 | parent::__construct(); |
38 | 36 | $this->mDescription = "Maintenance script to finish incomplete rename user, in particular to reassign edits that were missed"; |
39 | 37 | $this->addOption( 'olduser', 'Old user name', true, true ); |
40 | 38 | $this->addOption( 'newuser', 'New user name', true, true ); |
| 39 | + $this->mBatchSize = 1000; |
41 | 40 | } |
42 | 41 | |
43 | 42 | public function execute() { |
— | — | @@ -145,7 +144,7 @@ |
146 | 145 | } |
147 | 146 | |
148 | 147 | while ($contribs > 0) { |
149 | | - print("doing batch of up to approximately ".self::BATCH_SIZE."\n"); |
| 148 | + print("doing batch of up to approximately ".$this->mBatchSize."\n"); |
150 | 149 | print("do this batch? [N/y] "); |
151 | 150 | $stdin = fopen ("php://stdin","rt"); |
152 | 151 | $line = fgets($stdin); |
— | — | @@ -156,7 +155,7 @@ |
157 | 156 | } |
158 | 157 | $dbw->begin(); |
159 | 158 | $result = $dbw->select( $table, $timestampfield, $selectConds , __METHOD__, |
160 | | - array( 'ORDER BY' => $timestampfield.' DESC', 'LIMIT' => self::BATCH_SIZE ) ); |
| 159 | + array( 'ORDER BY' => $timestampfield.' DESC', 'LIMIT' => $this->mBatchSize ) ); |
161 | 160 | if (! $result) { |
162 | 161 | print("There were rows for updating but now they are gone. Skipping.\n"); |
163 | 162 | $dbw->rollback(); |