Index: trunk/phase3/maintenance/updateRestrictions.php |
— | — | @@ -82,7 +82,7 @@ |
83 | 83 | // Kill any broken rows from previous imports |
84 | 84 | $db->delete( 'page_restrictions', array( 'pr_level' => '' ) ); |
85 | 85 | // Kill other invalid rows |
86 | | - $db->deleteJoin( 'page_restrictions', 'page', 'pr_page', 'page_id', array('page_namespace' => NS_MEDIAWIKI) ); |
| 86 | + #$db->deleteJoin( 'page_restrictions', 'page', 'pr_page', 'page_id', array('page_namespace' => NS_MEDIAWIKI) ); |
87 | 87 | echo "...Done!\n"; |
88 | 88 | } |
89 | 89 | |
Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -3310,7 +3310,6 @@ |
3311 | 3311 | throw new MWException( '<html> extension tag encountered unexpectedly' ); |
3312 | 3312 | } |
3313 | 3313 | case 'nowiki': |
3314 | | - $content = strtr($content, array('-{' => '-{', '}-' => '}-')); |
3315 | 3314 | $output = Xml::escapeTagsOnly( $content ); |
3316 | 3315 | break; |
3317 | 3316 | case 'math': |
Index: trunk/phase3/languages/LanguageConverter.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | * @ingroup Language |
15 | 15 | * |
16 | 16 | * @author Zhengzhu Feng <zhengzhu@gmail.com> |
17 | | - * @maintainers fdcn <fdcn64@gmail.com>, shinjiman <shinjiman@gmail.com>, PhiLiP <philip.npc@gmail.com> |
| 17 | + * @maintainers fdcn <fdcn64@gmail.com>, shinjiman <shinjiman@gmail.com> |
18 | 18 | */ |
19 | 19 | class LanguageConverter { |
20 | 20 | var $mPreferredVariant=''; |
— | — | @@ -21,8 +21,6 @@ |
22 | 22 | var $mVariants, $mVariantFallbacks, $mVariantNames; |
23 | 23 | var $mTablesLoaded = false; |
24 | 24 | var $mTables; |
25 | | - var $mManualAddTables; |
26 | | - var $mManualRemoveTables; |
27 | 25 | var $mTitleDisplay=''; |
28 | 26 | var $mDoTitleConvert=true, $mDoContentConvert=true; |
29 | 27 | var $mManualLevel; // 'bidirectional' 'unidirectional' 'disable' for each variants |
— | — | @@ -83,13 +81,10 @@ |
84 | 82 | 'N'=>'N' // current variant name |
85 | 83 | ); |
86 | 84 | $this->mFlags = array_merge($f, $flags); |
87 | | - foreach( $this->mVariants as $v) { |
| 85 | + foreach( $this->mVariants as $v) |
88 | 86 | $this->mManualLevel[$v]=array_key_exists($v,$manualLevel) |
89 | 87 | ?$manualLevel[$v] |
90 | 88 | :'bidirectional'; |
91 | | - $this->mManualAddTables[$v] = array(); |
92 | | - $this->mManualRemoveTables[$v] = array(); |
93 | | - } |
94 | 89 | } |
95 | 90 | |
96 | 91 | /** |
— | — | @@ -328,12 +323,13 @@ |
329 | 324 | |
330 | 325 | return $ret; |
331 | 326 | } |
332 | | - |
| 327 | + |
| 328 | + |
333 | 329 | /** |
334 | | - * prepare manual conversion table |
| 330 | + * apply manual conversion |
335 | 331 | * @private |
336 | 332 | */ |
337 | | - function prepareManualConv($convRule){ |
| 333 | + function applyManualConv($convRule){ |
338 | 334 | // use syntax -{T|zh:TitleZh;zh-tw:TitleTw}- for custom conversion in title |
339 | 335 | $title = $convRule->getTitle(); |
340 | 336 | if($title){ |
— | — | @@ -346,33 +342,14 @@ |
347 | 343 | $action = $convRule->getRulesAction(); |
348 | 344 | foreach($convTable as $v=>$t) { |
349 | 345 | if( !in_array($v,$this->mVariants) )continue; |
350 | | - if( $action=="add" ) { |
351 | | - foreach($t as $from=>$to) { |
352 | | - // more efficient than array_merge(), about 2.5 times. |
353 | | - $this->mManualAddTables[$v][$from] = $to; |
354 | | - } |
355 | | - } |
| 346 | + if( $action=="add" ) |
| 347 | + $this->mTables[$v]->mergeArray($t); |
356 | 348 | elseif ( $action=="remove" ) |
357 | | - $this->mManualRemoveTables[$v] = array_merge($this->mManualRemoveTables[$v], $t); |
| 349 | + $this->mTables[$v]->removeArray($t); |
358 | 350 | } |
359 | 351 | } |
360 | 352 | |
361 | 353 | /** |
362 | | - * apply manual conversion from $this->mManualAddTables and $this->mManualRemoveTables |
363 | | - * @private |
364 | | - */ |
365 | | - function applyManualConv(){ |
366 | | - //apply manual conversion table to global table |
367 | | - foreach($this->mVariants as $v) { |
368 | | - if (count($this->mManualAddTables[$v]) > 0) { |
369 | | - $this->mTables[$v]->mergeArray($this->mManualAddTables[$v]); |
370 | | - } |
371 | | - if (count($this->mManualRemoveTables[$v]) > 0) |
372 | | - $this->mTables[$v]->removeArray($this->mManualRemoveTables[$v]); |
373 | | - } |
374 | | - } |
375 | | - |
376 | | - /** |
377 | 354 | * Convert text using a parser object for context |
378 | 355 | * @public |
379 | 356 | */ |
— | — | @@ -461,27 +438,33 @@ |
462 | 439 | $plang = $this->getPreferredVariant(); |
463 | 440 | $tarray = StringUtils::explode($this->mMarkup['end'], $text); |
464 | 441 | $text = ''; |
465 | | - |
466 | | - $marks = array(); |
| 442 | + $lastDelim = false; |
467 | 443 | foreach($tarray as $txt) { |
468 | 444 | $marked = explode($this->mMarkup['begin'], $txt, 2); |
469 | | - if (array_key_exists(1, $marked)) { |
470 | | - $crule = new ConverterRule($marked[1], $this); |
471 | | - $crule->parse($plang); |
472 | | - $marked[1] = $crule->getDisplay(); |
473 | | - $this->prepareManualConv($crule); |
474 | | - } |
475 | | - array_push($marks, $marked); |
476 | | - } |
477 | | - $this->applyManualConv(); |
478 | | - foreach ($marks as $marked) { |
| 445 | + |
479 | 446 | if( $this->mDoContentConvert ) |
480 | 447 | $text .= $this->autoConvert($marked[0],$plang); |
481 | 448 | else |
482 | 449 | $text .= $marked[0]; |
483 | | - if( array_key_exists(1, $marked) ) |
484 | | - $text .= $marked[1]; |
| 450 | + |
| 451 | + if(array_key_exists(1, $marked)){ |
| 452 | + // strip the flags from syntax like -{T| ... }- |
| 453 | + $crule = new ConverterRule($marked[1], $this); |
| 454 | + $crule->parse($plang); |
| 455 | + |
| 456 | + $text .= $crule->getDisplay(); |
| 457 | + $this->applyManualConv($crule); |
| 458 | + $lastDelim = false; |
| 459 | + } else { |
| 460 | + // Reinsert the }- which wasn't part of anything |
| 461 | + $text .= $this->mMarkup['end']; |
| 462 | + $lastDelim = true; |
| 463 | + } |
485 | 464 | } |
| 465 | + if ( $lastDelim ) { |
| 466 | + // Remove the last delimiter (wasn't real) |
| 467 | + $text = substr( $text, 0, -strlen( $this->mMarkup['end'] ) ); |
| 468 | + } |
486 | 469 | |
487 | 470 | return $text; |
488 | 471 | } |
— | — | @@ -817,7 +800,6 @@ |
818 | 801 | * @ingroup Language |
819 | 802 | * @author fdcn <fdcn64@gmail.com> |
820 | 803 | */ |
821 | | - |
822 | 804 | class ConverterRule { |
823 | 805 | var $mText; // original text in -{text}- |
824 | 806 | var $mConverter; // LanguageConverter object |
Index: trunk/phase3/languages/messages/MessagesZh_hans.php |
— | — | @@ -67,7 +67,6 @@ |
68 | 68 | 'Preferences' => array( '参数设置' ), |
69 | 69 | 'Watchlist' => array( '监视列表' ), |
70 | 70 | 'Recentchanges' => array( '最近更改' ), |
71 | | - 'Recentchangeslinked' => array( '链出更改' ), |
72 | 71 | 'Upload' => array( '上传文件' ), |
73 | 72 | 'Listfiles' => array( '文件列表' ), |
74 | 73 | 'Newimages' => array( '新建文件' ), |
— | — | @@ -80,7 +79,7 @@ |
81 | 80 | 'Uncategorizedcategories' => array( '未归类分类' ), |
82 | 81 | 'Uncategorizedimages' => array( '未归类文件' ), |
83 | 82 | 'Uncategorizedtemplates' => array( '未归类模版' ), |
84 | | - 'Unusedcategories' => array( '未使用分类' ), |
| 83 | + 'Unusedcategories' => array( '未使用的模板' ), |
85 | 84 | 'Unusedimages' => array( '未使用文件' ), |
86 | 85 | 'Wantedpages' => array( '待撰页面' ), |
87 | 86 | 'Wantedcategories' => array( '待撰分类' ), |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -39,10 +39,6 @@ |
40 | 40 | * (bug 16852) padleft and padright now accept multiletter pad characters |
41 | 41 | |
42 | 42 | === Bug fixes in 1.15 === |
43 | | -* Fixing the caching issue by using -{T|xxx}- syntax (only applies on wiki with |
44 | | - LanguageConverter class) |
45 | | -* Improving the efficiency by using -{A|xxx}- syntax (only applies on wiki with |
46 | | - LanguageConverter class) |
47 | 43 | * (bug 16968) Special:Upload no longer throws useless warnings. |
48 | 44 | * (bug 15470) Special:Upload no longer force-capitalizes titles |
49 | 45 | * (bug 17000) Special:RevisionDelete now checks if the database is locked before |