r69620 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69619‎ | r69620 | r69621 >
Date:15:05, 20 July 2010
Author:mah
Status:reverted (Comments)
Tags:
Comment:
Admin is required now.
Modified paths:
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/normal/UtfNormal.php (modified) (history)
  • /trunk/phase3/includes/parser/ParserCache.php (modified) (history)
  • /trunk/phase3/maintenance/install.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/install.php
@@ -30,8 +30,8 @@
3131
3232 $this->addArg( 'name', 'The name of the wiki', true);
3333
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);
3636 $this->addOption( 'email', 'The email for the wiki administrator', false, true);
3737
3838 $this->addOption( 'lang', 'The language to use (en)', false, true );
Index: trunk/phase3/includes/parser/ParserCache.php
@@ -4,6 +4,8 @@
55 * @todo document
66 */
77 class ParserCache {
 8+ private $mMemc;
 9+
810 /**
911 * Get an instance of this object
1012 */
@@ -23,6 +25,10 @@
2426 * @param $memCached Object
2527 */
2628 function __construct( $memCached ) {
 29+ if ( !$memCached ) {
 30+ global $parserMemc;
 31+ $parserMemc = $memCached = wfGetParserCacheStorage();
 32+ }
2733 $this->mMemc = $memCached;
2834 }
2935
Index: trunk/phase3/includes/EditPage.php
@@ -17,30 +17,30 @@
1818 * usually the same, but they are now allowed to be different.
1919 */
2020 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;
3939 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;
4545
4646 var $mArticle;
4747 var $mTitle;
@@ -129,8 +129,8 @@
130130 wfProfileIn( __METHOD__ );
131131 # Get variables from query string :P
132132 $section = $wgRequest->getVal( 'section' );
133 -
134 - $preload = $wgRequest->getVal( 'preload',
 133+
 134+ $preload = $wgRequest->getVal( 'preload',
135135 // Custom preload text for new sections
136136 $section === 'new' ? 'MediaWiki:addsection-preload' : '' );
137137 $undoafter = $wgRequest->getVal( 'undoafter' );
@@ -287,7 +287,7 @@
288288 *
289289 * The edit form is self-submitting, so that when things like
290290 * 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
292292 * is made and all is well do we actually save and redirect to
293293 * the newly-edited page.
294294 */
@@ -320,7 +320,7 @@
321321 }
322322
323323 $wgOut->addScriptFile( 'edit.js' );
324 -
 324+
325325 if ( $wgUser->getOption( 'uselivepreview', false ) ) {
326326 $wgOut->includeJQuery();
327327 $wgOut->addScriptFile( 'preview.js' );
@@ -360,9 +360,9 @@
361361
362362 $this->isConflict = false;
363363 // 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();
367367 $this->isValidCssJsSubpage = $this->mTitle->isValidCssJsSubpage();
368368
369369 # Show applicable editing introductions
@@ -374,9 +374,9 @@
375375 }
376376
377377 # Optional notices on a per-namespace and per-page basis
378 - $editnotice_ns = 'editnotice-'.$this->mTitle->getNamespace();
 378+ $editnotice_ns = 'editnotice-'.$this->mTitle->getNamespace();
379379 if ( !wfEmptyMsg( $editnotice_ns, wfMsgForContent( $editnotice_ns ) ) ) {
380 - $wgOut->addWikiText( wfMsgForContent( $editnotice_ns ) );
 380+ $wgOut->addWikiText( wfMsgForContent( $editnotice_ns ) );
381381 }
382382 if ( MWNamespace::hasSubpages( $this->mTitle->getNamespace() ) ) {
383383 $parts = explode( '/', $this->mTitle->getDBkey() );
@@ -389,7 +389,7 @@
390390 }
391391 }
392392
393 - # Attempt submission here. This will check for edit conflicts,
 393+ # Attempt submission here. This will check for edit conflicts,
