r81843 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81842‎ | r81843 | r81844 >
Date:20:09, 9 February 2011
Author:reedy
Status:ok
Tags:
Comment:
Rebuild raw sql

Remove old method_exists

Add braces
Modified paths:
  • /trunk/phase3/maintenance/refreshLinks.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/refreshLinks.php
@@ -70,9 +70,7 @@
7171 $wgUser->setOption( 'math', MW_MATH_SOURCE );
7272
7373 # Don't generate extension images (e.g. Timeline)
74 - if ( method_exists( $wgParser, "clearTagHooks" ) ) {
75 - $wgParser->clearTagHooks();
76 - }
 74+ $wgParser->clearTagHooks();
7775
7876 # Don't use HTML tidy
7977 $wgUseTidy = false;
@@ -81,15 +79,26 @@
8280
8381 if ( $oldRedirectsOnly ) {
8482 # This entire code path is cut-and-pasted from below. Hurrah.
85 - $res = $dbr->query(
86 - "SELECT page_id " .
87 - "FROM page " .
88 - "LEFT JOIN redirect ON page_id=rd_from " .
89 - "WHERE page_is_redirect=1 AND rd_from IS NULL AND " .
90 - ( $end == 0 ? "page_id >= $start"
91 - : "page_id BETWEEN $start AND $end" ),
92 - __METHOD__
 83+
 84+ $conds = array(
 85+ "page_is_redirect=1",
 86+ "rd_from IS NULL"
9387 );
 88+
 89+ if ( $end == 0 ) {
 90+ $conds[] = "page_id >= $start";
 91+ } else {
 92+ $conds[] = "page_id BETWEEN $start AND $end";
 93+ }
 94+
 95+ $res = $dbr->select(
 96+ array( 'page', 'redirect' ),
 97+ 'page_id',
 98+ $conds,
 99+ __METHOD__,
 100+ array(),
 101+ array( 'redirect' => array( "LEFT JOIN", "page_id=rd_from" ) )
 102+ );
94103 $num = $dbr->numRows( $res );
95104 $this->output( "Refreshing $num old redirects from $start...\n" );
96105
@@ -120,10 +129,11 @@
121130 $this->output( "$i\n" );
122131 wfWaitForSlaves( $maxLag );
123132 }
124 - if ( $redirectsOnly )
 133+ if ( $redirectsOnly ) {
125134 $this->fixRedirect( $row->page_id );
126 - else
 135+ } else {
127136 self::fixLinksFromArticle( $row->page_id );
 137+ }
128138 }
129139 } else {
130140 if ( !$end ) {

Status & tagging log