Index: trunk/phase3/maintenance/refreshLinks.php |
— | — | @@ -70,9 +70,7 @@ |
71 | 71 | $wgUser->setOption( 'math', MW_MATH_SOURCE ); |
72 | 72 | |
73 | 73 | # Don't generate extension images (e.g. Timeline) |
74 | | - if ( method_exists( $wgParser, "clearTagHooks" ) ) { |
75 | | - $wgParser->clearTagHooks(); |
76 | | - } |
| 74 | + $wgParser->clearTagHooks(); |
77 | 75 | |
78 | 76 | # Don't use HTML tidy |
79 | 77 | $wgUseTidy = false; |
— | — | @@ -81,15 +79,26 @@ |
82 | 80 | |
83 | 81 | if ( $oldRedirectsOnly ) { |
84 | 82 | # 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" |
93 | 87 | ); |
| 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 | + ); |
94 | 103 | $num = $dbr->numRows( $res ); |
95 | 104 | $this->output( "Refreshing $num old redirects from $start...\n" ); |
96 | 105 | |
— | — | @@ -120,10 +129,11 @@ |
121 | 130 | $this->output( "$i\n" ); |
122 | 131 | wfWaitForSlaves( $maxLag ); |
123 | 132 | } |
124 | | - if ( $redirectsOnly ) |
| 133 | + if ( $redirectsOnly ) { |
125 | 134 | $this->fixRedirect( $row->page_id ); |
126 | | - else |
| 135 | + } else { |
127 | 136 | self::fixLinksFromArticle( $row->page_id ); |
| 137 | + } |
128 | 138 | } |
129 | 139 | } else { |
130 | 140 | if ( !$end ) { |