Index: trunk/phase3/includes/SiteStats.php |
— | — | @@ -377,7 +377,7 @@ |
378 | 378 | $this->mPages = $this->db->selectField( 'page', 'COUNT(*)', '', __METHOD__ ); |
379 | 379 | return $this->mPages; |
380 | 380 | } |
381 | | - |
| 381 | + |
382 | 382 | /** |
383 | 383 | * Count total users |
384 | 384 | * @return Integer |
— | — | @@ -386,7 +386,7 @@ |
387 | 387 | $this->mUsers = $this->db->selectField( 'user', 'COUNT(*)', '', __METHOD__ ); |
388 | 388 | return $this->mUsers; |
389 | 389 | } |
390 | | - |
| 390 | + |
391 | 391 | /** |
392 | 392 | * Count views |
393 | 393 | * @return Integer |
Index: trunk/phase3/includes/api/ApiUserrights.php |
— | — | @@ -53,9 +53,10 @@ |
54 | 54 | $user, (array)$params['add'], |
55 | 55 | (array)$params['remove'], $params['reason'] ); |
56 | 56 | |
57 | | - $this->getResult()->setIndexedTagName( $r['added'], 'group' ); |
58 | | - $this->getResult()->setIndexedTagName( $r['removed'], 'group' ); |
59 | | - $this->getResult()->addValue( null, $this->getModuleName(), $r ); |
| 57 | + $result = $this->getResult(); |
| 58 | + $result->setIndexedTagName( $r['added'], 'group' ); |
| 59 | + $result->setIndexedTagName( $r['removed'], 'group' ); |
| 60 | + $result->addValue( null, $this->getModuleName(), $r ); |
60 | 61 | } |
61 | 62 | |
62 | 63 | /** |
Index: trunk/phase3/includes/api/ApiResult.php |
— | — | @@ -346,7 +346,6 @@ |
347 | 347 | global $wgContLang; |
348 | 348 | $s = $wgContLang->normalize( $s ); |
349 | 349 | } |
350 | | - |
351 | 350 | |
352 | 351 | /** |
353 | 352 | * Converts a Status object to an array suitable for addValue |
— | — | @@ -358,7 +357,7 @@ |
359 | 358 | if ( $status->isGood() ) { |
360 | 359 | return array(); |
361 | 360 | } |
362 | | - |
| 361 | + |
363 | 362 | $result = array(); |
364 | 363 | foreach ( $status->getErrorsByType( $errorType ) as $error ) { |
365 | 364 | $this->setIndexedTagName( $error['params'], 'param' ); |
Index: trunk/phase3/includes/api/ApiQueryLogEvents.php |
— | — | @@ -172,6 +172,7 @@ |
173 | 173 | |
174 | 174 | $count = 0; |
175 | 175 | $res = $this->select( __METHOD__ ); |
| 176 | + $result = $this->getResult(); |
176 | 177 | foreach ( $res as $row ) { |
177 | 178 | if ( ++ $count > $limit ) { |
178 | 179 | // We've reached the one extra which shows that there are additional pages to be had. Stop here... |
— | — | @@ -183,13 +184,13 @@ |
184 | 185 | if ( !$vals ) { |
185 | 186 | continue; |
186 | 187 | } |
187 | | - $fit = $this->getResult()->addValue( array( 'query', $this->getModuleName() ), null, $vals ); |
| 188 | + $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $vals ); |
188 | 189 | if ( !$fit ) { |
189 | 190 | $this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->log_timestamp ) ); |
190 | 191 | break; |
191 | 192 | } |
192 | 193 | } |
193 | | - $this->getResult()->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'item' ); |
| 194 | + $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'item' ); |
194 | 195 | } |
195 | 196 | |
196 | 197 | /** |
Index: trunk/phase3/includes/api/ApiQuery.php |
— | — | @@ -601,8 +601,6 @@ |
602 | 602 | * @return string |
603 | 603 | */ |
604 | 604 | public function makeHelpMsg() { |
605 | | - $msg = ''; |
606 | | - |
607 | 605 | // Make sure the internal object is empty |
608 | 606 | // (just in case a sub-module decides to optimize during instantiation) |
609 | 607 | $this->mPageSet = null; |
— | — | @@ -610,7 +608,7 @@ |
611 | 609 | |
612 | 610 | $querySeparator = str_repeat( '--- ', 12 ); |
613 | 611 | $moduleSeparator = str_repeat( '*** ', 14 ); |
614 | | - $msg .= "\n$querySeparator Query: Prop $querySeparator\n\n"; |
| 612 | + $msg = "\n$querySeparator Query: Prop $querySeparator\n\n"; |
615 | 613 | $msg .= $this->makeHelpMsgHelper( $this->mQueryPropModules, 'prop' ); |
616 | 614 | $msg .= "\n$querySeparator Query: List $querySeparator\n\n"; |
617 | 615 | $msg .= $this->makeHelpMsgHelper( $this->mQueryListModules, 'list' ); |
Index: trunk/phase3/includes/api/ApiBase.php |
— | — | @@ -181,7 +181,8 @@ |
182 | 182 | * @param $warning string Warning message |
183 | 183 | */ |
184 | 184 | public function setWarning( $warning ) { |
185 | | - $data = $this->getResult()->getData(); |
| 185 | + $result = $this->getResult(); |
| 186 | + $data = $result->getData(); |
186 | 187 | if ( isset( $data['warnings'][$this->getModuleName()] ) ) { |
187 | 188 | // Don't add duplicate warnings |
188 | 189 | $warn_regex = preg_quote( $warning, '/' ); |
— | — | @@ -191,13 +192,13 @@ |
192 | 193 | $oldwarning = $data['warnings'][$this->getModuleName()]['*']; |
193 | 194 | // If there is a warning already, append it to the existing one |
194 | 195 | $warning = "$oldwarning\n$warning"; |
195 | | - $this->getResult()->unsetValue( 'warnings', $this->getModuleName() ); |
| 196 | + $result->unsetValue( 'warnings', $this->getModuleName() ); |
196 | 197 | } |
197 | 198 | $msg = array(); |
198 | 199 | ApiResult::setContent( $msg, $warning ); |
199 | | - $this->getResult()->disableSizeCheck(); |
200 | | - $this->getResult()->addValue( 'warnings', $this->getModuleName(), $msg ); |
201 | | - $this->getResult()->enableSizeCheck(); |
| 200 | + $result->disableSizeCheck(); |
| 201 | + $result->addValue( 'warnings', $this->getModuleName(), $msg ); |
| 202 | + $result->enableSizeCheck(); |
202 | 203 | } |
203 | 204 | |
204 | 205 | /** |
Index: trunk/phase3/includes/api/ApiUpload.php |
— | — | @@ -146,11 +146,11 @@ |
147 | 147 | } |
148 | 148 | return $sessionKey; |
149 | 149 | } |
150 | | - |
| 150 | + |
151 | 151 | /** |
152 | | - * Throw an error that the user can recover from by providing a better |
| 152 | + * Throw an error that the user can recover from by providing a better |
153 | 153 | * value for $parameter |
154 | | - * |
| 154 | + * |
155 | 155 | * @param $error array Error array suitable for passing to dieUsageMsg() |
156 | 156 | * @param $parameter string Parameter that needs revising |
157 | 157 | * @param $data array Optional extra data to pass to the user |
— | — | @@ -163,7 +163,7 @@ |
164 | 164 | $data['stashfailed'] = $e->getMessage(); |
165 | 165 | } |
166 | 166 | $data['invalidparameter'] = $parameter; |
167 | | - |
| 167 | + |
168 | 168 | $parsed = $this->parseMsg( $error ); |
169 | 169 | $this->dieUsage( $parsed['info'], $parsed['code'], 0, $data ); |
170 | 170 | } |
— | — | @@ -184,7 +184,7 @@ |
185 | 185 | |
186 | 186 | if ( $this->mParams['statuskey'] ) { |
187 | 187 | $this->checkAsyncDownloadEnabled(); |
188 | | - |
| 188 | + |
189 | 189 | // Status request for an async upload |
190 | 190 | $sessionData = UploadFromUrlJob::getSessionData( $this->mParams['statuskey'] ); |
191 | 191 | if ( !isset( $sessionData['result'] ) ) { |
— | — | @@ -231,7 +231,7 @@ |
232 | 232 | $async = false; |
233 | 233 | if ( $this->mParams['asyncdownload'] ) { |
234 | 234 | $this->checkAsyncDownloadEnabled(); |
235 | | - |
| 235 | + |
236 | 236 | if ( $this->mParams['leavemessage'] && !$this->mParams['ignorewarnings'] ) { |
237 | 237 | $this->dieUsage( 'Using leavemessage without ignorewarnings is not supported', |
238 | 238 | 'missing-ignorewarnings' ); |
— | — | @@ -286,7 +286,7 @@ |
287 | 287 | // Recoverable errors |
288 | 288 | case UploadBase::MIN_LENGTH_PARTNAME: |
289 | 289 | $this->dieRecoverableError( 'filename-tooshort', 'filename' ); |
290 | | - break; |
| 290 | + break; |
291 | 291 | case UploadBase::ILLEGAL_FILENAME: |
292 | 292 | $this->dieRecoverableError( 'illegal-filename', 'filename', |
293 | 293 | array( 'filename' => $verification['filtered'] ) ); |
— | — | @@ -297,7 +297,7 @@ |
298 | 298 | case UploadBase::WINDOWS_NONASCII_FILENAME: |
299 | 299 | $this->dieRecoverableError( 'windows-nonascii-filename', 'filename' ); |
300 | 300 | break; |
301 | | - |
| 301 | + |
302 | 302 | // Unrecoverable errors |
303 | 303 | case UploadBase::EMPTY_FILE: |
304 | 304 | $this->dieUsage( 'The file you submitted was empty', 'empty-file' ); |
— | — | @@ -345,18 +345,19 @@ |
346 | 346 | } |
347 | 347 | return $this->transformWarnings( $warnings ); |
348 | 348 | } |
349 | | - |
| 349 | + |
350 | 350 | protected function transformWarnings( $warnings ) { |
351 | 351 | if ( $warnings ) { |
352 | 352 | // Add indices |
353 | | - $this->getResult()->setIndexedTagName( $warnings, 'warning' ); |
| 353 | + $result = $this->getResult(); |
| 354 | + $result->setIndexedTagName( $warnings, 'warning' ); |
354 | 355 | |
355 | 356 | if ( isset( $warnings['duplicate'] ) ) { |
356 | 357 | $dupes = array(); |
357 | 358 | foreach ( $warnings['duplicate'] as $dupe ) { |
358 | 359 | $dupes[] = $dupe->getName(); |
359 | 360 | } |
360 | | - $this->getResult()->setIndexedTagName( $dupes, 'duplicate' ); |
| 361 | + $result->setIndexedTagName( $dupes, 'duplicate' ); |
361 | 362 | $warnings['duplicate'] = $dupes; |
362 | 363 | } |
363 | 364 | |
— | — | @@ -418,7 +419,7 @@ |
419 | 420 | |
420 | 421 | return $result; |
421 | 422 | } |
422 | | - |
| 423 | + |
423 | 424 | /** |
424 | 425 | * Checks if asynchronous copy uploads are enabled and throws an error if they are not. |
425 | 426 | */ |
Index: trunk/extensions/MetricsReporting/ApiAnalyticsBase.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -abstract class ApiAnalyticsBase extends ApiBase/*ApiQueryBase*/ { |
| 4 | +abstract class ApiAnalyticsBase extends ApiBase { |
5 | 5 | |
6 | 6 | protected $mDb; |
7 | 7 | |
— | — | @@ -32,6 +32,16 @@ |
33 | 33 | |
34 | 34 | $query = $this->getQueryInfo(); |
35 | 35 | $query['fields'] = $this->getQueryFields(); |
| 36 | + |
| 37 | + $db = $this->getDB(); |
| 38 | + |
| 39 | + $this->profileDBIn(); |
| 40 | + $res = $db->select( $query['table'], $query['fields'], $query['conds'], __METHOD__, $query['options'], $query['join_conds'] ); |
| 41 | + $this->profileDBOut(); |
| 42 | + |
| 43 | + foreach( $res as $row ) { |
| 44 | + |
| 45 | + } |
36 | 46 | } |
37 | 47 | |
38 | 48 | protected abstract function getQueryInfo(); |
— | — | @@ -337,7 +347,6 @@ |
338 | 348 | 'YE', |
339 | 349 | 'ZM', |
340 | 350 | 'ZW', |
341 | | - |
342 | 351 | ), |
343 | 352 | ), |
344 | 353 | 'selectwebproperties' => array( |