394394 # and redundantly check for locked database, blocked IPs, etc.
395395 # that edit() already checked just in case someone tries to sneak
396396 # in the back door with a hand-edited submission URL.
@@ -493,7 +493,7 @@
494494 /**
495495 * Does this EditPage class support section editing?
496496 * This is used by EditPage subclasses to indicate their ui cannot handle section edits
497 - *
 497+ *
498498 * @return bool
499499 */
500500 protected function isSectionEditSupported() {
@@ -505,7 +505,7 @@
506506 * This is used by EditPage subclasses when simply customizing the action
507507 * variable in the constructor is not enough. This can be used when the
508508 * EditPage lives inside of a Special page rather than a custom page action.
509 - *
 509+ *
510510 * @param $title Title object for which is being edited (where we go to for &action= links)
511511 * @return string
512512 */
@@ -591,7 +591,7 @@
592592 $this->starttime = null;
593593 }
594594
595 - $this->recreate = $request->getCheck( 'wpRecreate' );
 595+ $this->recreate = $request->getCheck( 'wpRecreate' );
596596
597597 $this->minoredit = $request->getCheck( 'wpMinoredit' );
598598 $this->watchthis = $request->getCheck( 'wpWatchthis' );
@@ -609,17 +609,17 @@
610610 } else {
611611 # Not a posted form? Start with nothing.
612612 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 = '';
616616 $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;
621621 $this->minoredit = false;
622622 $this->watchthis = $request->getBool( 'watchthis', false ); // Watch may be overriden by request parameters
623 - $this->recreate = false;
 623+ $this->recreate = false;
624624
625625 if ( $this->section == 'new' && $request->getVal( 'preloadtitle' ) ) {
626626 $this->summary = $request->getVal( 'preloadtitle' );
@@ -655,7 +655,7 @@
656656 * posted form to be placed in $this->textbox1, if using customized input
657657 * this method should be overrided and return the page text that will be used
658658 * for saving, preview parsing and so on...
659 - *
 659+ *
660660 * @param $request WebRequest
661661 */
662662 protected function importContentFormData( &$request ) {
@@ -768,7 +768,7 @@
769769 global $wgFilterCallback, $wgUser, $wgOut, $wgParser;
770770 global $wgMaxArticleSize;
771771
772 - wfProfileIn( __METHOD__ );
 772+ wfProfileIn( __METHOD__ );
773773 wfProfileIn( __METHOD__ . '-checks' );
774774
775775 if ( !wfRunHooks( 'EditPage::attemptSave', array( $this ) ) ) {
@@ -1064,11 +1064,10 @@
10651065 $flags = EDIT_UPDATE | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY |
10661066 ( $this->minoredit ? EDIT_MINOR : 0 ) |
10671067 ( $bot ? EDIT_FORCE_BOT : 0 );
1068 - $status = $this->mArticle->doEdit( $text, $this->summary, $flags,
 1068+ $status = $this->mArticle->doEdit( $text, $this->summary, $flags,
10691069 false, null, $this->watchthis, false, $sectionanchor, true );
1070 -
1071 - if ( $status->isOK() )
1072 - {
 1070+
 1071+ if ( $status->isOK() ) {
10731072 wfProfileOut( __METHOD__ );
10741073 return self::AS_SUCCESS_UPDATE;
10751074 } else {
@@ -1186,8 +1185,8 @@
11871186 /**
11881187 * Send the edit form and related headers to $wgOut
11891188 * @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.
11921191 */
11931192 function showEditForm( $formCallback=null ) {
11941193 global $wgOut, $wgUser, $wgTitle;
@@ -1303,7 +1302,7 @@
13041303 }
13051304
13061305 $wgOut->addHTML( $this->editFormTextBeforeContent );
1307 -
 1306+
13081307 if ( $this->isConflict ) {
13091308 // In an edit conflict bypass the overrideable content form method
13101309 // and fallback to the raw wpTextbox1 since editconflicts can't be
@@ -1340,7 +1339,7 @@
13411340
13421341 if ( $this->isConflict )
13431342 $this->showConflict();
1344 -
 1343+
13451344 $wgOut->addHTML( $this->editFormTextBottom );
13461345 $wgOut->addHTML( "</form>\n" );
13471346 if ( !$wgUser->getOption( 'previewontop' ) ) {
@@ -1349,7 +1348,7 @@
13501349
13511350 wfProfileOut( __METHOD__ );
13521351 }
1353 -
 1352+
13541353 protected function showHeader() {
13551354 global $wgOut, $wgUser, $wgTitle, $wgMaxArticleSize, $wgLang;
13561355 if ( $this->isConflict ) {
@@ -1463,7 +1462,7 @@
14641463 }
14651464 if ( !$this->mTitle->exists() && $this->mTitle->getRestrictions( 'create' ) ) {
14661465 LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle->getPrefixedText(), '',
1467 - array( 'lim' => 1,
 1466+ array( 'lim' => 1,
14681467 'showIfEmpty' => false,
14691468 'msgKey' => array( 'titleprotectedwarning' ),
14701469 'wrap' => "<div class=\"mw-titleprotectedwarning\">\n$1</div>" ) );
@@ -1490,12 +1489,12 @@
14911490 * Note that you do not need to worry about the label's for=, it will be
14921491 * inferred by the id given to the input. You can remove them both by
14931492 * passing array( 'id' => false ) to $userInputAttrs.
1494 - *
 1493+ *
14951494 * @param $summary The value of the summary input
14961495 * @param $labelText The html to place inside the label
14971496 * @param $inputAttrs An array of attrs to use on the input
14981497 * @param $spanLabelAttrs An array of attrs to use on the span inside the label
1499 - *
 1498+ *
15001499 * @return array An array in the format array( $label, $input )
15011500 */
15021501 function getSummaryInput($summary = "", $labelText = null, $inputAttrs = null, $spanLabelAttrs = null) {
@@ -1527,8 +1526,8 @@
15281527
15291528 /**
15301529 * @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
15331532 * @param $summary String: The text of the summary to display
15341533 * @return String
15351534 */
@@ -1551,18 +1550,18 @@
15521551
15531552 /**
15541553 * @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
15571556 * @param $summary String: the text of the summary to display
15581557 * @return String
15591558 */
15601559 protected function getSummaryPreview( $isSubjectPreview, $summary = "" ) {
15611560 if ( !$summary || ( !$this->preview && !$this->diff ) )
15621561 return "";
1563 -
 1562+
15641563 global $wgParser, $wgUser;
15651564 $sk = $wgUser->getSkin();
1566 -
 1565+
15671566 if ( $isSubjectPreview )
15681567 $summary = wfMsgForContent( 'newsectionsummary', $wgParser->stripSectionName( $summary ) );
15691568
@@ -1586,7 +1585,7 @@
15871586 if ( !$this->checkUnicodeCompliantBrowser() )
15881587 $wgOut->addHTML(Xml::hidden( 'safemode', '1' ));
15891588 }
1590 -
 1589+
15911590 protected function showFormAfterText() {
15921591 global $wgOut, $wgUser;
15931592 /**
@@ -1611,7 +1610,7 @@
16121611 * be it a form, or simply wpTextbox1 with a modified content that will be
16131612 * reverse modified when extracted from the post data.
16141613 * Note that this is basically the inverse for importContentFormData
1615 - *
 1614+ *
16161615 * @param $request WebRequest
16171616 */
16181617 protected function showContentForm() {
@@ -1622,7 +1621,7 @@
16231622 * Method to output wpTextbox1
16241623 * The $textoverride method can be used by subclasses overriding showContentForm
16251624 * to pass back to this method.
1626 - *
 1625+ *
16271626 * @param $customAttribs An array of html attributes to use in the textarea
16281627 * @param $textoverride String: optional text to override $this->textarea1 with
16291628 */
@@ -1648,7 +1647,7 @@
16491648 $classes[] = $attribs['class'];
16501649 $attribs['class'] = implode( ' ', $classes );
16511650 }
1652 -
 1651+
16531652 $this->showTextbox( isset($textoverride) ? $textoverride : $this->textbox1, 'wpTextbox1', $attribs );
16541653 }
16551654
@@ -1671,7 +1670,7 @@
16721671 $attribs = $customAttribs + array(
16731672 'accesskey' => ',',
16741673 'id' => $name,
1675 - 'cols' => $wgUser->getIntOption( 'cols' ),
 1674+ 'cols' => $wgUser->getIntOption( 'cols' ),
16761675 'rows' => $wgUser->getIntOption( 'rows' ),
16771676 'style' => '' // avoid php notices when appending preferences (appending allows customAttribs['style'] to still work
16781677 );
@@ -1727,7 +1726,7 @@
17281727 * Give a chance for site and per-namespace customizations of
17291728 * terms of service summary link that might exist separately
17301729 * from the copyright notice.
1731 - *
 1730+ *
17321731 * This will display between the save button and the edit tools,
17331732 * so should remain short!
17341733 */
@@ -1749,7 +1748,7 @@
17501749 $wgOut->addWikiMsgArray( 'edittools', array(), array( 'content' ) );
17511750 $wgOut->addHTML( '</div>' );
17521751 }
1753 -
 1752+
17541753 protected function getCopywarn() {
17551754 global $wgRightsText;
17561755 if ( $wgRightsText ) {
@@ -1762,10 +1761,10 @@
17631762 }
17641763 // Allow for site and per-namespace customization of contribution/copyright notice.
17651764 wfRunHooks( 'EditPageCopyrightWarning', array( $this->mTitle, &$copywarnMsg ) );
1766 -
 1765+
17671766 return "<div id=\"editpage-copywarn\">\n" . call_user_func_array("wfMsgNoTrans", $copywarnMsg) . "\n</div>";
17681767 }
1769 -
 1768+
17701769 protected function showStandardInputs( &$tabindex = 2 ) {
17711770 global $wgOut, $wgUser;
17721771 $wgOut->addHTML( "<div class='editOptions'>\n" );
@@ -1816,20 +1815,20 @@
18171816 $data = $dbr->selectRow(
18181817 array( 'logging', 'user' ),
18191818 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' ),
18291828 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' ),
18341833 __METHOD__,
18351834 array( 'LIMIT' => 1, 'ORDER BY' => 'log_timestamp DESC' )
18361835 );
@@ -2139,103 +2138,103 @@
21402139 */
21412140 $toolarray = array(
21422141 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' => '\'\'\'',
21472146 'sample' => wfMsg( 'bold_sample' ),
2148 - 'tip' => wfMsg( 'bold_tip' ),
2149 - 'key' => 'B'
 2147+ 'tip' => wfMsg( 'bold_tip' ),
 2148+ 'key' => 'B'
21502149 ),
21512150 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' => '\'\'',
21562155 'sample' => wfMsg( 'italic_sample' ),
2157 - 'tip' => wfMsg( 'italic_tip' ),
2158 - 'key' => 'I'
 2156+ 'tip' => wfMsg( 'italic_tip' ),
 2157+ 'key' => 'I'
21592158 ),
21602159 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' => ']]',
21652164 'sample' => wfMsg( 'link_sample' ),
2166 - 'tip' => wfMsg( 'link_tip' ),
2167 - 'key' => 'L'
 2165+ 'tip' => wfMsg( 'link_tip' ),
 2166+ 'key' => 'L'
21682167 ),
21692168 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' => ']',
21742173 'sample' => wfMsg( 'extlink_sample' ),
2175 - 'tip' => wfMsg( 'extlink_tip' ),
2176 - 'key' => 'X'
 2174+ 'tip' => wfMsg( 'extlink_tip' ),
 2175+ 'key' => 'X'
21772176 ),
21782177 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",
21832182 'sample' => wfMsg( 'headline_sample' ),
2184 - 'tip' => wfMsg( 'headline_tip' ),
2185 - 'key' => 'H'
 2183+ 'tip' => wfMsg( 'headline_tip' ),
 2184+ 'key' => 'H'
21862185 ),
21872186 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' => ']]',
21922191 'sample' => wfMsg( 'image_sample' ),
2193 - 'tip' => wfMsg( 'image_tip' ),
2194 - 'key' => 'D'
 2192+ 'tip' => wfMsg( 'image_tip' ),
 2193+ 'key' => 'D'
21952194 ),
21962195 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' => ']]',
22012200 'sample' => wfMsg( 'media_sample' ),
2202 - 'tip' => wfMsg( 'media_tip' ),
2203 - 'key' => 'M'
 2201+ 'tip' => wfMsg( 'media_tip' ),
 2202+ 'key' => 'M'
