Index: trunk/extensions/WikimediaMaintenance/fixUsabilityPrefs2.php |
— | — | @@ -1,8 +1,8 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -require( dirname( __FILE__ ) . '/../Maintenance.php' ); |
| 4 | +require_once( dirname( __FILE__ ) . '/WikimediaMaintenance.php' ); |
5 | 5 | |
6 | | -class FixUsabilityPrefs extends Maintenance { |
| 6 | +class FixUsabilityPrefs extends WikimediaMaintenance { |
7 | 7 | function __construct() { |
8 | 8 | parent::__construct(); |
9 | 9 | } |
Index: trunk/extensions/WikimediaMaintenance/jeluf.php |
— | — | @@ -24,9 +24,9 @@ |
25 | 25 | * @ingroup Maintenance |
26 | 26 | */ |
27 | 27 | |
28 | | -require_once( dirname(__FILE__) . '/Maintenance.php' ); |
| 28 | +require_once( dirname( __FILE__ ) . '/WikimediaMaintenance.php' ); |
29 | 29 | |
30 | | -class RunJobs extends Maintenance { |
| 30 | +class RunJobs extends WikimediaMaintenance { |
31 | 31 | public function __construct() { |
32 | 32 | parent::__construct(); |
33 | 33 | $this->mDescription = "Run pending jobs"; |
— | — | @@ -34,7 +34,7 @@ |
35 | 35 | $this->addOption( 'type', 'Type of job to run', false, true ); |
36 | 36 | $this->addOption( 'procs', 'Number of processes to use', false, true ); |
37 | 37 | } |
38 | | - |
| 38 | + |
39 | 39 | public function memoryLimit() { |
40 | 40 | // Don't eat all memory on the machine if we get a bad job. |
41 | 41 | return "150M"; |
— | — | @@ -67,10 +67,10 @@ |
68 | 68 | $job = ($type == false) ? |
69 | 69 | Job::pop($offset) |
70 | 70 | : Job::pop_type($type); |
71 | | - |
| 71 | + |
72 | 72 | if ($job == false) |
73 | 73 | break; |
74 | | - |
| 74 | + |
75 | 75 | wfWaitForSlaves( 5 ); |
76 | 76 | $t = microtime( true ); |
77 | 77 | $offset=$job->id; |
Index: trunk/extensions/WikimediaMaintenance/rebuildInterwiki.php |
— | — | @@ -23,7 +23,7 @@ |
24 | 24 | * @ingroup Maintenance |
25 | 25 | * @ingroup Wikimedia |
26 | 26 | */ |
27 | | -require_once( dirname( __FILE__ ) . '/WikimediaMaintenance.php' ); |
| 27 | +require_once( dirname( __FILE__ ) . '/dumpInterwiki.php' ); |
28 | 28 | |
29 | 29 | class RebuildInterwiki extends DumpInterwiki { |
30 | 30 | |
Index: trunk/extensions/WikimediaMaintenance/clearMessageBlobs.php |
— | — | @@ -4,9 +4,9 @@ |
5 | 5 | * Clear the msg_resource table on all wikis if any message file has been updated. |
6 | 6 | */ |
7 | 7 | |
8 | | -require_once( dirname( __FILE__ ) .'/../Maintenance.php' ); |
| 8 | +require_once( dirname( __FILE__ ) . '/WikimediaMaintenance.php' ); |
9 | 9 | |
10 | | -class ClearMessageBlobs extends Maintenance { |
| 10 | +class ClearMessageBlobs extends WikimediaMaintenance { |
11 | 11 | function __construct() { |
12 | 12 | parent::__construct(); |
13 | 13 | } |
Index: trunk/extensions/WikimediaMaintenance/listDatabases.php |
— | — | @@ -1,4 +1,5 @@ |
2 | | -<? include("commandLine.inc"); |
| 2 | +<?php |
| 3 | +include("commandLine.inc"); |
3 | 4 | |
4 | 5 | foreach ($wgLocalDatabases as $db) { |
5 | 6 | print "$db\n"; |
Index: trunk/extensions/WikimediaMaintenance/fixJobQueueExplosion.php |
— | — | @@ -4,9 +4,9 @@ |
5 | 5 | * Removes htmlCacheUpdate categorylinks jobs caused by the bug fixed in r59718. |
6 | 6 | */ |
7 | 7 | |
8 | | -require_once( dirname(__FILE__).'/Maintenance.php' ); |
| 8 | +require_once( dirname( __FILE__ ) . '/WikimediaMaintenance.php' ); |
9 | 9 | |
10 | | -class FixJobQueueExplosion extends Maintenance { |
| 10 | +class FixJobQueueExplosion extends WikimediaMaintenance { |
11 | 11 | public function execute() { |
12 | 12 | global $IP; |
13 | 13 | |
— | — | @@ -27,10 +27,10 @@ |
28 | 28 | $numBatchesDone = 0; |
29 | 29 | $newId = 1; |
30 | 30 | while ( true ) { |
31 | | - $res = $dbw->select( 'job_explosion_tmp', '*', |
32 | | - array( |
| 31 | + $res = $dbw->select( 'job_explosion_tmp', '*', |
| 32 | + array( |
33 | 33 | 'job_id > ' . $dbw->addQuotes( $start ), |
34 | | - "NOT ( job_cmd = 'htmlCacheUpdate' AND " . |
| 34 | + "NOT ( job_cmd = 'htmlCacheUpdate' AND " . |
35 | 35 | "job_params LIKE '%s:13:\"categorylinks\"%' )" |
36 | 36 | ), |
37 | 37 | __METHOD__, array( 'LIMIT' => $batchSize ) ); |
Index: trunk/extensions/WikimediaMaintenance/cleanupBug31576.php |
— | — | @@ -1,17 +1,13 @@ |
2 | 2 | <?php |
3 | | -$IP = getenv( 'MW_INSTALL_PATH' ); |
4 | | -if ( $IP === false ) { |
5 | | - $IP = dirname( __FILE__ ) . '/../..'; |
6 | | -} |
7 | | -require_once( "$IP/maintenance/Maintenance.php" ); |
| 3 | +require_once( dirname( __FILE__ ) . '/WikimediaMaintenance.php' ); |
8 | 4 | |
9 | | -class CleanupBug31576 extends Maintenance { |
| 5 | +class CleanupBug31576 extends WikimediaMaintenance { |
10 | 6 | public function __construct() { |
11 | 7 | parent::__construct(); |
12 | 8 | $this->mDescription = "Cleans up templatelinks corruption caused by https://bugzilla.wikimedia.org/show_bug.cgi?id=31576"; |
13 | 9 | $this->addOption( 'batchsize', 'Number of rows to process in one batch. Default: 50', false, true ); |
14 | 10 | } |
15 | | - |
| 11 | + |
16 | 12 | public function execute() { |
17 | 13 | $this->batchsize = $this->getOption( 'batchsize', 50 ); |
18 | 14 | $variableIDs = MagicWord::getVariableIDs(); |
— | — | @@ -23,7 +19,7 @@ |
24 | 20 | } |
25 | 21 | $this->output( "All done\n" ); |
26 | 22 | } |
27 | | - |
| 23 | + |
28 | 24 | public function processSynonym( $synonym ) { |
29 | 25 | $dbr = wfGetDB( DB_SLAVE ); |
30 | 26 | $pCount = 0; |
— | — | @@ -41,7 +37,7 @@ |
42 | 38 | // No more rows, we're done |
43 | 39 | break; |
44 | 40 | } |
45 | | - |
| 41 | + |
46 | 42 | $processed = array(); |
47 | 43 | foreach ( $res as $row ) { |
48 | 44 | $vCount++; |
— | — | @@ -57,7 +53,7 @@ |
58 | 54 | wfWaitForSlaves(); |
59 | 55 | } |
60 | 56 | } |
61 | | - |
| 57 | + |
62 | 58 | } |
63 | 59 | |
64 | 60 | $maintClass = "CleanupBug31576"; |
Index: trunk/extensions/WikimediaMaintenance/x-mctest.php |
— | — | @@ -21,9 +21,9 @@ |
22 | 22 | * @ingroup Maintenance |
23 | 23 | */ |
24 | 24 | |
25 | | -require_once( dirname(__FILE__) . '/Maintenance.php' ); |
| 25 | +require_once( dirname( __FILE__ ) . '/WikimediaMaintenance.php' ); |
26 | 26 | |
27 | | -class mcTest extends Maintenance { |
| 27 | +class mcTest extends WikimediaMaintenance { |
28 | 28 | public function __construct() { |
29 | 29 | parent::__construct(); |
30 | 30 | $this->mDescription = "Makes several 'set', 'incr' and 'get' requests on every" |
— | — | @@ -65,7 +65,7 @@ |
66 | 66 | } |
67 | 67 | } |
68 | 68 | $exectime = $this->microtime_float() - $time_start; |
69 | | - |
| 69 | + |
70 | 70 | $this->output( "set: $set incr: $incr get: $get time: $exectime\n" ); |
71 | 71 | } |
72 | 72 | } |
Index: trunk/extensions/WikimediaMaintenance/namespaceDupesWT.php |
— | — | @@ -23,9 +23,15 @@ |
24 | 24 | * @ingroup Maintenance |
25 | 25 | */ |
26 | 26 | |
27 | | -require_once( dirname(__FILE__) . '/Maintenance.php' ); |
| 27 | +require_once( dirname( __FILE__ ) . '/WikimediaMaintenance.php' ); |
28 | 28 | |
29 | | -class NamespaceConflictChecker extends Maintenance { |
| 29 | +class NamespaceConflictChecker extends WikimediaMaintenance { |
| 30 | + |
| 31 | + /** |
| 32 | + * @var DatabaseBase |
| 33 | + */ |
| 34 | + protected $db; |
| 35 | + |
30 | 36 | public function __construct() { |
31 | 37 | parent::__construct(); |
32 | 38 | $this->mDescription = ""; |
— | — | @@ -52,7 +58,7 @@ |
53 | 59 | } else { |
54 | 60 | $retval = $this->checkAll( $fix, $suffix ); |
55 | 61 | } |
56 | | - |
| 62 | + |
57 | 63 | if( $retval ) { |
58 | 64 | $this->output( "\nLooks good!\n" ); |
59 | 65 | } else { |
— | — | @@ -68,9 +74,9 @@ |
69 | 75 | private function checkAll( $fix, $suffix = '' ) { |
70 | 76 | global $wgContLang, $wgNamespaceAliases, $wgCanonicalNamespaceNames; |
71 | 77 | global $wgCapitalLinks; |
72 | | - |
| 78 | + |
73 | 79 | $spaces = array(); |
74 | | - |
| 80 | + |
75 | 81 | // List interwikis first, so they'll be overridden |
76 | 82 | // by any conflicting local namespaces. |
77 | 83 | foreach( $this->getInterwikiList() as $prefix ) { |
— | — | @@ -96,7 +102,7 @@ |
97 | 103 | foreach( $wgContLang->getNamespaceAliases() as $name => $ns ) { |
98 | 104 | $spaces[$name] = $ns; |
99 | 105 | } |
100 | | - |
| 106 | + |
101 | 107 | // We'll need to check for lowercase keys as well, |
102 | 108 | // since we're doing case-sensitive searches in the db. |
103 | 109 | foreach( $spaces as $name => $ns ) { |
— | — | @@ -119,10 +125,10 @@ |
120 | 126 | } |
121 | 127 | } |
122 | 128 | } |
123 | | - |
| 129 | + |
124 | 130 | ksort( $spaces ); |
125 | 131 | asort( $spaces ); |
126 | | - |
| 132 | + |
127 | 133 | $ok = true; |
128 | 134 | foreach( $spaces as $name => $ns ) { |
129 | 135 | $ok = $this->checkNamespace( $ns, $name, $fix, $suffix ) && $ok; |
— | — | @@ -169,7 +175,7 @@ |
170 | 176 | } |
171 | 177 | return $ok; |
172 | 178 | } |
173 | | - |
| 179 | + |
174 | 180 | /** |
175 | 181 | * @todo: do this for reals |
176 | 182 | */ |
— | — | @@ -196,7 +202,7 @@ |
197 | 203 | // An interwiki; try an alternate encoding with '-' for ':' |
198 | 204 | $titleSql = $this->db->buildConcat( array( "'$prefix-'", $titleSql ) ); |
199 | 205 | } |
200 | | - |
| 206 | + |
201 | 207 | $sql = "SELECT {$page}_id AS id, |
202 | 208 | {$page}_title AS oldtitle, |
203 | 209 | $encNamespace + {$page}_namespace AS namespace, |
— | — | @@ -212,7 +218,6 @@ |
213 | 219 | foreach( $result as $row ) { |
214 | 220 | $set[] = $row; |
215 | 221 | } |
216 | | - $this->db->freeResult( $result ); |
217 | 222 | |
218 | 223 | return $set; |
219 | 224 | } |
— | — | @@ -253,7 +258,7 @@ |
254 | 259 | /** |
255 | 260 | * Resolve any conflicts |
256 | 261 | * @param $row Row from the page table to fix |
257 | | - * @param $resolveable bool |
| 262 | + * @param $resolveable bool |
258 | 263 | * @param $suffix String Suffix to append to the fixed page |
259 | 264 | */ |
260 | 265 | private function resolveConflict( $row, $resolvable, $suffix ) { |
— | — | @@ -267,9 +272,10 @@ |
268 | 273 | $this->output( "... !!! invalid title\n" ); |
269 | 274 | return false; |
270 | 275 | } |
271 | | - if ( $id = $title->getArticleId() ) { |
| 276 | + $id = $title->getArticleId(); |
| 277 | + if ( $id ) { |
272 | 278 | $this->output( "... *** page exists with ID $id ***\n" ); |
273 | | - } else { |
| 279 | + } else { |
274 | 280 | break; |
275 | 281 | } |
276 | 282 | } |
Index: trunk/extensions/WikimediaMaintenance/fixUsabilityPrefs.php |
— | — | @@ -1,8 +1,8 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -require( dirname( __FILE__ ) . '/../Maintenance.php' ); |
| 4 | +require_once( dirname( __FILE__ ) . '/WikimediaMaintenance.php' ); |
5 | 5 | |
6 | | -class FixUsabilityPrefs extends Maintenance { |
| 6 | +class FixUsabilityPrefs extends WikimediaMaintenance { |
7 | 7 | function __construct() { |
8 | 8 | parent::__construct(); |
9 | 9 | } |
Index: trunk/extensions/WikimediaMaintenance/addWiki.php |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | */ |
30 | 30 | require_once( dirname( __FILE__ ) . '/WikimediaMaintenance.php' ); |
31 | 31 | |
32 | | -class AddWiki extends Maintenance { |
| 32 | +class AddWiki extends WikimediaMaintenance { |
33 | 33 | public function __construct() { |
34 | 34 | global $wgNoDBParam; |
35 | 35 | |
Index: trunk/extensions/WikimediaMaintenance/rL.php |
— | — | @@ -18,9 +18,9 @@ |
19 | 19 | * @ingroup Maintenance |
20 | 20 | */ |
21 | 21 | |
22 | | -require_once( dirname(__FILE__) . '/Maintenance.php' ); |
| 22 | +require_once( dirname( __FILE__ ) . '/WikimediaMaintenance.php' ); |
23 | 23 | |
24 | | -class RefreshLinks extends Maintenance { |
| 24 | +class RefreshLinks extends WikimediaMaintenance { |
25 | 25 | public function __construct() { |
26 | 26 | parent::__construct(); |
27 | 27 | $this->mDescription = "Refresh link tables"; |
Index: trunk/extensions/WikimediaMaintenance/unsuppressCrossWiki.php |
— | — | @@ -1,8 +1,8 @@ |
2 | 2 | <?php |
3 | | - |
4 | | -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); |
5 | 3 | |
6 | | -class unsuppressCrossWiki extends Maintenance { |
| 4 | +require_once( dirname( __FILE__ ) . '/WikimediaMaintenance.php' ); |
| 5 | + |
| 6 | +class unsuppressCrossWiki extends WikimediaMaintenance { |
7 | 7 | public function __construct() { |
8 | 8 | parent::__construct(); |
9 | 9 | $this->mDescription = "Show number of jobs waiting in master database"; |
— | — | @@ -24,14 +24,14 @@ |
25 | 25 | # Get local ID like $user->localUserData( $wiki ) does |
26 | 26 | $localUserId = $dbw->selectField( 'user', 'user_id', |
27 | 27 | array( 'user_name' => $userName ), __METHOD__ ); |
28 | | - |
| 28 | + |
29 | 29 | $delUserBit = Revision::DELETED_USER; |
30 | 30 | $hiddenCount = $dbw->selectField( 'revision', 'COUNT(*)', |
31 | 31 | array( 'rev_user' => $localUserId, "rev_deleted & $delUserBit != 0" ), __METHOD__ ); |
32 | 32 | echo "$hiddenCount edits have the username hidden on \"$wiki\"\n"; |
33 | 33 | # Unsuppress username on edits |
34 | 34 | if ( $hiddenCount > 0 ) { |
35 | | - echo "Unsuppressed edits of attached account (local id $localUserId) on \"$wiki\"..."; |
| 35 | + echo "Unsuppressed edits of attached account (local id $localUserId) on \"$wiki\"..."; |
36 | 36 | IPBlockForm::unsuppressUserName( $userName, $localUserId, $dbw ); |
37 | 37 | echo "done!\n\n"; |
38 | 38 | } |