r82902 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82901‎ | r82902 | r82903 >
Date:17:36, 27 February 2011
Author:demon
Status:ok
Tags:
Comment:
Bunch of $fName -> __METHOD__
Modified paths:
  • /trunk/extensions/MWSearch/MWSearch_body.php (modified) (history)
  • /trunk/extensions/MWSearch/luceneUpdate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MWSearch/luceneUpdate.php
@@ -245,12 +245,11 @@
246246 }
247247
248248 function rebuildAll() {
249 - $fname = 'LuceneBuilder::rebuildAll';
250249 global $wgDBname;
251250
252251 $lastError = true;
253252
254 - $maxId = $this->db->selectField( 'page', 'MAX(page_id)', '', $fname );
 253+ $maxId = $this->db->selectField( 'page', 'MAX(page_id)', '', __METHOD__ );
255254 $maxId -= $this->offset; // hack for percentages
256255 $this->init( $maxId );
257256 if( $maxId < 1 ) {
@@ -266,7 +265,7 @@
267266 $result = $this->dbstream->select( array( 'page' ),
268267 array( 'page_namespace', 'page_title', 'page_latest' ),
269268 '',
270 - $fname,
 269+ __METHOD__,
271270 $limit );
272271
273272 $errorCount = 0;
@@ -306,7 +305,6 @@
307306 */
308307 function rebuildDeleted( $since = null ) {
309308 global $wgDBname;
310 - $fname = 'LuceneBuilder::rebuildDeleted';
311309
312310 if( is_null( $since ) ) {
313311 $since = '20010115000000';
@@ -325,7 +323,7 @@
326324 ON log_namespace=page_namespace AND log_title=page_title
327325 WHERE log_type='delete'
328326 AND log_timestamp > $cutoff
329 - AND page_namespace IS NULL", $fname );
 327+ AND page_namespace IS NULL", __METHOD__ );
330328
331329 $max = $this->dbstream->numRows( $result );
332330 if( $max == 0 ) {
@@ -359,8 +357,7 @@
360358 */
361359 function rebuildRecent( $since = null ) {
362360 global $wgDBname;
363 - $fname = 'LuceneBuilder::rebuildDeleted';
364 -
 361+
365362 if( is_null( $since ) ) {
366363 $since = '20010115000000';
367364 }
@@ -379,7 +376,7 @@
380377 AND rc_title=page_title
381378 AND rc_this_oldid=page_latest
382379 AND page_latest=rev_id
383 - AND rc_timestamp > $cutoff", $fname );
 380+ AND rc_timestamp > $cutoff", __METHOD__ );
384381
385382 #$max = $this->dbstream->numRows( $result );
386383 $max = 10000; // wacky estimate
Index: trunk/extensions/MWSearch/MWSearch_body.php
@@ -62,12 +62,11 @@
6363 */
6464 function replacePrefixes( $query ) {
6565 global $wgContLang, $wgLuceneUseRelated;
66 - $fname = 'LuceneSearch::replacePrefixes';
67 - wfProfileIn($fname);
 66+ wfProfileIn( __METHOD__ );
6867
6968 // quick check, most of the time we don't need any rewriting
7069 if(strpos($query,':')===false){
71 - wfProfileOut($fname);
 70+ wfProfileOut( __METHOD__ );
7271 return $query;
7372 }
7473
@@ -79,7 +78,7 @@
8079 if($wgLuceneUseRelated && strncmp($query, $relatedkey, strlen($relatedkey)) == 0){
8180 $this->related = true;
8281 list($dummy,$ret) = explode(":",$query,2);
83 - wfProfileOut($fname);
 82+ wfProfileOut( __METHOD__ );
8483 return trim($ret);
8584 }
8685
@@ -115,7 +114,7 @@
116115 $rewritten .= str_replace($allkeyword.':', 'all:', $r);
117116 }
118117 }
119 - wfProfileOut($fname);
 118+ wfProfileOut( __METHOD__ );
120119 return $rewritten;
121120 }
122121
@@ -429,7 +428,7 @@
430429 $limit = 20, $offset = 0, $searchAll = False ) {
431430
432431 $fname = 'LuceneSearchSet::newFromQuery';
433 - wfProfileIn( $fname );
 432+ wfProfileIn( __METHOD__ );
434433
435434 global $wgLuceneHost, $wgLucenePort, $wgDBname, $wgMemc;
436435 global $wgLuceneSearchVersion, $wgLuceneSearchCacheExpiry;
@@ -465,8 +464,8 @@
466465 $key = "$wgDBname:lucene:" . md5( $searchUrl );
467466 $resultSet = $wgMemc->get( $key );
468467 if( is_object( $resultSet ) ) {
469 - wfDebug( "$fname: got cached lucene results for key $key\n" );
470 - wfProfileOut( $fname );
 468+ wfDebug( __METHOD__ . ": got cached lucene results for key $key\n" );
 469+ wfProfileOut( __METHOD__ );
471470 return $resultSet;
472471 }
473472 }
@@ -477,13 +476,14 @@
478477
479478 wfDebug( "Fetching search data from $searchUrl\n" );
480479 wfSuppressWarnings();
481 - wfProfileIn( $fname.'-contact-'.$host );
 480+ $httpProfile = __METHOD__ . '-contact-' . $host;
 481+ wfProfileIn( $httpProfile );
482482 $data = Http::get( $searchUrl, $wgLuceneSearchTimeout, $httpOpts);
483 - wfProfileOut( $fname.'-contact-'.$host );
 483+ wfProfileOut( $httpProfile );
484484 wfRestoreWarnings();
485485 if( $data === false ) {
486486 // Network error or server error
487 - wfProfileOut( $fname );
 487+ wfProfileOut( __METHOD__ );
488488 return null;
489489 } else {
490490 $inputLines = explode( "\n", trim( $data ) );
@@ -535,11 +535,11 @@
536536 $suggestion, $info, $interwiki );
537537
538538 if($wgLuceneSearchCacheExpiry > 0){
539 - wfDebug( "$fname: caching lucene results for key $key\n" );
 539+ wfDebug( __METHOD__ . ": caching lucene results for key $key\n" );
540540 $wgMemc->add( $key, $resultSet, $wgLuceneSearchCacheExpiry );
541541 }
542542
543 - wfProfileOut( $fname );
 543+ wfProfileOut( __METHOD__ );
544544 return $resultSet;
545545 }
546546

Status & tagging log