22042203 ),
22052204 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>",
22102209 'sample' => wfMsg( 'math_sample' ),
2211 - 'tip' => wfMsg( 'math_tip' ),
2212 - 'key' => 'C'
 2210+ 'tip' => wfMsg( 'math_tip' ),
 2211+ 'key' => 'C'
22132212 ),
22142213 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>",
22192218 'sample' => wfMsg( 'nowiki_sample' ),
2220 - 'tip' => wfMsg( 'nowiki_tip' ),
2221 - 'key' => 'N'
 2219+ 'tip' => wfMsg( 'nowiki_tip' ),
 2220+ 'key' => 'N'
22222221 ),
22232222 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' => '',
22282227 'sample' => '',
2229 - 'tip' => wfMsg( 'sig_tip' ),
2230 - 'key' => 'Y'
 2228+ 'tip' => wfMsg( 'sig_tip' ),
 2229+ 'key' => 'Y'
22312230 ),
22322231 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' => '',
22372236 'sample' => '',
2238 - 'tip' => wfMsg( 'hr_tip' ),
2239 - 'key' => 'R'
 2237+ 'tip' => wfMsg( 'hr_tip' ),
 2238+ 'key' => 'R'
22402239 )
22412240 );
22422241 $toolbar = "<div id='toolbar'>\n";
@@ -2275,7 +2274,7 @@
22762275 * @param $tabindex Current tabindex
22772276 * @param $skin Skin object
22782277 * @param $checked Array of checkbox => bool, where bool indicates the checked
2279 - * status of the checkbox
 2278+ * status of the checkbox
