Index: trunk/phase3/maintenance/updateSpecialPages.php |
— | — | @@ -65,18 +65,18 @@ |
66 | 66 | |
67 | 67 | foreach( $wgQueryPages as $page ) { |
68 | 68 | @list( $class, $special, $limit ) = $page; |
69 | | - |
| 69 | + |
70 | 70 | # --list : just show the name of pages |
71 | 71 | if( $this->hasOption('list') ) { |
72 | 72 | $this->output( "$special\n" ); |
73 | 73 | continue; |
74 | 74 | } |
75 | | - |
| 75 | + |
76 | 76 | if ( !$this->hasOption('override') && $wgDisableQueryPageUpdate && in_array( $special, $wgDisableQueryPageUpdate ) ) { |
77 | 77 | $this->output( sprintf( "%-30s disabled\n", $special ) ); |
78 | 78 | continue; |
79 | 79 | } |
80 | | - |
| 80 | + |
81 | 81 | $specialObj = SpecialPage::getPage( $special ); |
82 | 82 | if ( !$specialObj ) { |
83 | 83 | $this->output( "No such special page: $special\n" ); |
— | — | @@ -87,7 +87,7 @@ |
88 | 88 | require_once( $file ); |
89 | 89 | } |
90 | 90 | $queryPage = new $class; |
91 | | - |
| 91 | + |
92 | 92 | if( !$this->hasOption('only') || $this->getOption('only') == $queryPage->getName() ) { |
93 | 93 | $this->output( sprintf( '%-30s ', $special ) ); |
94 | 94 | if ( $queryPage->isExpensive() ) { |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | $this->output( "FAILED: database error\n" ); |
101 | 101 | } else { |
102 | 102 | $this->output( "got $num rows in " ); |
103 | | - |
| 103 | + |
104 | 104 | $elapsed = ($t2[0] - $t1[0]) + ($t2[1] - $t1[1]); |
105 | 105 | $hours = intval( $elapsed / 3600 ); |
106 | 106 | $minutes = intval( $elapsed % 3600 / 60 ); |
Index: trunk/phase3/maintenance/nextJobDB.php |
— | — | @@ -29,6 +29,7 @@ |
30 | 30 | $this->mDescription = "Pick a database that has pending jobs"; |
31 | 31 | $this->addOption( 'type', "The type of job to search for", false, true ); |
32 | 32 | } |
| 33 | + |
33 | 34 | public function execute() { |
34 | 35 | global $wgMemc; |
35 | 36 | $type = $this->getOption( 'type', false ); |
— | — | @@ -36,18 +37,18 @@ |
37 | 38 | ? "jobqueue:dbs" |
38 | 39 | : "jobqueue:dbs:$type"; |
39 | 40 | $pendingDBs = $wgMemc->get( $mckey ); |
40 | | - |
| 41 | + |
41 | 42 | # If we didn't get it from the cache |
42 | 43 | if( !$pendingDBs ) { |
43 | 44 | $pendingDBs = $this->getPendingDbs( $type ); |
44 | 45 | $wgMemc->get( $mckey, $pendingDBs, 300 ); |
45 | 46 | } |
46 | | - # If we've got a pending job in a db, display it. |
| 47 | + # If we've got a pending job in a db, display it. |
47 | 48 | if ( $pendingDBs ) { |
48 | 49 | $this->output( $pendingDBs[mt_rand(0, count( $pendingDBs ) - 1)] ); |
49 | 50 | } |
50 | 51 | } |
51 | | - |
| 52 | + |
52 | 53 | /** |
53 | 54 | * Get all databases that have a pending job |
54 | 55 | * @param $type String Job type |
— | — | @@ -62,12 +63,11 @@ |
63 | 64 | $lb = wfGetLB( $db ); |
64 | 65 | $dbsByMaster[$lb->getServerName(0)][] = $db; |
65 | 66 | } |
66 | | - |
| 67 | + |
67 | 68 | foreach ( $dbsByMaster as $master => $dbs ) { |
68 | 69 | $dbConn = wfGetDB( DB_MASTER, array(), $dbs[0] ); |
69 | | - $stype = $dbConn->addQuotes($type); |
70 | | - |
71 | | - |
| 70 | + $stype = $dbConn->addQuotes( $type ); |
| 71 | + |
72 | 72 | # Padding row for MySQL bug |
73 | 73 | $sql = "(SELECT '-------------------------------------------' as db)"; |
74 | 74 | foreach ( $dbs as $wikiId ) { |