r40713 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40712‎ | r40713 | r40714 >
Date:19:44, 10 September 2008
Author:aaron
Status:old
Tags:
Comment:
Move protection log parameters to log_params. Solves bug 12234 and is better for i18n.
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/LogEventsList.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -1795,7 +1795,7 @@
17961796 return false;
17971797 }
17981798
1799 - if (!$cascade) {
 1799+ if( !$cascade ) {
18001800 $cascade = false;
18011801 }
18021802
@@ -1824,11 +1824,6 @@
18251825
18261826 $encodedExpiry = Block::encodeExpiry($expiry, $dbw );
18271827
1828 - $expiry_description = '';
1829 - if ( $encodedExpiry != 'infinity' ) {
1830 - $expiry_description = ' (' . wfMsgForContent( 'protect-expiring', $wgContLang->timeanddate( $expiry, false, false ) ).')';
1831 - }
1832 -
18331828 # Prepare a null revision to be added to the history
18341829 $modified = $current != '' && $protect;
18351830 if ( $protect ) {
@@ -1848,19 +1843,8 @@
18491844 }
18501845 }
18511846
1852 - $cascade_description = '';
1853 - if ($cascade) {
1854 - $cascade_description = ' ['.wfMsg('protect-summary-cascade').']';
1855 - }
1856 -
18571847 if( $reason )
18581848 $comment .= ": $reason";
1859 - if( $protect )
1860 - $comment .= " [$updated]";
1861 - if ( $expiry_description && $protect )
1862 - $comment .= "$expiry_description";
1863 - if ( $cascade )
1864 - $comment .= "$cascade_description";
18651849
18661850 # Update restrictions table
18671851 foreach( $limit as $action => $restrictions ) {
@@ -1897,8 +1881,8 @@
18981882 # Update the protection log
18991883 $log = new LogPage( 'protect' );
19001884 if( $protect ) {
1901 - $log->addEntry( $modified ? 'modify' : 'protect', $this->mTitle,
1902 - trim( $reason . " [$updated]$cascade_description$expiry_description" ) );
 1885+ $params = array($updated,$encodedExpiry,$cascade ? 'cascade' : '');
 1886+ $log->addEntry( $modified ? 'modify' : 'protect', $this->mTitle, trim( $reason), $params );
19031887 } else {
19041888 $log->addEntry( 'unprotect', $this->mTitle, $reason );
19051889 }
Index: trunk/phase3/includes/LogEventsList.php
@@ -239,7 +239,18 @@
240240 'action=unblock&ip=' . urlencode( $row->log_title ) ) . ')';
241241 // Show change protection link
242242 } else if( self::typeAction($row,'protect',array('modify','protect','unprotect')) ) {
243 - $revert = '(' . $this->skin->makeKnownLinkObj( $title, $this->message['hist'],
 243+ if( $row->log_type == 'protect' && count($paramArray) == 3 ) {
 244+ $revert .= " [{$paramArray[0]}]"; // the restrictions
 245+ if( $paramArray[1] != 'infinity' ) {
 246+ $revert .= ' (' . wfMsgForContent( 'protect-expiring',
 247+ $wgContLang->timeanddate( $paramArray[1], false, false ) ).')';
 248+ }
 249+ if( $paramArray[2] ) {
 250+ $revert .= ' ['.wfMsg('protect-summary-cascade').']';
 251+ }
 252+ }
 253+ $revert = $revert ? "$revert " : "";
 254+ $revert .= '(' . $this->skin->makeKnownLinkObj( $title, $this->message['hist'],
244255 'action=history&offset=' . urlencode($row->log_timestamp) ) . ')';
245256 if( $wgUser->isAllowed('protect') && $row->log_action != 'unprotect' ) {
246257 $revert .= ' (' . $this->skin->makeKnownLinkObj( $title, $this->message['protect_change'],