22802279 *
22812280 * @return array
22822281 */
@@ -2288,9 +2287,9 @@
22892288 $minorLabel = wfMsgExt( 'minoredit', array( 'parseinline' ) );
22902289 if ( $wgUser->isAllowed( 'minoredit' ) ) {
22912290 $attribs = array(
2292 - 'tabindex' => ++$tabindex,
 2291+ 'tabindex' => ++$tabindex,
22932292 'accesskey' => wfMsg( 'accesskey-minoredit' ),
2294 - 'id' => 'wpMinoredit',
 2293+ 'id' => 'wpMinoredit',
22952294 );
22962295 $checkboxes['minor'] =
22972296 Xml::check( 'wpMinoredit', $checked['minor'], $attribs ) .
@@ -2301,9 +2300,9 @@
23022301 $checkboxes['watch'] = '';
23032302 if ( $wgUser->isLoggedIn() ) {
23042303 $attribs = array(
2305 - 'tabindex' => ++$tabindex,
 2304+ 'tabindex' => ++$tabindex,
23062305 'accesskey' => wfMsg( 'accesskey-watch' ),
2307 - 'id' => 'wpWatchthis',
 2306+ 'id' => 'wpWatchthis',
23082307 );
23092308 $checkboxes['watch'] =
23102309 Xml::check( 'wpWatchthis', $checked['watch'], $attribs ) .
@@ -2325,37 +2324,37 @@
23262325 $buttons = array();
23272326
23282327 $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' ),
23342333 'accesskey' => wfMsg( 'accesskey-save' ),
2335 - 'title' => wfMsg( 'tooltip-save' ).' ['.wfMsg( 'accesskey-save' ).']',
 2334+ 'title' => wfMsg( 'tooltip-save' ).' ['.wfMsg( 'accesskey-save' ).']',
23362335 );
23372336 $buttons['save'] = Xml::element('input', $temp, '');
23382337
23392338 ++$tabindex; // use the same for preview and live preview
23402339 $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' ),
23462345 'accesskey' => wfMsg( 'accesskey-preview' ),
2347 - 'title' => wfMsg( 'tooltip-preview' ) . ' [' . wfMsg( 'accesskey-preview' ) . ']',
 2346+ 'title' => wfMsg( 'tooltip-preview' ) . ' [' . wfMsg( 'accesskey-preview' ) . ']',
23482347 );
23492348 $buttons['preview'] = Xml::element( 'input', $temp, '' );
23502349 $buttons['live'] = '';
23512350
23522351 $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' ),
23582357 'accesskey' => wfMsg( 'accesskey-diff' ),
2359 - 'title' => wfMsg( 'tooltip-diff' ) . ' [' . wfMsg( 'accesskey-diff' ) . ']',
 2358+ 'title' => wfMsg( 'tooltip-diff' ) . ' [' . wfMsg( 'accesskey-diff' ) . ']',
