Index: trunk/phase3/maintenance/install.php |
— | — | @@ -30,8 +30,8 @@ |
31 | 31 | |
32 | 32 | $this->addArg( 'name', 'The name of the wiki', true); |
33 | 33 | |
34 | | - $this->addArg( 'admin', 'The username of the wiki administrator (WikiSysop)', false); |
35 | | - $this->addOption( 'pass', 'The password for the wiki administrator. You will be prompted for this if it isn\'t provided', false, true); |
| 34 | + $this->addArg( 'admin', 'The username of the wiki administrator (WikiSysop)', true); |
| 35 | + $this->addOption( 'pass', 'The password for the wiki administrator. You will be prompted for this if it isn\'t provided', false, true); |
36 | 36 | $this->addOption( 'email', 'The email for the wiki administrator', false, true); |
37 | 37 | |
38 | 38 | $this->addOption( 'lang', 'The language to use (en)', false, true ); |
Index: trunk/phase3/includes/parser/ParserCache.php |
— | — | @@ -4,6 +4,8 @@ |
5 | 5 | * @todo document |
6 | 6 | */ |
7 | 7 | class ParserCache { |
| 8 | + private $mMemc; |
| 9 | + |
8 | 10 | /** |
9 | 11 | * Get an instance of this object |
10 | 12 | */ |
— | — | @@ -23,6 +25,10 @@ |
24 | 26 | * @param $memCached Object |
25 | 27 | */ |
26 | 28 | function __construct( $memCached ) { |
| 29 | + if ( !$memCached ) { |
| 30 | + global $parserMemc; |
| 31 | + $parserMemc = $memCached = wfGetParserCacheStorage(); |
| 32 | + } |
27 | 33 | $this->mMemc = $memCached; |
28 | 34 | } |
29 | 35 | |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -17,30 +17,30 @@ |
18 | 18 | * usually the same, but they are now allowed to be different. |
19 | 19 | */ |
20 | 20 | class EditPage { |
21 | | - const AS_SUCCESS_UPDATE = 200; |
22 | | - const AS_SUCCESS_NEW_ARTICLE = 201; |
23 | | - const AS_HOOK_ERROR = 210; |
24 | | - const AS_FILTERING = 211; |
25 | | - const AS_HOOK_ERROR_EXPECTED = 212; |
26 | | - const AS_BLOCKED_PAGE_FOR_USER = 215; |
27 | | - const AS_CONTENT_TOO_BIG = 216; |
28 | | - const AS_USER_CANNOT_EDIT = 217; |
29 | | - const AS_READ_ONLY_PAGE_ANON = 218; |
30 | | - const AS_READ_ONLY_PAGE_LOGGED = 219; |
31 | | - const AS_READ_ONLY_PAGE = 220; |
32 | | - const AS_RATE_LIMITED = 221; |
33 | | - const AS_ARTICLE_WAS_DELETED = 222; |
34 | | - const AS_NO_CREATE_PERMISSION = 223; |
35 | | - const AS_BLANK_ARTICLE = 224; |
36 | | - const AS_CONFLICT_DETECTED = 225; |
37 | | - const AS_SUMMARY_NEEDED = 226; |
38 | | - const AS_TEXTBOX_EMPTY = 228; |
| 21 | + const AS_SUCCESS_UPDATE = 200; |
| 22 | + const AS_SUCCESS_NEW_ARTICLE = 201; |
| 23 | + const AS_HOOK_ERROR = 210; |
| 24 | + const AS_FILTERING = 211; |
| 25 | + const AS_HOOK_ERROR_EXPECTED = 212; |
| 26 | + const AS_BLOCKED_PAGE_FOR_USER = 215; |
| 27 | + const AS_CONTENT_TOO_BIG = 216; |
| 28 | + const AS_USER_CANNOT_EDIT = 217; |
| 29 | + const AS_READ_ONLY_PAGE_ANON = 218; |
| 30 | + const AS_READ_ONLY_PAGE_LOGGED = 219; |
| 31 | + const AS_READ_ONLY_PAGE = 220; |
| 32 | + const AS_RATE_LIMITED = 221; |
| 33 | + const AS_ARTICLE_WAS_DELETED = 222; |
| 34 | + const AS_NO_CREATE_PERMISSION = 223; |
| 35 | + const AS_BLANK_ARTICLE = 224; |
| 36 | + const AS_CONFLICT_DETECTED = 225; |
| 37 | + const AS_SUMMARY_NEEDED = 226; |
| 38 | + const AS_TEXTBOX_EMPTY = 228; |
39 | 39 | const AS_MAX_ARTICLE_SIZE_EXCEEDED = 229; |
40 | | - const AS_OK = 230; |
41 | | - const AS_END = 231; |
42 | | - const AS_SPAM_ERROR = 232; |
43 | | - const AS_IMAGE_REDIRECT_ANON = 233; |
44 | | - const AS_IMAGE_REDIRECT_LOGGED = 234; |
| 40 | + const AS_OK = 230; |
| 41 | + const AS_END = 231; |
| 42 | + const AS_SPAM_ERROR = 232; |
| 43 | + const AS_IMAGE_REDIRECT_ANON = 233; |
| 44 | + const AS_IMAGE_REDIRECT_LOGGED = 234; |
45 | 45 | |
46 | 46 | var $mArticle; |
47 | 47 | var $mTitle; |
— | — | @@ -129,8 +129,8 @@ |
130 | 130 | wfProfileIn( __METHOD__ ); |
131 | 131 | # Get variables from query string :P |
132 | 132 | $section = $wgRequest->getVal( 'section' ); |
133 | | - |
134 | | - $preload = $wgRequest->getVal( 'preload', |
| 133 | + |
| 134 | + $preload = $wgRequest->getVal( 'preload', |
135 | 135 | // Custom preload text for new sections |
136 | 136 | $section === 'new' ? 'MediaWiki:addsection-preload' : '' ); |
137 | 137 | $undoafter = $wgRequest->getVal( 'undoafter' ); |
— | — | @@ -287,7 +287,7 @@ |
288 | 288 | * |
289 | 289 | * The edit form is self-submitting, so that when things like |
290 | 290 | * preview and edit conflicts occur, we get the same form back |
291 | | - * with the extra stuff added. Only when the final submission |
| 291 | + * with the extra stuff added. Only when the final submission |
292 | 292 | * is made and all is well do we actually save and redirect to |
293 | 293 | * the newly-edited page. |
294 | 294 | */ |
— | — | @@ -320,7 +320,7 @@ |
321 | 321 | } |
322 | 322 | |
323 | 323 | $wgOut->addScriptFile( 'edit.js' ); |
324 | | - |
| 324 | + |
325 | 325 | if ( $wgUser->getOption( 'uselivepreview', false ) ) { |
326 | 326 | $wgOut->includeJQuery(); |
327 | 327 | $wgOut->addScriptFile( 'preview.js' ); |
— | — | @@ -360,9 +360,9 @@ |
361 | 361 | |
362 | 362 | $this->isConflict = false; |
363 | 363 | // css / js subpages of user pages get a special treatment |
364 | | - $this->isCssJsSubpage = $this->mTitle->isCssJsSubpage(); |
365 | | - $this->isCssSubpage = $this->mTitle->isCssSubpage(); |
366 | | - $this->isJsSubpage = $this->mTitle->isJsSubpage(); |
| 364 | + $this->isCssJsSubpage = $this->mTitle->isCssJsSubpage(); |
| 365 | + $this->isCssSubpage = $this->mTitle->isCssSubpage(); |
| 366 | + $this->isJsSubpage = $this->mTitle->isJsSubpage(); |
367 | 367 | $this->isValidCssJsSubpage = $this->mTitle->isValidCssJsSubpage(); |
368 | 368 | |
369 | 369 | # Show applicable editing introductions |
— | — | @@ -374,9 +374,9 @@ |
375 | 375 | } |
376 | 376 | |
377 | 377 | # Optional notices on a per-namespace and per-page basis |
378 | | - $editnotice_ns = 'editnotice-'.$this->mTitle->getNamespace(); |
| 378 | + $editnotice_ns = 'editnotice-'.$this->mTitle->getNamespace(); |
379 | 379 | if ( !wfEmptyMsg( $editnotice_ns, wfMsgForContent( $editnotice_ns ) ) ) { |
380 | | - $wgOut->addWikiText( wfMsgForContent( $editnotice_ns ) ); |
| 380 | + $wgOut->addWikiText( wfMsgForContent( $editnotice_ns ) ); |
381 | 381 | } |
382 | 382 | if ( MWNamespace::hasSubpages( $this->mTitle->getNamespace() ) ) { |
383 | 383 | $parts = explode( '/', $this->mTitle->getDBkey() ); |
— | — | @@ -389,7 +389,7 @@ |
390 | 390 | } |
391 | 391 | } |
392 | 392 | |
393 | | - # Attempt submission here. This will check for edit conflicts, |
| 393 | + # Attempt submission here. This will check for edit conflicts, |
394 | 394 | # and redundantly check for locked database, blocked IPs, etc. |
395 | 395 | # that edit() already checked just in case someone tries to sneak |
396 | 396 | # in the back door with a hand-edited submission URL. |
— | — | @@ -493,7 +493,7 @@ |
494 | 494 | /** |
495 | 495 | * Does this EditPage class support section editing? |
496 | 496 | * This is used by EditPage subclasses to indicate their ui cannot handle section edits |
497 | | - * |
| 497 | + * |
498 | 498 | * @return bool |
499 | 499 | */ |
500 | 500 | protected function isSectionEditSupported() { |
— | — | @@ -505,7 +505,7 @@ |
506 | 506 | * This is used by EditPage subclasses when simply customizing the action |
507 | 507 | * variable in the constructor is not enough. This can be used when the |
508 | 508 | * EditPage lives inside of a Special page rather than a custom page action. |
509 | | - * |
| 509 | + * |
510 | 510 | * @param $title Title object for which is being edited (where we go to for &action= links) |
511 | 511 | * @return string |
512 | 512 | */ |
— | — | @@ -591,7 +591,7 @@ |
592 | 592 | $this->starttime = null; |
593 | 593 | } |
594 | 594 | |
595 | | - $this->recreate = $request->getCheck( 'wpRecreate' ); |
| 595 | + $this->recreate = $request->getCheck( 'wpRecreate' ); |
596 | 596 | |
597 | 597 | $this->minoredit = $request->getCheck( 'wpMinoredit' ); |
598 | 598 | $this->watchthis = $request->getCheck( 'wpWatchthis' ); |
— | — | @@ -609,17 +609,17 @@ |
610 | 610 | } else { |
611 | 611 | # Not a posted form? Start with nothing. |
612 | 612 | wfDebug( __METHOD__ . ": Not a posted form.\n" ); |
613 | | - $this->textbox1 = ''; |
614 | | - $this->summary = ''; |
615 | | - $this->edittime = ''; |
| 613 | + $this->textbox1 = ''; |
| 614 | + $this->summary = ''; |
| 615 | + $this->edittime = ''; |
616 | 616 | $this->starttime = wfTimestampNow(); |
617 | | - $this->edit = false; |
618 | | - $this->preview = false; |
619 | | - $this->save = false; |
620 | | - $this->diff = false; |
| 617 | + $this->edit = false; |
| 618 | + $this->preview = false; |
| 619 | + $this->save = false; |
| 620 | + $this->diff = false; |
621 | 621 | $this->minoredit = false; |
622 | 622 | $this->watchthis = $request->getBool( 'watchthis', false ); // Watch may be overriden by request parameters |
623 | | - $this->recreate = false; |
| 623 | + $this->recreate = false; |
624 | 624 | |
625 | 625 | if ( $this->section == 'new' && $request->getVal( 'preloadtitle' ) ) { |
626 | 626 | $this->summary = $request->getVal( 'preloadtitle' ); |
— | — | @@ -655,7 +655,7 @@ |
656 | 656 | * posted form to be placed in $this->textbox1, if using customized input |
657 | 657 | * this method should be overrided and return the page text that will be used |
658 | 658 | * for saving, preview parsing and so on... |
659 | | - * |
| 659 | + * |
660 | 660 | * @param $request WebRequest |
661 | 661 | */ |
662 | 662 | protected function importContentFormData( &$request ) { |
— | — | @@ -768,7 +768,7 @@ |
769 | 769 | global $wgFilterCallback, $wgUser, $wgOut, $wgParser; |
770 | 770 | global $wgMaxArticleSize; |
771 | 771 | |
772 | | - wfProfileIn( __METHOD__ ); |
| 772 | + wfProfileIn( __METHOD__ ); |
773 | 773 | wfProfileIn( __METHOD__ . '-checks' ); |
774 | 774 | |
775 | 775 | if ( !wfRunHooks( 'EditPage::attemptSave', array( $this ) ) ) { |
— | — | @@ -1064,11 +1064,10 @@ |
1065 | 1065 | $flags = EDIT_UPDATE | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY | |
1066 | 1066 | ( $this->minoredit ? EDIT_MINOR : 0 ) | |
1067 | 1067 | ( $bot ? EDIT_FORCE_BOT : 0 ); |
1068 | | - $status = $this->mArticle->doEdit( $text, $this->summary, $flags, |
| 1068 | + $status = $this->mArticle->doEdit( $text, $this->summary, $flags, |
1069 | 1069 | false, null, $this->watchthis, false, $sectionanchor, true ); |
1070 | | - |
1071 | | - if ( $status->isOK() ) |
1072 | | - { |
| 1070 | + |
| 1071 | + if ( $status->isOK() ) { |
1073 | 1072 | wfProfileOut( __METHOD__ ); |
1074 | 1073 | return self::AS_SUCCESS_UPDATE; |
1075 | 1074 | } else { |
— | — | @@ -1186,8 +1185,8 @@ |
1187 | 1186 | /** |
1188 | 1187 | * Send the edit form and related headers to $wgOut |
1189 | 1188 | * @param $formCallback Optional callable that takes an OutputPage |
1190 | | - * parameter; will be called during form output |
1191 | | - * near the top, for captchas and the like. |
| 1189 | + * parameter; will be called during form output |
| 1190 | + * near the top, for captchas and the like. |
1192 | 1191 | */ |
1193 | 1192 | function showEditForm( $formCallback=null ) { |
1194 | 1193 | global $wgOut, $wgUser, $wgTitle; |
— | — | @@ -1303,7 +1302,7 @@ |
1304 | 1303 | } |
1305 | 1304 | |
1306 | 1305 | $wgOut->addHTML( $this->editFormTextBeforeContent ); |
1307 | | - |
| 1306 | + |
1308 | 1307 | if ( $this->isConflict ) { |
1309 | 1308 | // In an edit conflict bypass the overrideable content form method |
1310 | 1309 | // and fallback to the raw wpTextbox1 since editconflicts can't be |
— | — | @@ -1340,7 +1339,7 @@ |
1341 | 1340 | |
1342 | 1341 | if ( $this->isConflict ) |
1343 | 1342 | $this->showConflict(); |
1344 | | - |
| 1343 | + |
1345 | 1344 | $wgOut->addHTML( $this->editFormTextBottom ); |
1346 | 1345 | $wgOut->addHTML( "</form>\n" ); |
1347 | 1346 | if ( !$wgUser->getOption( 'previewontop' ) ) { |
— | — | @@ -1349,7 +1348,7 @@ |
1350 | 1349 | |
1351 | 1350 | wfProfileOut( __METHOD__ ); |
1352 | 1351 | } |
1353 | | - |
| 1352 | + |
1354 | 1353 | protected function showHeader() { |
1355 | 1354 | global $wgOut, $wgUser, $wgTitle, $wgMaxArticleSize, $wgLang; |
1356 | 1355 | if ( $this->isConflict ) { |
— | — | @@ -1463,7 +1462,7 @@ |
1464 | 1463 | } |
1465 | 1464 | if ( !$this->mTitle->exists() && $this->mTitle->getRestrictions( 'create' ) ) { |
1466 | 1465 | LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle->getPrefixedText(), '', |
1467 | | - array( 'lim' => 1, |
| 1466 | + array( 'lim' => 1, |
1468 | 1467 | 'showIfEmpty' => false, |
1469 | 1468 | 'msgKey' => array( 'titleprotectedwarning' ), |
1470 | 1469 | 'wrap' => "<div class=\"mw-titleprotectedwarning\">\n$1</div>" ) ); |
— | — | @@ -1490,12 +1489,12 @@ |
1491 | 1490 | * Note that you do not need to worry about the label's for=, it will be |
1492 | 1491 | * inferred by the id given to the input. You can remove them both by |
1493 | 1492 | * passing array( 'id' => false ) to $userInputAttrs. |
1494 | | - * |
| 1493 | + * |
1495 | 1494 | * @param $summary The value of the summary input |
1496 | 1495 | * @param $labelText The html to place inside the label |
1497 | 1496 | * @param $inputAttrs An array of attrs to use on the input |
1498 | 1497 | * @param $spanLabelAttrs An array of attrs to use on the span inside the label |
1499 | | - * |
| 1498 | + * |
1500 | 1499 | * @return array An array in the format array( $label, $input ) |
1501 | 1500 | */ |
1502 | 1501 | function getSummaryInput($summary = "", $labelText = null, $inputAttrs = null, $spanLabelAttrs = null) { |
— | — | @@ -1527,8 +1526,8 @@ |
1528 | 1527 | |
1529 | 1528 | /** |
1530 | 1529 | * @param $isSubjectPreview Boolean: true if this is the section subject/title |
1531 | | - * up top, or false if this is the comment summary |
1532 | | - * down below the textarea |
| 1530 | + * up top, or false if this is the comment summary |
| 1531 | + * down below the textarea |
1533 | 1532 | * @param $summary String: The text of the summary to display |
1534 | 1533 | * @return String |
1535 | 1534 | */ |
— | — | @@ -1551,18 +1550,18 @@ |
1552 | 1551 | |
1553 | 1552 | /** |
1554 | 1553 | * @param $isSubjectPreview Boolean: true if this is the section subject/title |
1555 | | - * up top, or false if this is the comment summary |
1556 | | - * down below the textarea |
| 1554 | + * up top, or false if this is the comment summary |
| 1555 | + * down below the textarea |
1557 | 1556 | * @param $summary String: the text of the summary to display |
1558 | 1557 | * @return String |
1559 | 1558 | */ |
1560 | 1559 | protected function getSummaryPreview( $isSubjectPreview, $summary = "" ) { |
1561 | 1560 | if ( !$summary || ( !$this->preview && !$this->diff ) ) |
1562 | 1561 | return ""; |
1563 | | - |
| 1562 | + |
1564 | 1563 | global $wgParser, $wgUser; |
1565 | 1564 | $sk = $wgUser->getSkin(); |
1566 | | - |
| 1565 | + |
1567 | 1566 | if ( $isSubjectPreview ) |
1568 | 1567 | $summary = wfMsgForContent( 'newsectionsummary', $wgParser->stripSectionName( $summary ) ); |
1569 | 1568 | |
— | — | @@ -1586,7 +1585,7 @@ |
1587 | 1586 | if ( !$this->checkUnicodeCompliantBrowser() ) |
1588 | 1587 | $wgOut->addHTML(Xml::hidden( 'safemode', '1' )); |
1589 | 1588 | } |
1590 | | - |
| 1589 | + |
1591 | 1590 | protected function showFormAfterText() { |
1592 | 1591 | global $wgOut, $wgUser; |
1593 | 1592 | /** |
— | — | @@ -1611,7 +1610,7 @@ |
1612 | 1611 | * be it a form, or simply wpTextbox1 with a modified content that will be |
1613 | 1612 | * reverse modified when extracted from the post data. |
1614 | 1613 | * Note that this is basically the inverse for importContentFormData |
1615 | | - * |
| 1614 | + * |
1616 | 1615 | * @param $request WebRequest |
1617 | 1616 | */ |
1618 | 1617 | protected function showContentForm() { |
— | — | @@ -1622,7 +1621,7 @@ |
1623 | 1622 | * Method to output wpTextbox1 |
1624 | 1623 | * The $textoverride method can be used by subclasses overriding showContentForm |
1625 | 1624 | * to pass back to this method. |
1626 | | - * |
| 1625 | + * |
1627 | 1626 | * @param $customAttribs An array of html attributes to use in the textarea |
1628 | 1627 | * @param $textoverride String: optional text to override $this->textarea1 with |
1629 | 1628 | */ |
— | — | @@ -1648,7 +1647,7 @@ |
1649 | 1648 | $classes[] = $attribs['class']; |
1650 | 1649 | $attribs['class'] = implode( ' ', $classes ); |
1651 | 1650 | } |
1652 | | - |
| 1651 | + |
1653 | 1652 | $this->showTextbox( isset($textoverride) ? $textoverride : $this->textbox1, 'wpTextbox1', $attribs ); |
1654 | 1653 | } |
1655 | 1654 | |
— | — | @@ -1671,7 +1670,7 @@ |
1672 | 1671 | $attribs = $customAttribs + array( |
1673 | 1672 | 'accesskey' => ',', |
1674 | 1673 | 'id' => $name, |
1675 | | - 'cols' => $wgUser->getIntOption( 'cols' ), |
| 1674 | + 'cols' => $wgUser->getIntOption( 'cols' ), |
1676 | 1675 | 'rows' => $wgUser->getIntOption( 'rows' ), |
1677 | 1676 | 'style' => '' // avoid php notices when appending preferences (appending allows customAttribs['style'] to still work |
1678 | 1677 | ); |
— | — | @@ -1727,7 +1726,7 @@ |
1728 | 1727 | * Give a chance for site and per-namespace customizations of |
1729 | 1728 | * terms of service summary link that might exist separately |
1730 | 1729 | * from the copyright notice. |
1731 | | - * |
| 1730 | + * |
1732 | 1731 | * This will display between the save button and the edit tools, |
1733 | 1732 | * so should remain short! |
1734 | 1733 | */ |
— | — | @@ -1749,7 +1748,7 @@ |
1750 | 1749 | $wgOut->addWikiMsgArray( 'edittools', array(), array( 'content' ) ); |
1751 | 1750 | $wgOut->addHTML( '</div>' ); |
1752 | 1751 | } |
1753 | | - |
| 1752 | + |
1754 | 1753 | protected function getCopywarn() { |
1755 | 1754 | global $wgRightsText; |
1756 | 1755 | if ( $wgRightsText ) { |
— | — | @@ -1762,10 +1761,10 @@ |
1763 | 1762 | } |
1764 | 1763 | // Allow for site and per-namespace customization of contribution/copyright notice. |
1765 | 1764 | wfRunHooks( 'EditPageCopyrightWarning', array( $this->mTitle, &$copywarnMsg ) ); |
1766 | | - |
| 1765 | + |
1767 | 1766 | return "<div id=\"editpage-copywarn\">\n" . call_user_func_array("wfMsgNoTrans", $copywarnMsg) . "\n</div>"; |
1768 | 1767 | } |
1769 | | - |
| 1768 | + |
1770 | 1769 | protected function showStandardInputs( &$tabindex = 2 ) { |
1771 | 1770 | global $wgOut, $wgUser; |
1772 | 1771 | $wgOut->addHTML( "<div class='editOptions'>\n" ); |
— | — | @@ -1816,20 +1815,20 @@ |
1817 | 1816 | $data = $dbr->selectRow( |
1818 | 1817 | array( 'logging', 'user' ), |
1819 | 1818 | array( 'log_type', |
1820 | | - 'log_action', |
1821 | | - 'log_timestamp', |
1822 | | - 'log_user', |
1823 | | - 'log_namespace', |
1824 | | - 'log_title', |
1825 | | - 'log_comment', |
1826 | | - 'log_params', |
1827 | | - 'log_deleted', |
1828 | | - 'user_name' ), |
| 1819 | + 'log_action', |
| 1820 | + 'log_timestamp', |
| 1821 | + 'log_user', |
| 1822 | + 'log_namespace', |
| 1823 | + 'log_title', |
| 1824 | + 'log_comment', |
| 1825 | + 'log_params', |
| 1826 | + 'log_deleted', |
| 1827 | + 'user_name' ), |
1829 | 1828 | array( 'log_namespace' => $this->mTitle->getNamespace(), |
1830 | | - 'log_title' => $this->mTitle->getDBkey(), |
1831 | | - 'log_type' => 'delete', |
1832 | | - 'log_action' => 'delete', |
1833 | | - 'user_id=log_user' ), |
| 1829 | + 'log_title' => $this->mTitle->getDBkey(), |
| 1830 | + 'log_type' => 'delete', |
| 1831 | + 'log_action' => 'delete', |
| 1832 | + 'user_id=log_user' ), |
1834 | 1833 | __METHOD__, |
1835 | 1834 | array( 'LIMIT' => 1, 'ORDER BY' => 'log_timestamp DESC' ) |
1836 | 1835 | ); |
— | — | @@ -2139,103 +2138,103 @@ |
2140 | 2139 | */ |
2141 | 2140 | $toolarray = array( |
2142 | 2141 | array( |
2143 | | - 'image' => $wgLang->getImageFile( 'button-bold' ), |
2144 | | - 'id' => 'mw-editbutton-bold', |
2145 | | - 'open' => '\'\'\'', |
2146 | | - 'close' => '\'\'\'', |
| 2142 | + 'image' => $wgLang->getImageFile( 'button-bold' ), |
| 2143 | + 'id' => 'mw-editbutton-bold', |
| 2144 | + 'open' => '\'\'\'', |
| 2145 | + 'close' => '\'\'\'', |
2147 | 2146 | 'sample' => wfMsg( 'bold_sample' ), |
2148 | | - 'tip' => wfMsg( 'bold_tip' ), |
2149 | | - 'key' => 'B' |
| 2147 | + 'tip' => wfMsg( 'bold_tip' ), |
| 2148 | + 'key' => 'B' |
2150 | 2149 | ), |
2151 | 2150 | array( |
2152 | | - 'image' => $wgLang->getImageFile( 'button-italic' ), |
2153 | | - 'id' => 'mw-editbutton-italic', |
2154 | | - 'open' => '\'\'', |
2155 | | - 'close' => '\'\'', |
| 2151 | + 'image' => $wgLang->getImageFile( 'button-italic' ), |
| 2152 | + 'id' => 'mw-editbutton-italic', |
| 2153 | + 'open' => '\'\'', |
| 2154 | + 'close' => '\'\'', |
2156 | 2155 | 'sample' => wfMsg( 'italic_sample' ), |
2157 | | - 'tip' => wfMsg( 'italic_tip' ), |
2158 | | - 'key' => 'I' |
| 2156 | + 'tip' => wfMsg( 'italic_tip' ), |
| 2157 | + 'key' => 'I' |
2159 | 2158 | ), |
2160 | 2159 | array( |
2161 | | - 'image' => $wgLang->getImageFile( 'button-link' ), |
2162 | | - 'id' => 'mw-editbutton-link', |
2163 | | - 'open' => '[[', |
2164 | | - 'close' => ']]', |
| 2160 | + 'image' => $wgLang->getImageFile( 'button-link' ), |
| 2161 | + 'id' => 'mw-editbutton-link', |
| 2162 | + 'open' => '[[', |
| 2163 | + 'close' => ']]', |
2165 | 2164 | 'sample' => wfMsg( 'link_sample' ), |
2166 | | - 'tip' => wfMsg( 'link_tip' ), |
2167 | | - 'key' => 'L' |
| 2165 | + 'tip' => wfMsg( 'link_tip' ), |
| 2166 | + 'key' => 'L' |
2168 | 2167 | ), |
2169 | 2168 | array( |
2170 | | - 'image' => $wgLang->getImageFile( 'button-extlink' ), |
2171 | | - 'id' => 'mw-editbutton-extlink', |
2172 | | - 'open' => '[', |
2173 | | - 'close' => ']', |
| 2169 | + 'image' => $wgLang->getImageFile( 'button-extlink' ), |
| 2170 | + 'id' => 'mw-editbutton-extlink', |
| 2171 | + 'open' => '[', |
| 2172 | + 'close' => ']', |
2174 | 2173 | 'sample' => wfMsg( 'extlink_sample' ), |
2175 | | - 'tip' => wfMsg( 'extlink_tip' ), |
2176 | | - 'key' => 'X' |
| 2174 | + 'tip' => wfMsg( 'extlink_tip' ), |
| 2175 | + 'key' => 'X' |
2177 | 2176 | ), |
2178 | 2177 | array( |
2179 | | - 'image' => $wgLang->getImageFile( 'button-headline' ), |
2180 | | - 'id' => 'mw-editbutton-headline', |
2181 | | - 'open' => "\n== ", |
2182 | | - 'close' => " ==\n", |
| 2178 | + 'image' => $wgLang->getImageFile( 'button-headline' ), |
| 2179 | + 'id' => 'mw-editbutton-headline', |
| 2180 | + 'open' => "\n== ", |
| 2181 | + 'close' => " ==\n", |
2183 | 2182 | 'sample' => wfMsg( 'headline_sample' ), |
2184 | | - 'tip' => wfMsg( 'headline_tip' ), |
2185 | | - 'key' => 'H' |
| 2183 | + 'tip' => wfMsg( 'headline_tip' ), |
| 2184 | + 'key' => 'H' |
2186 | 2185 | ), |
2187 | 2186 | array( |
2188 | | - 'image' => $wgLang->getImageFile( 'button-image' ), |
2189 | | - 'id' => 'mw-editbutton-image', |
2190 | | - 'open' => '[[' . $wgContLang->getNsText( NS_FILE ) . ':', |
2191 | | - 'close' => ']]', |
| 2187 | + 'image' => $wgLang->getImageFile( 'button-image' ), |
| 2188 | + 'id' => 'mw-editbutton-image', |
| 2189 | + 'open' => '[[' . $wgContLang->getNsText( NS_FILE ) . ':', |
| 2190 | + 'close' => ']]', |
2192 | 2191 | 'sample' => wfMsg( 'image_sample' ), |
2193 | | - 'tip' => wfMsg( 'image_tip' ), |
2194 | | - 'key' => 'D' |
| 2192 | + 'tip' => wfMsg( 'image_tip' ), |
| 2193 | + 'key' => 'D' |
2195 | 2194 | ), |
2196 | 2195 | array( |
2197 | | - 'image' => $wgLang->getImageFile( 'button-media' ), |
2198 | | - 'id' => 'mw-editbutton-media', |
2199 | | - 'open' => '[[' . $wgContLang->getNsText( NS_MEDIA ) . ':', |
2200 | | - 'close' => ']]', |
| 2196 | + 'image' => $wgLang->getImageFile( 'button-media' ), |
| 2197 | + 'id' => 'mw-editbutton-media', |
| 2198 | + 'open' => '[[' . $wgContLang->getNsText( NS_MEDIA ) . ':', |
| 2199 | + 'close' => ']]', |
2201 | 2200 | 'sample' => wfMsg( 'media_sample' ), |
2202 | | - 'tip' => wfMsg( 'media_tip' ), |
2203 | | - 'key' => 'M' |
| 2201 | + 'tip' => wfMsg( 'media_tip' ), |
| 2202 | + 'key' => 'M' |
2204 | 2203 | ), |
2205 | 2204 | array( |
2206 | | - 'image' => $wgLang->getImageFile( 'button-math' ), |
2207 | | - 'id' => 'mw-editbutton-math', |
2208 | | - 'open' => "<math>", |
2209 | | - 'close' => "</math>", |
| 2205 | + 'image' => $wgLang->getImageFile( 'button-math' ), |
| 2206 | + 'id' => 'mw-editbutton-math', |
| 2207 | + 'open' => "<math>", |
| 2208 | + 'close' => "</math>", |
2210 | 2209 | 'sample' => wfMsg( 'math_sample' ), |
2211 | | - 'tip' => wfMsg( 'math_tip' ), |
2212 | | - 'key' => 'C' |
| 2210 | + 'tip' => wfMsg( 'math_tip' ), |
| 2211 | + 'key' => 'C' |
2213 | 2212 | ), |
2214 | 2213 | array( |
2215 | | - 'image' => $wgLang->getImageFile( 'button-nowiki' ), |
2216 | | - 'id' => 'mw-editbutton-nowiki', |
2217 | | - 'open' => "<nowiki>", |
2218 | | - 'close' => "</nowiki>", |
| 2214 | + 'image' => $wgLang->getImageFile( 'button-nowiki' ), |
| 2215 | + 'id' => 'mw-editbutton-nowiki', |
| 2216 | + 'open' => "<nowiki>", |
| 2217 | + 'close' => "</nowiki>", |
2219 | 2218 | 'sample' => wfMsg( 'nowiki_sample' ), |
2220 | | - 'tip' => wfMsg( 'nowiki_tip' ), |
2221 | | - 'key' => 'N' |
| 2219 | + 'tip' => wfMsg( 'nowiki_tip' ), |
| 2220 | + 'key' => 'N' |
2222 | 2221 | ), |
2223 | 2222 | array( |
2224 | | - 'image' => $wgLang->getImageFile( 'button-sig' ), |
2225 | | - 'id' => 'mw-editbutton-signature', |
2226 | | - 'open' => '--~~~~', |
2227 | | - 'close' => '', |
| 2223 | + 'image' => $wgLang->getImageFile( 'button-sig' ), |
| 2224 | + 'id' => 'mw-editbutton-signature', |
| 2225 | + 'open' => '--~~~~', |
| 2226 | + 'close' => '', |
2228 | 2227 | 'sample' => '', |
2229 | | - 'tip' => wfMsg( 'sig_tip' ), |
2230 | | - 'key' => 'Y' |
| 2228 | + 'tip' => wfMsg( 'sig_tip' ), |
| 2229 | + 'key' => 'Y' |
2231 | 2230 | ), |
2232 | 2231 | array( |
2233 | | - 'image' => $wgLang->getImageFile( 'button-hr' ), |
2234 | | - 'id' => 'mw-editbutton-hr', |
2235 | | - 'open' => "\n----\n", |
2236 | | - 'close' => '', |
| 2232 | + 'image' => $wgLang->getImageFile( 'button-hr' ), |
| 2233 | + 'id' => 'mw-editbutton-hr', |
| 2234 | + 'open' => "\n----\n", |
| 2235 | + 'close' => '', |
2237 | 2236 | 'sample' => '', |
2238 | | - 'tip' => wfMsg( 'hr_tip' ), |
2239 | | - 'key' => 'R' |
| 2237 | + 'tip' => wfMsg( 'hr_tip' ), |
| 2238 | + 'key' => 'R' |
2240 | 2239 | ) |
2241 | 2240 | ); |
2242 | 2241 | $toolbar = "<div id='toolbar'>\n"; |
— | — | @@ -2275,7 +2274,7 @@ |
2276 | 2275 | * @param $tabindex Current tabindex |
2277 | 2276 | * @param $skin Skin object |
2278 | 2277 | * @param $checked Array of checkbox => bool, where bool indicates the checked |
2279 | | - * status of the checkbox |
| 2278 | + * status of the checkbox |
2280 | 2279 | * |
2281 | 2280 | * @return array |
2282 | 2281 | */ |
— | — | @@ -2288,9 +2287,9 @@ |
2289 | 2288 | $minorLabel = wfMsgExt( 'minoredit', array( 'parseinline' ) ); |
2290 | 2289 | if ( $wgUser->isAllowed( 'minoredit' ) ) { |
2291 | 2290 | $attribs = array( |
2292 | | - 'tabindex' => ++$tabindex, |
| 2291 | + 'tabindex' => ++$tabindex, |
2293 | 2292 | 'accesskey' => wfMsg( 'accesskey-minoredit' ), |
2294 | | - 'id' => 'wpMinoredit', |
| 2293 | + 'id' => 'wpMinoredit', |
2295 | 2294 | ); |
2296 | 2295 | $checkboxes['minor'] = |
2297 | 2296 | Xml::check( 'wpMinoredit', $checked['minor'], $attribs ) . |
— | — | @@ -2301,9 +2300,9 @@ |
2302 | 2301 | $checkboxes['watch'] = ''; |
2303 | 2302 | if ( $wgUser->isLoggedIn() ) { |
2304 | 2303 | $attribs = array( |
2305 | | - 'tabindex' => ++$tabindex, |
| 2304 | + 'tabindex' => ++$tabindex, |
2306 | 2305 | 'accesskey' => wfMsg( 'accesskey-watch' ), |
2307 | | - 'id' => 'wpWatchthis', |
| 2306 | + 'id' => 'wpWatchthis', |
2308 | 2307 | ); |
2309 | 2308 | $checkboxes['watch'] = |
2310 | 2309 | Xml::check( 'wpWatchthis', $checked['watch'], $attribs ) . |
— | — | @@ -2325,37 +2324,37 @@ |
2326 | 2325 | $buttons = array(); |
2327 | 2326 | |
2328 | 2327 | $temp = array( |
2329 | | - 'id' => 'wpSave', |
2330 | | - 'name' => 'wpSave', |
2331 | | - 'type' => 'submit', |
2332 | | - 'tabindex' => ++$tabindex, |
2333 | | - 'value' => wfMsg( 'savearticle' ), |
| 2328 | + 'id' => 'wpSave', |
| 2329 | + 'name' => 'wpSave', |
| 2330 | + 'type' => 'submit', |
| 2331 | + 'tabindex' => ++$tabindex, |
| 2332 | + 'value' => wfMsg( 'savearticle' ), |
2334 | 2333 | 'accesskey' => wfMsg( 'accesskey-save' ), |
2335 | | - 'title' => wfMsg( 'tooltip-save' ).' ['.wfMsg( 'accesskey-save' ).']', |
| 2334 | + 'title' => wfMsg( 'tooltip-save' ).' ['.wfMsg( 'accesskey-save' ).']', |
2336 | 2335 | ); |
2337 | 2336 | $buttons['save'] = Xml::element('input', $temp, ''); |
2338 | 2337 | |
2339 | 2338 | ++$tabindex; // use the same for preview and live preview |
2340 | 2339 | $temp = array( |
2341 | | - 'id' => 'wpPreview', |
2342 | | - 'name' => 'wpPreview', |
2343 | | - 'type' => 'submit', |
2344 | | - 'tabindex' => $tabindex, |
2345 | | - 'value' => wfMsg( 'showpreview' ), |
| 2340 | + 'id' => 'wpPreview', |
| 2341 | + 'name' => 'wpPreview', |
| 2342 | + 'type' => 'submit', |
| 2343 | + 'tabindex' => $tabindex, |
| 2344 | + 'value' => wfMsg( 'showpreview' ), |
2346 | 2345 | 'accesskey' => wfMsg( 'accesskey-preview' ), |
2347 | | - 'title' => wfMsg( 'tooltip-preview' ) . ' [' . wfMsg( 'accesskey-preview' ) . ']', |
| 2346 | + 'title' => wfMsg( 'tooltip-preview' ) . ' [' . wfMsg( 'accesskey-preview' ) . ']', |
2348 | 2347 | ); |
2349 | 2348 | $buttons['preview'] = Xml::element( 'input', $temp, '' ); |
2350 | 2349 | $buttons['live'] = ''; |
2351 | 2350 | |
2352 | 2351 | $temp = array( |
2353 | | - 'id' => 'wpDiff', |
2354 | | - 'name' => 'wpDiff', |
2355 | | - 'type' => 'submit', |
2356 | | - 'tabindex' => ++$tabindex, |
2357 | | - 'value' => wfMsg( 'showdiff' ), |
| 2352 | + 'id' => 'wpDiff', |
| 2353 | + 'name' => 'wpDiff', |
| 2354 | + 'type' => 'submit', |
| 2355 | + 'tabindex' => ++$tabindex, |
| 2356 | + 'value' => wfMsg( 'showdiff' ), |
2358 | 2357 | 'accesskey' => wfMsg( 'accesskey-diff' ), |
2359 | | - 'title' => wfMsg( 'tooltip-diff' ) . ' [' . wfMsg( 'accesskey-diff' ) . ']', |
| 2358 | + 'title' => wfMsg( 'tooltip-diff' ) . ' [' . wfMsg( 'accesskey-diff' ) . ']', |
2360 | 2359 | ); |
2361 | 2360 | $buttons['diff'] = Xml::element( 'input', $temp, '' ); |
2362 | 2361 | |
— | — | @@ -2371,9 +2370,9 @@ |
2372 | 2371 | * failure, etc). |
2373 | 2372 | * |
2374 | 2373 | * @todo This doesn't include category or interlanguage links. |
2375 | | - * Would need to enhance it a bit, <s>maybe wrap them in XML |
2376 | | - * or something...</s> that might also require more skin |
2377 | | - * initialization, so check whether that's a problem. |
| 2374 | + * Would need to enhance it a bit, <s>maybe wrap them in XML |
| 2375 | + * or something...</s> that might also require more skin |
| 2376 | + * initialization, so check whether that's a problem. |
2378 | 2377 | */ |
2379 | 2378 | function livePreview() { |
2380 | 2379 | global $wgOut; |
— | — | @@ -2428,7 +2427,7 @@ |
2429 | 2428 | $newtext = $this->mArticle->preSaveTransform( $newtext ); |
2430 | 2429 | $oldtitle = wfMsgExt( 'currentrev', array( 'parseinline' ) ); |
2431 | 2430 | $newtitle = wfMsgExt( 'yourtext', array( 'parseinline' ) ); |
2432 | | - if ( $oldtext !== false || $newtext != '' ) { |
| 2431 | + if ( $oldtext !== false || $newtext != '' ) { |
2433 | 2432 | $de = new DifferenceEngine( $this->mTitle ); |
2434 | 2433 | $de->setText( $oldtext, $newtext ); |
2435 | 2434 | $difftext = $de->getDiff( $oldtitle, $newtitle ); |
— | — | @@ -2588,7 +2587,7 @@ |
2589 | 2588 | switch ( $value ) { |
2590 | 2589 | case self::AS_HOOK_ERROR_EXPECTED: |
2591 | 2590 | case self::AS_CONTENT_TOO_BIG: |
2592 | | - case self::AS_ARTICLE_WAS_DELETED: |
| 2591 | + case self::AS_ARTICLE_WAS_DELETED: |
2593 | 2592 | case self::AS_CONFLICT_DETECTED: |
2594 | 2593 | case self::AS_SUMMARY_NEEDED: |
2595 | 2594 | case self::AS_TEXTBOX_EMPTY: |
— | — | @@ -2618,22 +2617,22 @@ |
2619 | 2618 | $this->userNotLoggedInPage(); |
2620 | 2619 | return false; |
2621 | 2620 | |
2622 | | - case self::AS_READ_ONLY_PAGE_LOGGED: |
2623 | | - case self::AS_READ_ONLY_PAGE: |
2624 | | - $wgOut->readOnlyPage(); |
2625 | | - return false; |
| 2621 | + case self::AS_READ_ONLY_PAGE_LOGGED: |
| 2622 | + case self::AS_READ_ONLY_PAGE: |
| 2623 | + $wgOut->readOnlyPage(); |
| 2624 | + return false; |
2626 | 2625 | |
2627 | | - case self::AS_RATE_LIMITED: |
2628 | | - $wgOut->rateLimited(); |
2629 | | - return false; |
| 2626 | + case self::AS_RATE_LIMITED: |
| 2627 | + $wgOut->rateLimited(); |
| 2628 | + return false; |
2630 | 2629 | |
2631 | | - case self::AS_NO_CREATE_PERMISSION: |
2632 | | - $this->noCreatePermission(); |
2633 | | - return; |
| 2630 | + case self::AS_NO_CREATE_PERMISSION: |
| 2631 | + $this->noCreatePermission(); |
| 2632 | + return; |
2634 | 2633 | |
2635 | 2634 | case self::AS_BLANK_ARTICLE: |
2636 | | - $wgOut->redirect( $wgTitle->getFullURL() ); |
2637 | | - return false; |
| 2635 | + $wgOut->redirect( $wgTitle->getFullURL() ); |
| 2636 | + return false; |
2638 | 2637 | |
2639 | 2638 | case self::AS_IMAGE_REDIRECT_LOGGED: |
2640 | 2639 | $wgOut->permissionRequired( 'upload' ); |
— | — | @@ -2650,5 +2649,5 @@ |
2651 | 2650 | } else { |
2652 | 2651 | return $this->mBaseRevision; |
2653 | 2652 | } |
2654 | | - } |
| 2653 | + } |
2655 | 2654 | } |
Index: trunk/phase3/includes/normal/UtfNormal.php |
— | — | @@ -45,6 +45,7 @@ |
46 | 46 | define( 'UNORM_FCD', 6 ); |
47 | 47 | |
48 | 48 | define( 'NORMALIZE_ICU', function_exists( 'utf8_normalize' ) ); |
| 49 | +define( 'NORMALIZE_INTL', function_exists( 'normalizer_normalize' ) ); |
49 | 50 | |
50 | 51 | /** |
51 | 52 | * Unicode normalization routines for working with UTF-8 strings. |
— | — | @@ -79,7 +80,7 @@ |
80 | 81 | return $ret; |
81 | 82 | } |
82 | 83 | |
83 | | - if( NORMALIZE_ICU ) { |
| 84 | + if( NORMALIZE_ICU || NORMALIZE_INTL ) { |
84 | 85 | # We exclude a few chars that ICU would not. |
85 | 86 | $string = preg_replace( |
86 | 87 | '/[\x00-\x08\x0b\x0c\x0e-\x1f]/', |
— | — | @@ -90,7 +91,8 @@ |
91 | 92 | |
92 | 93 | # UnicodeString constructor fails if the string ends with a |
93 | 94 | # head byte. Add a junk char at the end, we'll strip it off. |
94 | | - return rtrim( utf8_normalize( $string . "\x01", UNORM_NFC ), "\x01" ); |
| 95 | + if ( NORMALIZE_ICU ) return rtrim( utf8_normalize( $string . "\x01", UNORM_NFC ), "\x01" ); |
| 96 | + if ( NORMALIZE_INTL ) return normalizer_normalize( $string, Normalizer::FORM_C ); |
95 | 97 | } elseif( UtfNormal::quickIsNFCVerify( $string ) ) { |
96 | 98 | # Side effect -- $string has had UTF-8 errors cleaned up. |
97 | 99 | return $string; |
— | — | @@ -108,7 +110,9 @@ |
109 | 111 | * @return string a UTF-8 string in normal form C |
110 | 112 | */ |
111 | 113 | static function toNFC( $string ) { |
112 | | - if( NORMALIZE_ICU ) |
| 114 | + if( NORMALIZE_INTL ) |
| 115 | + return normalizer_normalize( $string, Normalizer::FORM_C ); |
| 116 | + elseif( NORMALIZE_ICU ) |
113 | 117 | return utf8_normalize( $string, UNORM_NFC ); |
114 | 118 | elseif( UtfNormal::quickIsNFC( $string ) ) |
115 | 119 | return $string; |
— | — | @@ -124,7 +128,9 @@ |
125 | 129 | * @return string a UTF-8 string in normal form D |
126 | 130 | */ |
127 | 131 | static function toNFD( $string ) { |
128 | | - if( NORMALIZE_ICU ) |
| 132 | + if( NORMALIZE_INTL ) |
| 133 | + return normalizer_normalize( $string, Normalizer::FORM_D ); |
| 134 | + elseif( NORMALIZE_ICU ) |
129 | 135 | return utf8_normalize( $string, UNORM_NFD ); |
130 | 136 | elseif( preg_match( '/[\x80-\xff]/', $string ) ) |
131 | 137 | return UtfNormal::NFD( $string ); |
— | — | @@ -141,7 +147,9 @@ |
142 | 148 | * @return string a UTF-8 string in normal form KC |
143 | 149 | */ |
144 | 150 | static function toNFKC( $string ) { |
145 | | - if( NORMALIZE_ICU ) |
| 151 | + if( NORMALIZE_INTL ) |
| 152 | + return normalizer_normalize( $string, Normalizer::FORM_KC ); |
| 153 | + elseif( NORMALIZE_ICU ) |
146 | 154 | return utf8_normalize( $string, UNORM_NFKC ); |
147 | 155 | elseif( preg_match( '/[\x80-\xff]/', $string ) ) |
148 | 156 | return UtfNormal::NFKC( $string ); |
— | — | @@ -158,7 +166,9 @@ |
159 | 167 | * @return string a UTF-8 string in normal form KD |
160 | 168 | */ |
161 | 169 | static function toNFKD( $string ) { |
162 | | - if( NORMALIZE_ICU ) |
| 170 | + if( NORMALIZE_INTL ) |
| 171 | + return normalizer_normalize( $string, Normalizer::FORM_KD ); |
| 172 | + elseif( NORMALIZE_ICU ) |
163 | 173 | return utf8_normalize( $string, UNORM_NFKD ); |
164 | 174 | elseif( preg_match( '/[\x80-\xff]/', $string ) ) |
165 | 175 | return UtfNormal::NFKD( $string ); |