r61124 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61123‎ | r61124 | r61125 >
Date:11:24, 16 January 2010
Author:churchofemacs
Status:resolved (Comments)
Tags:
Comment:
provided option for showLogExtract to wrap result. Added log for create protected page
Modified paths:
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/LogEventsList.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/EditPage.php
@@ -1506,7 +1506,11 @@
15071507 $wgOut->wrapWikiMsg( $notice, array( 'cascadeprotectedwarning', $cascadeSourcesCount ) );
15081508 }
15091509 if ( !$this->mTitle->exists() && $this->mTitle->getRestrictions( 'create' ) ) {
1510 - $wgOut->wrapWikiMsg( "<div class=\"mw-titleprotectedwarning\">\n$1</div>", 'titleprotectedwarning' );
 1510+ LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle->getPrefixedText(), '',
 1511+ array( 'lim' => 1,
 1512+ 'showIfEmpty' => false,
 1513+ 'msgKey' => array( 'titleprotectedwarning' ),
 1514+ 'wrap' => "<div class=\"mw-titleprotectedwarning\">\n$1</div>" ) );
15111515 }
15121516
15131517 if ( $this->kblength === false ) {
@@ -2685,5 +2689,5 @@
26862690 } else {
26872691 return $this->mBaseRevision;
26882692 }
2689 - }
 2693+ }
26902694 }
Index: trunk/phase3/includes/LogEventsList.php
@@ -609,6 +609,7 @@
610610 * that are processed with wgMsgExt and option 'parse'
611611 * - offset Set to overwrite offset parameter in $wgRequest
612612 * set to '' to unset offset
 613+ * - wrap String: Wrap the message in html (usually something like "<div ...>$1</div>").
613614 * @return Integer Number of total log items (not limited by $lim)
614615 */
615616 public static function showLogExtract( &$out, $types=array(), $page='', $user='',
@@ -618,7 +619,8 @@
619620 'lim' => 25,
620621 'conds' => array(),
621622 'showIfEmpty' => true,
622 - 'msgKey' => array('')
 623+ 'msgKey' => array(''),
 624+ 'wrap' => "$1"
623625 );
624626
625627 # The + operator appends elements of remaining keys from the right
@@ -631,6 +633,7 @@
632634 $conds = $param['conds'];
633635 $showIfEmpty = $param['showIfEmpty'];
634636 $msgKey = $param['msgKey'];
 637+ $wrap = $param['wrap'];
635638 if ( !is_array( $msgKey ) )
636639 $msgKey = array( $msgKey );
637640 # Insert list of top 50 (or top $lim) items
@@ -683,6 +686,11 @@
684687 if ( $logBody && $msgKey[0] )
685688 $s .= '</div>';
686689
 690+ if ( $wrap!='' ) { // Wrap message in html
 691+ $s = str_replace( '$1', $s, $wrap );
 692+ }
 693+
 694+ // $out can be either an OutputPage object or a String-by-reference
687695 if( $out instanceof OutputPage ){
688696 $out->addHTML( $s );
689697 } else {
@@ -890,6 +898,7 @@
891899 }
892900
893901 public function getQueryInfo() {
 902+ global $wgOut;
894903 $tables = array( 'logging', 'user' );
895904 $this->mConds[] = 'user_id = log_user';
896905 $index = array();
@@ -930,7 +939,6 @@
931940 # Add ChangeTags filter query
932941 ChangeTags::modifyDisplayQuery( $info['tables'], $info['fields'], $info['conds'],
933942 $info['join_conds'], $info['options'], $this->mTagFilter );
934 -
935943 return $info;
936944 }
937945
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1325,10 +1325,10 @@
13261326 You may wish to cut-n-paste the text into a text file and save it for later.
13271327
13281328 The administrator who locked it offered this explanation: $1",
1329 -'protectedpagewarning' => "'''Warning: This page has been locked so that only users with administrator privileges can edit it.'''",
1330 -'semiprotectedpagewarning' => "'''Note:''' This page has been locked so that only registered users can edit it.",
 1329+'protectedpagewarning' => "'''Warning: This page has been locked so that only users with administrator privileges can edit it.''' The lastest log entry is provided below for reference:",
 1330+'semiprotectedpagewarning' => "'''Note:''' This page has been locked so that only registered users can edit it. The lastest log entry is provided below for reference:",
13311331 'cascadeprotectedwarning' => "'''Warning:''' This page has been locked so that only users with administrator privileges can edit it, because it is included in the following cascade-protected {{PLURAL:$1|page|pages}}:",
1332 -'titleprotectedwarning' => "'''Warning: This page has been locked so that [[Special:ListGroupRights|specific rights]] are needed to create it.'''",
 1332+'titleprotectedwarning' => "'''Warning: This page has been locked so that [[Special:ListGroupRights|specific rights]] are needed to create it.''' The lastest log entry is provided below for reference:",
13331333 'templatesused' => '{{PLURAL:$1|Template|Templates}} used on this page:',
13341334 'templatesusedpreview' => '{{PLURAL:$1|Template|Templates}} used in this preview:',
13351335 'templatesusedsection' => '{{PLURAL:$1|Template|Templates}} used in this section:',
@@ -3071,8 +3071,8 @@
30723072 'imageinvalidfilename' => 'The target file name is invalid',
30733073 'fix-double-redirects' => 'Update any redirects that point to the original title',
30743074 'move-leave-redirect' => 'Leave a redirect behind',
3075 -'protectedpagemovewarning' => "'''Warning:''' This page has been locked so that only users with administrator privileges can move it.",
3076 -'semiprotectedpagemovewarning' => "'''Note:''' This page has been locked so that only registered users can move it.",
 3075+'protectedpagemovewarning' => "'''Warning:''' This page has been locked so that only users with administrator privileges can move it. The lastest log entry is provided below for reference:",
 3076+'semiprotectedpagemovewarning' => "'''Note:''' This page has been locked so that only registered users can move it. The lastest log entry is provided below for reference:",
30773077 'move-over-sharedrepo' => '== File exists ==
30783078 [[:$1]] exists on a shared repository. Moving a file to this title will override the shared file.',
30793079 'file-exists-sharedrepo' => 'The file name chosen is already in use on a shared repository.

Follow-up revisions

RevisionCommit summaryAuthorDate
r61729fixing r61124: typoschurchofemacs22:00, 30 January 2010

Comments

#Comment by Tim Starling (talk | contribs)   03:33, 27 January 2010

There's no such word as "lastest". And don't quote Wiktionary to me like Trevor did on r60222. Not sure if you mean latest or last.

#Comment by Church of emacs (talk | contribs)   22:01, 30 January 2010

Sorry, that was a typo that spread due to copy&paste. Fixed in r61729

Status & tagging log