23602359 );
23612360 $buttons['diff'] = Xml::element( 'input', $temp, '' );
23622361
@@ -2371,9 +2370,9 @@
23722371 * failure, etc).
23732372 *
23742373 * @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.
23782377 */
23792378 function livePreview() {
23802379 global $wgOut;
@@ -2428,7 +2427,7 @@
24292428 $newtext = $this->mArticle->preSaveTransform( $newtext );
24302429 $oldtitle = wfMsgExt( 'currentrev', array( 'parseinline' ) );
24312430 $newtitle = wfMsgExt( 'yourtext', array( 'parseinline' ) );
2432 - if ( $oldtext !== false || $newtext != '' ) {
 2431+ if ( $oldtext !== false || $newtext != '' ) {
24332432 $de = new DifferenceEngine( $this->mTitle );
24342433 $de->setText( $oldtext, $newtext );
24352434 $difftext = $de->getDiff( $oldtitle, $newtitle );
@@ -2588,7 +2587,7 @@
25892588 switch ( $value ) {
25902589 case self::AS_HOOK_ERROR_EXPECTED:
25912590 case self::AS_CONTENT_TOO_BIG:
2592 - case self::AS_ARTICLE_WAS_DELETED:
 2591+ case self::AS_ARTICLE_WAS_DELETED:
25932592 case self::AS_CONFLICT_DETECTED:
25942593 case self::AS_SUMMARY_NEEDED:
25952594 case self::AS_TEXTBOX_EMPTY:
@@ -2618,22 +2617,22 @@
26192618 $this->userNotLoggedInPage();
26202619 return false;
26212620
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;
26262625
2627 - case self::AS_RATE_LIMITED:
2628 - $wgOut->rateLimited();
2629 - return false;
 2626+ case self::AS_RATE_LIMITED:
 2627+ $wgOut->rateLimited();
 2628+ return false;
26302629
2631 - case self::AS_NO_CREATE_PERMISSION:
2632 - $this->noCreatePermission();
2633 - return;
 2630+ case self::AS_NO_CREATE_PERMISSION:
 2631+ $this->noCreatePermission();
 2632+ return;
26342633
26352634 case self::AS_BLANK_ARTICLE:
2636 - $wgOut->redirect( $wgTitle->getFullURL() );
2637 - return false;
 2635+ $wgOut->redirect( $wgTitle->getFullURL() );
 2636+ return false;
26382637
26392638 case self::AS_IMAGE_REDIRECT_LOGGED:
26402639 $wgOut->permissionRequired( 'upload' );
@@ -2650,5 +2649,5 @@
26512650 } else {
26522651 return $this->mBaseRevision;
26532652 }
2654 - }
 2653+ }
26552654 }
Index: trunk/phase3/includes/normal/UtfNormal.php
@@ -45,6 +45,7 @@
4646 define( 'UNORM_FCD', 6 );
4747
4848 define( 'NORMALIZE_ICU', function_exists( 'utf8_normalize' ) );
 49+define( 'NORMALIZE_INTL', function_exists( 'normalizer_normalize' ) );
