Index: trunk/extensions/MWSearch/luceneUpdate.php |
— | — | @@ -245,12 +245,11 @@ |
246 | 246 | } |
247 | 247 | |
248 | 248 | function rebuildAll() { |
249 | | - $fname = 'LuceneBuilder::rebuildAll'; |
250 | 249 | global $wgDBname; |
251 | 250 | |
252 | 251 | $lastError = true; |
253 | 252 | |
254 | | - $maxId = $this->db->selectField( 'page', 'MAX(page_id)', '', $fname ); |
| 253 | + $maxId = $this->db->selectField( 'page', 'MAX(page_id)', '', __METHOD__ ); |
255 | 254 | $maxId -= $this->offset; // hack for percentages |
256 | 255 | $this->init( $maxId ); |
257 | 256 | if( $maxId < 1 ) { |
— | — | @@ -266,7 +265,7 @@ |
267 | 266 | $result = $this->dbstream->select( array( 'page' ), |
268 | 267 | array( 'page_namespace', 'page_title', 'page_latest' ), |
269 | 268 | '', |
270 | | - $fname, |
| 269 | + __METHOD__, |
271 | 270 | $limit ); |
272 | 271 | |
273 | 272 | $errorCount = 0; |
— | — | @@ -306,7 +305,6 @@ |
307 | 306 | */ |
308 | 307 | function rebuildDeleted( $since = null ) { |
309 | 308 | global $wgDBname; |
310 | | - $fname = 'LuceneBuilder::rebuildDeleted'; |
311 | 309 | |
312 | 310 | if( is_null( $since ) ) { |
313 | 311 | $since = '20010115000000'; |
— | — | @@ -325,7 +323,7 @@ |
326 | 324 | ON log_namespace=page_namespace AND log_title=page_title |
327 | 325 | WHERE log_type='delete' |
328 | 326 | AND log_timestamp > $cutoff |
329 | | - AND page_namespace IS NULL", $fname ); |
| 327 | + AND page_namespace IS NULL", __METHOD__ ); |
330 | 328 | |
331 | 329 | $max = $this->dbstream->numRows( $result ); |
332 | 330 | if( $max == 0 ) { |
— | — | @@ -359,8 +357,7 @@ |
360 | 358 | */ |
361 | 359 | function rebuildRecent( $since = null ) { |
362 | 360 | global $wgDBname; |
363 | | - $fname = 'LuceneBuilder::rebuildDeleted'; |
364 | | - |
| 361 | + |
365 | 362 | if( is_null( $since ) ) { |
366 | 363 | $since = '20010115000000'; |
367 | 364 | } |
— | — | @@ -379,7 +376,7 @@ |
380 | 377 | AND rc_title=page_title |
381 | 378 | AND rc_this_oldid=page_latest |
382 | 379 | AND page_latest=rev_id |
383 | | - AND rc_timestamp > $cutoff", $fname ); |
| 380 | + AND rc_timestamp > $cutoff", __METHOD__ ); |
384 | 381 | |
385 | 382 | #$max = $this->dbstream->numRows( $result ); |
386 | 383 | $max = 10000; // wacky estimate |
Index: trunk/extensions/MWSearch/MWSearch_body.php |
— | — | @@ -62,12 +62,11 @@ |
63 | 63 | */ |
64 | 64 | function replacePrefixes( $query ) { |
65 | 65 | global $wgContLang, $wgLuceneUseRelated; |
66 | | - $fname = 'LuceneSearch::replacePrefixes'; |
67 | | - wfProfileIn($fname); |
| 66 | + wfProfileIn( __METHOD__ ); |
68 | 67 | |
69 | 68 | // quick check, most of the time we don't need any rewriting |
70 | 69 | if(strpos($query,':')===false){ |
71 | | - wfProfileOut($fname); |
| 70 | + wfProfileOut( __METHOD__ ); |
72 | 71 | return $query; |
73 | 72 | } |
74 | 73 | |
— | — | @@ -79,7 +78,7 @@ |
80 | 79 | if($wgLuceneUseRelated && strncmp($query, $relatedkey, strlen($relatedkey)) == 0){ |
81 | 80 | $this->related = true; |
82 | 81 | list($dummy,$ret) = explode(":",$query,2); |
83 | | - wfProfileOut($fname); |
| 82 | + wfProfileOut( __METHOD__ ); |
84 | 83 | return trim($ret); |
85 | 84 | } |
86 | 85 | |
— | — | @@ -115,7 +114,7 @@ |
116 | 115 | $rewritten .= str_replace($allkeyword.':', 'all:', $r); |
117 | 116 | } |
118 | 117 | } |
119 | | - wfProfileOut($fname); |
| 118 | + wfProfileOut( __METHOD__ ); |
120 | 119 | return $rewritten; |
121 | 120 | } |
122 | 121 | |
— | — | @@ -429,7 +428,7 @@ |
430 | 429 | $limit = 20, $offset = 0, $searchAll = False ) { |
431 | 430 | |
432 | 431 | $fname = 'LuceneSearchSet::newFromQuery'; |
433 | | - wfProfileIn( $fname ); |
| 432 | + wfProfileIn( __METHOD__ ); |
434 | 433 | |
435 | 434 | global $wgLuceneHost, $wgLucenePort, $wgDBname, $wgMemc; |
436 | 435 | global $wgLuceneSearchVersion, $wgLuceneSearchCacheExpiry; |
— | — | @@ -465,8 +464,8 @@ |
466 | 465 | $key = "$wgDBname:lucene:" . md5( $searchUrl ); |
467 | 466 | $resultSet = $wgMemc->get( $key ); |
468 | 467 | 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__ ); |
471 | 470 | return $resultSet; |
472 | 471 | } |
473 | 472 | } |
— | — | @@ -477,13 +476,14 @@ |
478 | 477 | |
479 | 478 | wfDebug( "Fetching search data from $searchUrl\n" ); |
480 | 479 | wfSuppressWarnings(); |
481 | | - wfProfileIn( $fname.'-contact-'.$host ); |
| 480 | + $httpProfile = __METHOD__ . '-contact-' . $host; |
| 481 | + wfProfileIn( $httpProfile ); |
482 | 482 | $data = Http::get( $searchUrl, $wgLuceneSearchTimeout, $httpOpts); |
483 | | - wfProfileOut( $fname.'-contact-'.$host ); |
| 483 | + wfProfileOut( $httpProfile ); |
484 | 484 | wfRestoreWarnings(); |
485 | 485 | if( $data === false ) { |
486 | 486 | // Network error or server error |
487 | | - wfProfileOut( $fname ); |
| 487 | + wfProfileOut( __METHOD__ ); |
488 | 488 | return null; |
489 | 489 | } else { |
490 | 490 | $inputLines = explode( "\n", trim( $data ) ); |
— | — | @@ -535,11 +535,11 @@ |
536 | 536 | $suggestion, $info, $interwiki ); |
537 | 537 | |
538 | 538 | if($wgLuceneSearchCacheExpiry > 0){ |
539 | | - wfDebug( "$fname: caching lucene results for key $key\n" ); |
| 539 | + wfDebug( __METHOD__ . ": caching lucene results for key $key\n" ); |
540 | 540 | $wgMemc->add( $key, $resultSet, $wgLuceneSearchCacheExpiry ); |
541 | 541 | } |
542 | 542 | |
543 | | - wfProfileOut( $fname ); |
| 543 | + wfProfileOut( __METHOD__ ); |
544 | 544 | return $resultSet; |
545 | 545 | } |
546 | 546 | |