Index: trunk/extensions/ProofreadPage/ProofreadPage.php |
— | — | @@ -4,12 +4,14 @@ |
5 | 5 | die( "ProofreadPage extension\n" ); |
6 | 6 | } |
7 | 7 | |
| 8 | +$dir = dirname(__FILE__) . '/'; |
| 9 | + |
8 | 10 | $wgExtensionMessagesFiles['ProofreadPage'] = dirname(__FILE__) . '/ProofreadPage.i18n.php'; |
9 | 11 | |
10 | | -$wgHooks['BeforePageDisplay'][] = 'wfPRParserOutput'; |
11 | | -$wgHooks['GetLinkColours'][] = 'wfPRLinkColours'; |
12 | | -$wgHooks['ImageOpenShowImageInlineBefore'][] = 'wfPRImageMessage'; |
13 | | -$wgHooks['ArticleSave'][] = 'wfPRSave'; |
| 12 | +$wgHooks['BeforePageDisplay'][] = 'pr_beforePageDisplay'; |
| 13 | +$wgHooks['GetLinkColours'][] = 'pr_getLinkColours'; |
| 14 | +$wgHooks['ImageOpenShowImageInlineBefore'][] = 'pr_imageMessage'; |
| 15 | +$wgHooks['ArticleSaveComplete'][] = 'pr_articleSave'; |
14 | 16 | |
15 | 17 | $wgExtensionCredits['other'][] = array( |
16 | 18 | 'name' => 'ProofreadPage', |
— | — | @@ -21,49 +23,113 @@ |
22 | 24 | 'descriptionmsg' => 'proofreadpage_desc', |
23 | 25 | ); |
24 | 26 | |
25 | | -$wgExtensionFunctions[] = "wfPRPageList"; |
26 | | -function wfPRPageList() { |
27 | | - global $wgParser; |
28 | | - $wgParser->setHook( "pagelist", "wfPRRenderPageList" ); |
| 27 | + |
| 28 | +$wgExtensionFunctions[] = "pr_main"; |
| 29 | +function pr_main() { |
| 30 | + global $wgParser; |
| 31 | + |
| 32 | + $wgParser->setHook( "pagelist", "pr_renderPageList" ); |
| 33 | + $wgParser->setHook( "indexref", "pr_renderIndexTag" ); |
| 34 | + wfLoadExtensionMessages( 'ProofreadPage' ); |
| 35 | + $index_namespace = preg_quote( wfMsgForContent( 'proofreadpage_index_namespace' ), '/' ); |
| 36 | + |
29 | 37 | } |
30 | 38 | |
| 39 | + |
| 40 | + |
| 41 | + |
31 | 42 | # Bump the version number every time you change proofread.js |
32 | 43 | $wgProofreadPageVersion = 17; |
33 | 44 | |
34 | 45 | /** |
35 | 46 | * |
36 | | - * Query the database to find if the current page is referred in an |
37 | | - * Index page. If yes, return the URLs of the index, previous and next pages. |
| 47 | + * Query the database to find if the current page is referred in an Index page. |
38 | 48 | * |
39 | 49 | */ |
| 50 | +function pr_load_index($title){ |
40 | 51 | |
41 | | -function wfPRNavigation( $image ) { |
42 | | - global $wgTitle; |
43 | 52 | $page_namespace = preg_quote( wfMsgForContent( 'proofreadpage_namespace' ), '/' ); |
44 | 53 | $index_namespace = preg_quote( wfMsgForContent( 'proofreadpage_index_namespace' ), '/' ); |
45 | | - $err = array( '', '', '', '', array() ); |
46 | 54 | |
| 55 | + $title->pr_index_title=NULL; |
| 56 | + |
47 | 57 | $dbr = wfGetDB( DB_SLAVE ); |
48 | 58 | $result = $dbr->select( |
49 | 59 | array( 'page', 'pagelinks' ), |
50 | 60 | array( 'page_namespace', 'page_title' ), |
51 | 61 | array( |
52 | | - 'pl_namespace' => $wgTitle->getNamespace(), |
53 | | - 'pl_title' => $wgTitle->getDBkey(), |
| 62 | + 'pl_namespace' => $title->getNamespace(), |
| 63 | + 'pl_title' => $title->getDBkey(), |
54 | 64 | 'pl_from=page_id' |
55 | 65 | ), |
56 | 66 | __METHOD__); |
57 | 67 | |
58 | | - $index_title = ''; |
59 | 68 | while( $x = $dbr->fetchObject( $result ) ) { |
60 | 69 | $ref_title = Title::makeTitle( $x->page_namespace, $x->page_title ); |
61 | 70 | if( preg_match( "/^$index_namespace:(.*)$/", $ref_title->getPrefixedText() ) ) { |
62 | | - $index_title = $ref_title; |
| 71 | + $title->pr_index_title = $ref_title->getPrefixedText(); |
63 | 72 | break; |
64 | 73 | } |
65 | 74 | } |
66 | 75 | $dbr->freeResult( $result ) ; |
67 | 76 | |
| 77 | + if($title->pr_index_title) return; |
| 78 | + |
| 79 | + /*check if we are a page of a multipage file*/ |
| 80 | + |
| 81 | + if ( preg_match( "/^$page_namespace:(.*?)(\/([0-9]*)|)$/", $title->getPrefixedText(), $m ) ) { |
| 82 | + $imageTitle = Title::makeTitleSafe( NS_IMAGE, $m[1] ); |
| 83 | + } |
| 84 | + if ( !$imageTitle ) return; |
| 85 | + |
| 86 | + $image = Image::newFromTitle( $imageTitle ); |
| 87 | + |
| 88 | + //if it is multipage, we use the page order of the file |
| 89 | + if( $image->exists() && $image->isMultiPage() ) { |
| 90 | + |
| 91 | + $pagenr = 1; |
| 92 | + $parts = explode( '/', $title->getText() ); |
| 93 | + if( count( $parts ) > 1 ) { |
| 94 | + $pagenr = intval( array_pop( $parts ) ); |
| 95 | + } |
| 96 | + $count = $image->pageCount(); |
| 97 | + if( $pagenr < 1 || $pagenr > $count || $count == 1 ) |
| 98 | + return $err; |
| 99 | + $name = $image->getTitle()->getText(); |
| 100 | + $index_name = "$index_namespace:$name"; |
| 101 | + $prev_name = "$page_namespace:$name/" . ( $pagenr - 1 ); |
| 102 | + $next_name = "$page_namespace:$name/" . ( $pagenr + 1 ); |
| 103 | + $prev_url = ( $pagenr == 1 ) ? '' : Title::newFromText( $prev_name )->getFullURL(); |
| 104 | + $next_url = ( $pagenr == $count ) ? '' : Title::newFromText( $next_name )->getFullURL(); |
| 105 | + |
| 106 | + //todo : we should read pagenum from the index if it is provided |
| 107 | + $title->pr_page_num = "$pagenr"; |
| 108 | + |
| 109 | + if( !$title->pr_index_title ) { |
| 110 | + //there is no index, or the page is not listed in the index : use canonical index |
| 111 | + $title->pr_index_title = $index_name; |
| 112 | + } |
| 113 | + } |
| 114 | + |
| 115 | + |
| 116 | +} |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | +/** |
| 121 | + * |
| 122 | + * return the URLs of the index, previous and next pages. |
| 123 | + * |
| 124 | + */ |
| 125 | + |
| 126 | + |
| 127 | +function pr_navigation( $image ) { |
| 128 | + global $wgTitle; |
| 129 | + $page_namespace = preg_quote( wfMsgForContent( 'proofreadpage_namespace' ), '/' ); |
| 130 | + $index_namespace = preg_quote( wfMsgForContent( 'proofreadpage_index_namespace' ), '/' ); |
| 131 | + $err = array( '', '', '', '', array() ); |
| 132 | + |
| 133 | + |
68 | 134 | //if multipage, we use the page order, but we should read pagenum from the index |
69 | 135 | if( $image->exists() && $image->isMultiPage() ) { |
70 | 136 | |
— | — | @@ -96,50 +162,74 @@ |
97 | 163 | |
98 | 164 | |
99 | 165 | if( !$index_title ) return $err; |
100 | | - $index_url = $index_title->getFullURL(); |
| 166 | + if( !$index_title->exists()) return $err; |
101 | 167 | |
102 | 168 | //if the index page exists, read metadata |
103 | | - if( $index_title->exists()) { |
104 | 169 | |
105 | | - $rev = Revision::newFromTitle( $index_title ); |
106 | | - $text = $rev->getText(); |
| 170 | + list( $prev_title, $next_title, $attributes ) = pr_parse_index($index_title,$wgTitle); |
107 | 171 | |
| 172 | + $index_url = $index_title->getFullURL(); |
| 173 | + if($prev_title) $prev_url = $prev_title->getFullURL(); |
| 174 | + if($next_title) $next_url = $next_title->getFullURL(); |
| 175 | + |
| 176 | + return array( $index_url, $prev_url, $next_url, $attributes ); |
| 177 | + |
| 178 | +} |
| 179 | + |
| 180 | + |
| 181 | +/* |
| 182 | + read metadata from the index page |
| 183 | + read also pagenum if page_title is provided (not for djvu with pagelist) |
| 184 | +*/ |
| 185 | + |
| 186 | +function pr_parse_index($index_title, $page_title){ |
| 187 | + |
| 188 | + $page_namespace = preg_quote( wfMsgForContent( 'proofreadpage_namespace' ), '/' ); |
| 189 | + $index_namespace = preg_quote( wfMsgForContent( 'proofreadpage_index_namespace' ), '/' ); |
| 190 | + |
| 191 | + if( !$index_title ) return ; |
| 192 | + if( !$index_title->exists() ) return; |
| 193 | + |
| 194 | + $rev = Revision::newFromTitle( $index_title ); |
| 195 | + $text = $rev->getText(); |
| 196 | + |
| 197 | + $attributes = array(); |
| 198 | + |
| 199 | + if($page_title){ |
| 200 | + |
| 201 | + //default pagenum was set during load() |
| 202 | + if($page_title->pr_page_num) $attributes["pagenum"] = $page_title->pr_page_num; |
| 203 | + |
108 | 204 | $tag_pattern = "/\[\[($page_namespace:.*?)(\|(.*?)|)\]\]/i"; |
109 | 205 | preg_match_all( $tag_pattern, $text, $links, PREG_PATTERN_ORDER ); |
110 | 206 | |
111 | 207 | for( $i=0; $i<count( $links[1] ); $i++) { |
112 | 208 | $a_title = Title::newFromText( $links[1][$i] ); |
113 | 209 | if(!$a_title) continue; |
114 | | - if( $a_title->getPrefixedText() == $wgTitle->getPrefixedText() ) { |
115 | | - $page_num = $links[3][$i]; |
| 210 | + if( $a_title->getPrefixedText() == $page_title->getPrefixedText() ) { |
| 211 | + $attributes["pagenum"] = $links[3][$i]; |
116 | 212 | break; |
117 | 213 | } |
118 | 214 | } |
119 | 215 | if( ($i>0) && ($i<count($links[1])) ){ |
120 | 216 | $prev_title = Title::newFromText( $links[1][$i-1] ); |
121 | | - if(!$prev_title) return $err; |
122 | | - $prev_url = $prev_title->getFullURL(); |
123 | 217 | } |
124 | 218 | if( ($i>=0) && ($i+1<count($links[1])) ){ |
125 | 219 | $next_title = Title::newFromText( $links[1][$i+1] ); |
126 | | - if(!$next_title) return $err; |
127 | | - $next_url = $next_title->getFullURL(); |
128 | 220 | } |
| 221 | + } |
129 | 222 | |
130 | | - $var_names = explode(" ", wfMsgForContent('proofreadpage_js_attributes') ); |
131 | | - $attributes = array(); |
132 | | - for($i=0; $i< count($var_names);$i++){ |
133 | | - $tag_pattern = "/\n\|".$var_names[$i]."=(.*?)\n/i"; |
134 | | - $var = 'proofreadPage'.$var_names[$i]; |
135 | | - if( preg_match( $tag_pattern, $text, $matches ) ) $attributes[$var] = $matches[1]; |
136 | | - else $attributes[$var] = ''; |
137 | | - } |
| 223 | + $var_names = explode(" ", wfMsgForContent('proofreadpage_js_attributes') ); |
| 224 | + for($i=0; $i< count($var_names);$i++){ |
| 225 | + $tag_pattern = "/\n\|".$var_names[$i]."=(.*?)\n/i"; |
| 226 | + //$var = 'proofreadPage'.$var_names[$i]; |
| 227 | + $var = strtolower($var_names[$i]); |
| 228 | + if( preg_match( $tag_pattern, $text, $matches ) ) $attributes[$var] = $matches[1]; |
| 229 | + else $attributes[$var] = ''; |
138 | 230 | } |
139 | | - else { |
140 | | - $attributes=array(); |
141 | | - } |
| 231 | + |
142 | 232 | |
143 | | - return array( $index_url, $prev_url, $next_url, $page_num, $attributes ); |
| 233 | + return array( $prev_title, $next_title, $attributes ); |
144 | 234 | |
145 | 235 | } |
146 | 236 | |
— | — | @@ -150,7 +240,7 @@ |
151 | 241 | * |
152 | 242 | */ |
153 | 243 | |
154 | | -function wfPRParserOutput( &$out ) { |
| 244 | +function pr_beforePageDisplay( &$out ) { |
155 | 245 | global $wgTitle, $wgJsMimeType, $wgScriptPath, $wgRequest, $wgProofreadPageVersion; |
156 | 246 | |
157 | 247 | wfLoadExtensionMessages( 'ProofreadPage' ); |
— | — | @@ -163,13 +253,14 @@ |
164 | 254 | |
165 | 255 | $page_namespace = preg_quote( wfMsgForContent( 'proofreadpage_namespace' ), '/' ); |
166 | 256 | if ( preg_match( "/^$page_namespace:(.*?)(\/([0-9]*)|)$/", $wgTitle->getPrefixedText(), $m ) ) { |
167 | | - wfPRPreparePage( $out, $m, $isEdit ); |
| 257 | + if( !isset($wgTitle->pr_index_title) ) pr_load_index($wgTitle); |
| 258 | + pr_preparePage( $out, $m, $isEdit ); |
168 | 259 | return true; |
169 | 260 | } |
170 | 261 | |
171 | 262 | $index_namespace = preg_quote( wfMsgForContent( 'proofreadpage_index_namespace' ), '/' ); |
172 | 263 | if ( $isEdit && (preg_match( "/^$index_namespace:(.*?)(\/([0-9]*)|)$/", $wgTitle->getPrefixedText(), $m ) ) ) { |
173 | | - wfPRPrepareIndex( $out ); |
| 264 | + pr_prepareIndex( $out ); |
174 | 265 | return true; |
175 | 266 | } |
176 | 267 | |
— | — | @@ -177,7 +268,7 @@ |
178 | 269 | } |
179 | 270 | |
180 | 271 | |
181 | | -function wfPRPrepareIndex( $out ) { |
| 272 | +function pr_prepareIndex( $out ) { |
182 | 273 | global $wgTitle, $wgJsMimeType, $wgScriptPath, $wgRequest, $wgProofreadPageVersion; |
183 | 274 | $jsFile = htmlspecialchars( "$wgScriptPath/extensions/ProofreadPage/proofread_index.js?$wgProofreadPageVersion" ); |
184 | 275 | |
— | — | @@ -194,7 +285,11 @@ |
195 | 286 | } |
196 | 287 | |
197 | 288 | |
198 | | -function wfPRPreparePage( $out, $m, $isEdit ) { |
| 289 | + |
| 290 | + |
| 291 | + |
| 292 | + |
| 293 | +function pr_preparePage( $out, $m, $isEdit ) { |
199 | 294 | global $wgTitle, $wgJsMimeType, $wgScriptPath, $wgRequest, $wgProofreadPageVersion; |
200 | 295 | |
201 | 296 | $imageTitle = Title::makeTitleSafe( NS_IMAGE, $m[1] ); |
— | — | @@ -202,7 +297,6 @@ |
203 | 298 | return true; |
204 | 299 | } |
205 | 300 | |
206 | | - |
207 | 301 | $image = Image::newFromTitle( $imageTitle ); |
208 | 302 | if ( $image->exists() ) { |
209 | 303 | $width = $image->getWidth(); |
— | — | @@ -228,7 +322,7 @@ |
229 | 323 | $thumbURL = ''; |
230 | 324 | } |
231 | 325 | |
232 | | - list( $index_url, $prev_url, $next_url, $page_num, $attributes ) = wfPRNavigation( $image ); |
| 326 | + list( $index_url, $prev_url, $next_url, $attributes ) = pr_navigation( $image ); |
233 | 327 | |
234 | 328 | $jsFile = htmlspecialchars( "$wgScriptPath/extensions/ProofreadPage/proofread.js?$wgProofreadPageVersion" ); |
235 | 329 | $jsVars = array( |
— | — | @@ -240,7 +334,6 @@ |
241 | 335 | 'proofreadPageIndexURL' => $index_url, |
242 | 336 | 'proofreadPagePrevURL' => $prev_url, |
243 | 337 | 'proofreadPageNextURL' => $next_url, |
244 | | - 'proofreadPageNum' => $page_num, |
245 | 338 | ) + $attributes; |
246 | 339 | $varScript = Skin::makeVariablesScript( $jsVars ); |
247 | 340 | |
— | — | @@ -273,9 +366,10 @@ |
274 | 367 | |
275 | 368 | |
276 | 369 | /** |
277 | | - * Give quality colour codes to pages linked from an index page |
| 370 | + * Return the quality colour codes to pages linked from an index page |
| 371 | + * Update page counts in pr_index table |
278 | 372 | */ |
279 | | -function wfPRLinkColours( $page_ids, &$colours ) { |
| 373 | +function pr_getLinkColours( $page_ids, &$colours ) { |
280 | 374 | global $wgTitle; |
281 | 375 | |
282 | 376 | if ( !isset( $wgTitle ) ) { |
— | — | @@ -289,6 +383,9 @@ |
290 | 384 | return true; |
291 | 385 | } |
292 | 386 | |
| 387 | + //counters |
| 388 | + $n = $n1 = $n2 = $n3 = $n4 = 0; |
| 389 | + |
293 | 390 | $dbr = wfGetDB( DB_SLAVE ); |
294 | 391 | $catlinks = $dbr->tableName( 'categorylinks' ); |
295 | 392 | foreach ( $page_ids as $id => $pdbk ) { |
— | — | @@ -298,6 +395,7 @@ |
299 | 396 | if ( preg_match( "/^$page_namespace:(.*?)$/", $pdbk ) ) { |
300 | 397 | |
301 | 398 | $colours[$pdbk] = 'quality1'; |
| 399 | + $n++; |
302 | 400 | |
303 | 401 | if ( !isset( $query ) ) { |
304 | 402 | $query = "SELECT cl_from, cl_to FROM $catlinks WHERE cl_from IN("; |
— | — | @@ -307,6 +405,7 @@ |
308 | 406 | $query .= $id; |
309 | 407 | } |
310 | 408 | } |
| 409 | + |
311 | 410 | if ( isset( $query ) ) { |
312 | 411 | $query .= ')'; |
313 | 412 | $res = $dbr->query( $query, __METHOD__ ); |
— | — | @@ -316,10 +415,22 @@ |
317 | 416 | $pdbk = $page_ids[$x->cl_from]; |
318 | 417 | |
319 | 418 | switch($x->cl_to){ |
320 | | - case str_replace( ' ' , '_' , wfMsgForContent('proofreadpage_quality1_category')): $colours[$pdbk] = 'quality1';break; |
321 | | - case str_replace( ' ' , '_' , wfMsgForContent('proofreadpage_quality2_category')): $colours[$pdbk] = 'quality2';break; |
322 | | - case str_replace( ' ' , '_' , wfMsgForContent('proofreadpage_quality3_category')): $colours[$pdbk] = 'quality3';break; |
323 | | - case str_replace( ' ' , '_' , wfMsgForContent('proofreadpage_quality4_category')): $colours[$pdbk] = 'quality4';break; |
| 419 | + case str_replace( ' ' , '_' , wfMsgForContent('proofreadpage_quality1_category')): |
| 420 | + $colours[$pdbk] = 'quality1'; |
| 421 | + $n1++; |
| 422 | + break; |
| 423 | + case str_replace( ' ' , '_' , wfMsgForContent('proofreadpage_quality2_category')): |
| 424 | + $colours[$pdbk] = 'quality2'; |
| 425 | + $n2++; |
| 426 | + break; |
| 427 | + case str_replace( ' ' , '_' , wfMsgForContent('proofreadpage_quality3_category')): |
| 428 | + $colours[$pdbk] = 'quality3'; |
| 429 | + $n3++; |
| 430 | + break; |
| 431 | + case str_replace( ' ' , '_' , wfMsgForContent('proofreadpage_quality4_category')): |
| 432 | + $colours[$pdbk] = 'quality4'; |
| 433 | + $n4++; |
| 434 | + break; |
324 | 435 | } |
325 | 436 | } |
326 | 437 | } |
— | — | @@ -327,7 +438,7 @@ |
328 | 439 | return true; |
329 | 440 | } |
330 | 441 | |
331 | | -function wfPRImageMessage( &$imgpage , &$wgOut ) { |
| 442 | +function pr_imageMessage( &$imgpage , &$wgOut ) { |
332 | 443 | |
333 | 444 | global $wgUser; |
334 | 445 | $sk = $wgUser->getSkin(); |
— | — | @@ -377,8 +488,45 @@ |
378 | 489 | |
379 | 490 | |
380 | 491 | |
381 | | -function wfPRRenderPageList( $input, $args ) { |
| 492 | +function pr_renderIndexTag( $input, $args ) { |
| 493 | + global $wgParser, $wgTitle; |
382 | 494 | |
| 495 | + if( !isset($wgTitle->pr_index_title) ) pr_load_index($wgTitle); |
| 496 | + |
| 497 | + $index_namespace = preg_quote( wfMsgForContent( 'proofreadpage_index_namespace' ), '/' ); |
| 498 | + |
| 499 | + $name = $args['src']; |
| 500 | + if( $name ) |
| 501 | + $index_title = Title::newFromText( "$index_namespace:$name" ); |
| 502 | + else |
| 503 | + $index_title = Title::newFromText( $wgTitle->pr_index_title ); |
| 504 | + |
| 505 | + if( ! $index_title || ! $index_title->exists() ) return "error: no such index: $index_namespace:$name"; |
| 506 | + |
| 507 | + if($wgTitle->pr_index_title) $page_index = $wgTitle; else $page_index=NULL; |
| 508 | + |
| 509 | + //here we must parse the index everytime we render the tag: |
| 510 | + //it would be better to store the attributes in a table |
| 511 | + //especially in the case of a 'special' page |
| 512 | + list( $prev_title, $next_title, $attributes ) = pr_parse_index( $index_title, $page_index ); |
| 513 | + |
| 514 | + //first parse |
| 515 | + $input = $wgParser->recursiveTagParse($input); |
| 516 | + |
| 517 | + foreach($attributes as $key=>$val){ |
| 518 | + $input = str_replace( "{{{{$key}}}}", $val, $input ); |
| 519 | + } |
| 520 | + |
| 521 | + |
| 522 | + $out = $wgParser->recursiveTagParse($input); |
| 523 | + |
| 524 | + return $out; |
| 525 | + |
| 526 | +} |
| 527 | + |
| 528 | + |
| 529 | +function pr_renderPageList( $input, $args ) { |
| 530 | + |
383 | 531 | global $wgUser, $wgTitle; |
384 | 532 | |
385 | 533 | wfLoadExtensionMessages( 'ProofreadPage' ); |
— | — | @@ -429,7 +577,7 @@ |
430 | 578 | $colours[$pdbk] = 'known'; |
431 | 579 | $linkcolour_ids[$s->page_id] = $pdbk; |
432 | 580 | } |
433 | | - wfPRLinkColours( $linkcolour_ids, $colours ); |
| 581 | + pr_getLinkColours( $linkcolour_ids, $colours ); |
434 | 582 | |
435 | 583 | $sk = $wgUser->getSkin(); |
436 | 584 | |
— | — | @@ -479,15 +627,24 @@ |
480 | 628 | |
481 | 629 | |
482 | 630 | /* update coloured links in index pages */ |
483 | | -function wfPRSave( $article ) { |
| 631 | +function pr_articleSave( $article ) { |
484 | 632 | |
485 | 633 | wfLoadExtensionMessages( 'ProofreadPage' ); |
486 | 634 | $page_namespace = preg_quote( wfMsgForContent( 'proofreadpage_namespace' ), '/' ); |
| 635 | + $index_namespace = preg_quote( wfMsgForContent( 'proofreadpage_namespace' ), '/' ); |
487 | 636 | |
488 | | - if( preg_match( "/^$page_namespace:(.*)$/", $article->mTitle->getPrefixedText() ) ) { |
489 | | - $article->mTitle->touchLinks(); |
490 | | - $article->mTitle->purgeSquid(); |
| 637 | + $title = $article->mTitle; |
| 638 | + |
| 639 | + if( preg_match( "/^$page_namespace:(.*)$/", $title->getPrefixedText() ) ) { |
| 640 | + |
| 641 | + if( !isset($title->pr_index_title) ) pr_load_index($title); |
| 642 | + if( $title->pr_index_title) { |
| 643 | + $index_title = Title::makeTitleSafe( $index_namespace, $title->pr_index_title ); |
| 644 | + $index_title->invalidateCache(); |
| 645 | + } |
491 | 646 | } |
| 647 | + |
492 | 648 | return true; |
493 | 649 | |
494 | 650 | } |
| 651 | + |