4950
5051 /**
5152 * Unicode normalization routines for working with UTF-8 strings.
@@ -79,7 +80,7 @@
8081 return $ret;
8182 }
8283
83 - if( NORMALIZE_ICU ) {
 84+ if( NORMALIZE_ICU || NORMALIZE_INTL ) {
8485 # We exclude a few chars that ICU would not.
8586 $string = preg_replace(
8687 '/[\x00-\x08\x0b\x0c\x0e-\x1f]/',
@@ -90,7 +91,8 @@
9192
9293 # UnicodeString constructor fails if the string ends with a
9394 # 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 );
9597 } elseif( UtfNormal::quickIsNFCVerify( $string ) ) {
9698 # Side effect -- $string has had UTF-8 errors cleaned up.
9799 return $string;
@@ -108,7 +110,9 @@
109111 * @return string a UTF-8 string in normal form C
110112 */
111113 static function toNFC( $string ) {
112 - if( NORMALIZE_ICU )
 114+ if( NORMALIZE_INTL )
 115+ return normalizer_normalize( $string, Normalizer::FORM_C );
 116+ elseif( NORMALIZE_ICU )
113117 return utf8_normalize( $string, UNORM_NFC );
114118 elseif( UtfNormal::quickIsNFC( $string ) )
115119 return $string;
@@ -124,7 +128,9 @@
125129 * @return string a UTF-8 string in normal form D
126130 */
127131 static function toNFD( $string ) {
128 - if( NORMALIZE_ICU )
 132+ if( NORMALIZE_INTL )
 133+ return normalizer_normalize( $string, Normalizer::FORM_D );
 134+ elseif( NORMALIZE_ICU )
129135 return utf8_normalize( $string, UNORM_NFD );
130136 elseif( preg_match( '/[\x80-\xff]/', $string ) )
131137 return UtfNormal::NFD( $string );
@@ -141,7 +147,9 @@
142148 * @return string a UTF-8 string in normal form KC
143149 */
144150 static function toNFKC( $string ) {
145 - if( NORMALIZE_ICU )
 151+ if( NORMALIZE_INTL )
 152+ return normalizer_normalize( $string, Normalizer::FORM_KC );
 153+ elseif( NORMALIZE_ICU )
146154 return utf8_normalize( $string, UNORM_NFKC );
147155 elseif( preg_match( '/[\x80-\xff]/', $string ) )
148156 return UtfNormal::NFKC( $string );
@@ -158,7 +166,9 @@
159167 * @return string a UTF-8 string in normal form KD
160168 */
161169 static function toNFKD( $string ) {
162 - if( NORMALIZE_ICU )
 170+ if( NORMALIZE_INTL )
 171+ return normalizer_normalize( $string, Normalizer::FORM_KD );
 172+ elseif( NORMALIZE_ICU )
163173 return utf8_normalize( $string, UNORM_NFKD );
164174 elseif( preg_match( '/[\x80-\xff]/', $string ) )
165175 return UtfNormal::NFKD( $string );

Follow-up revisions

RevisionCommit summaryAuthorDate
r69622revert r69620mah15:12, 20 July 2010

Comments

#Comment by MarkAHershberger (talk | contribs)   15:08, 20 July 2010

this was an over-commit, reverting.

#Comment by Siebrand (talk | contribs)   18:41, 20 July 2010

Just a small whine: reading the commit summary it wasn't clear to me at all what "Admin was now required" for. Since it's been self-reverted that doesn't matter too much, but I hope that when it's recommitted, I can understand the feature from the commit summary, or the RELEASE-NOTES update :P.

#Comment by MarkAHershberger (talk | contribs)   23:47, 20 July 2010

I hope r69627 is a little better.

Status & tagging log