From: Tobias Date: Sat, 16 Jan 2010 11:24:23 +0000 (+0000) Subject: provided option for showLogExtract to wrap result. Added log for create protected... X-Git-Tag: 1.31.0-rc.0~38244 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=001b4fe21167191482cfdb465546c1fab2adf0e9;p=lhc%2Fweb%2Fwiklou.git provided option for showLogExtract to wrap result. Added log for create protected page --- diff --git a/includes/EditPage.php b/includes/EditPage.php index 5f6d68d8f1..73a2f04df4 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1506,7 +1506,11 @@ HTML $wgOut->wrapWikiMsg( $notice, array( 'cascadeprotectedwarning', $cascadeSourcesCount ) ); } if ( !$this->mTitle->exists() && $this->mTitle->getRestrictions( 'create' ) ) { - $wgOut->wrapWikiMsg( "
\n$1
", 'titleprotectedwarning' ); + LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle->getPrefixedText(), '', + array( 'lim' => 1, + 'showIfEmpty' => false, + 'msgKey' => array( 'titleprotectedwarning' ), + 'wrap' => "
\n$1
" ) ); } if ( $this->kblength === false ) { @@ -2685,5 +2689,5 @@ INPUTS } else { return $this->mBaseRevision; } - } + } } diff --git a/includes/LogEventsList.php b/includes/LogEventsList.php index 2215568175..4bfdc2a3ae 100644 --- a/includes/LogEventsList.php +++ b/includes/LogEventsList.php @@ -609,6 +609,7 @@ class LogEventsList { * that are processed with wgMsgExt and option 'parse' * - offset Set to overwrite offset parameter in $wgRequest * set to '' to unset offset + * - wrap String: Wrap the message in html (usually something like "
$1
"). * @return Integer Number of total log items (not limited by $lim) */ public static function showLogExtract( &$out, $types=array(), $page='', $user='', @@ -618,7 +619,8 @@ class LogEventsList { 'lim' => 25, 'conds' => array(), 'showIfEmpty' => true, - 'msgKey' => array('') + 'msgKey' => array(''), + 'wrap' => "$1" ); # The + operator appends elements of remaining keys from the right @@ -631,6 +633,7 @@ class LogEventsList { $conds = $param['conds']; $showIfEmpty = $param['showIfEmpty']; $msgKey = $param['msgKey']; + $wrap = $param['wrap']; if ( !is_array( $msgKey ) ) $msgKey = array( $msgKey ); # Insert list of top 50 (or top $lim) items @@ -683,6 +686,11 @@ class LogEventsList { if ( $logBody && $msgKey[0] ) $s .= ''; + if ( $wrap!='' ) { // Wrap message in html + $s = str_replace( '$1', $s, $wrap ); + } + + // $out can be either an OutputPage object or a String-by-reference if( $out instanceof OutputPage ){ $out->addHTML( $s ); } else { @@ -890,6 +898,7 @@ class LogPager extends ReverseChronologicalPager { } public function getQueryInfo() { + global $wgOut; $tables = array( 'logging', 'user' ); $this->mConds[] = 'user_id = log_user'; $index = array(); @@ -930,7 +939,6 @@ class LogPager extends ReverseChronologicalPager { # Add ChangeTags filter query ChangeTags::modifyDisplayQuery( $info['tables'], $info['fields'], $info['conds'], $info['join_conds'], $info['options'], $this->mTagFilter ); - return $info; } diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 5d64beb27b..04c08086d1 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1325,10 +1325,10 @@ It cannot be saved.", You may wish to cut-n-paste the text into a text file and save it for later. The administrator who locked it offered this explanation: $1", -'protectedpagewarning' => "'''Warning: This page has been locked so that only users with administrator privileges can edit it.'''", -'semiprotectedpagewarning' => "'''Note:''' This page has been locked so that only registered users can edit it.", +'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:", +'semiprotectedpagewarning' => "'''Note:''' This page has been locked so that only registered users can edit it. The lastest log entry is provided below for reference:", '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}}:", -'titleprotectedwarning' => "'''Warning: This page has been locked so that [[Special:ListGroupRights|specific rights]] are needed to create it.'''", +'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:", 'templatesused' => '{{PLURAL:$1|Template|Templates}} used on this page:', 'templatesusedpreview' => '{{PLURAL:$1|Template|Templates}} used in this preview:', 'templatesusedsection' => '{{PLURAL:$1|Template|Templates}} used in this section:', @@ -3071,8 +3071,8 @@ cannot move a page over itself.', 'imageinvalidfilename' => 'The target file name is invalid', 'fix-double-redirects' => 'Update any redirects that point to the original title', 'move-leave-redirect' => 'Leave a redirect behind', -'protectedpagemovewarning' => "'''Warning:''' This page has been locked so that only users with administrator privileges can move it.", -'semiprotectedpagemovewarning' => "'''Note:''' This page has been locked so that only registered users can move it.", +'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:", +'semiprotectedpagemovewarning' => "'''Note:''' This page has been locked so that only registered users can move it. The lastest log entry is provided below for reference:", 'move-over-sharedrepo' => '== File exists == [[:$1]] exists on a shared repository. Moving a file to this title will override the shared file.', 'file-exists-sharedrepo' => 'The file name chosen is already in use on a shared repository.