Revision: 49378 Author: aaron Date: 2009-04-10 20:01:10 +0000 (Fri, 10 Apr 2009)
Log Message: ----------- (bug 18361) Suppression log should be in the UI language, not content language Modified Paths: -------------- trunk/phase3/includes/LogEventsList.php trunk/phase3/includes/LogPage.php trunk/phase3/includes/specials/SpecialRevisiondelete.php Modified: trunk/phase3/includes/LogEventsList.php =================================================================== --- trunk/phase3/includes/LogEventsList.php 2009-04-10 18:51:48 UTC (rev 49377) +++ trunk/phase3/includes/LogEventsList.php 2009-04-10 20:01:10 UTC (rev 49378) @@ -282,7 +282,7 @@ 'mergepoint' => $paramArray[1] ) ) ) . ')'; // If an edit was hidden from a page give a review link to the history } else if( self::typeAction($row,array('delete','suppress'),'revision','deleterevision') ) { - if( count($paramArray) == 2 ) { + if( count($paramArray) >= 2 ) { $revdel = SpecialPage::getTitleFor( 'Revisiondelete' ); // Different revision types use different URL params... $key = $paramArray[0]; @@ -304,7 +304,7 @@ } // Hidden log items, give review link } else if( self::typeAction($row,array('delete','suppress'),'event','deleterevision') ) { - if( count($paramArray) == 1 ) { + if( count($paramArray) >= 1 ) { $revdel = SpecialPage::getTitleFor( 'Revisiondelete' ); // $paramArray[1] is a CVS of the IDs $Ids = explode( ',', $paramArray[0] ); Modified: trunk/phase3/includes/LogPage.php =================================================================== --- trunk/phase3/includes/LogPage.php 2009-04-10 18:51:48 UTC (rev 49377) +++ trunk/phase3/includes/LogPage.php 2009-04-10 20:01:10 UTC (rev 49378) @@ -201,6 +201,7 @@ } else { $details = ''; array_unshift( $params, $titleLink ); + // User suppression if ( preg_match( '/^(block|suppress)\/(block|reblock)$/', $key ) ) { if ( $skin ) { $params[1] = '<span title="' . htmlspecialchars( $params[1] ). '">' . @@ -210,6 +211,7 @@ } $params[2] = isset( $params[2] ) ? self::formatBlockFlags( $params[2], is_null( $skin ) ) : ''; + // Page protections } else if ( $type == 'protect' && count($params) == 3 ) { $details .= " {$params[1]}"; // restrictions and expiries if( $params[2] ) { @@ -219,6 +221,7 @@ $details .= ' ['.wfMsgForContent('protect-summary-cascade').']'; } } + // Page moves } else if ( $type == 'move' && count( $params ) == 3 ) { if( $params[2] ) { if ( $skin ) { @@ -227,6 +230,18 @@ $details .= ' [' . wfMsgForContent( 'move-redirect-suppressed' ) . ']'; } } + // Revision deletion + } else if ( preg_match( '/^(delete|suppress)\/revision$/', $key ) && count( $params ) == 5 ) { + $count = substr_count( $params[1], ',' ) + 1; // revisions + $ofield = intval( substr( $params[3], 7 ) ); // <ofield=x> + $nfield = intval( substr( $params[4], 7 ) ); // <nfield=x> + $details .= ': '.RevisionDeleter::getLogMessage( $count, $nfield, $ofield, false ); + // Log deletion + } else if ( preg_match( '/^(delete|suppress)\/event$/', $key ) && count( $params ) == 4 ) { + $count = substr_count( $params[1], ',' ) + 1; // log items + $ofield = intval( substr( $params[2], 7 ) ); // <ofield=x> + $nfield = intval( substr( $params[3], 7 ) ); // <nfield=x> + $details .= ': '.RevisionDeleter::getLogMessage( $count, $nfield, $ofield, true ); } $rv = wfMsgReal( $wgLogActions[$key], $params, true, !$skin ) . $details; } Modified: trunk/phase3/includes/specials/SpecialRevisiondelete.php =================================================================== --- trunk/phase3/includes/specials/SpecialRevisiondelete.php 2009-04-10 18:51:48 UTC (rev 49377) +++ trunk/phase3/includes/specials/SpecialRevisiondelete.php 2009-04-10 20:01:10 UTC (rev 49378) @@ -165,7 +165,9 @@ } // Format is <id1,id2,i3...> if( count($safeIds) ) { - $conds[] = "log_params RLIKE '(^|\n|,)(".implode('|',$safeIds).")(,|$)'"; + $conds[] = "log_params RLIKE '(^|\n|,)(".implode('|',$safeIds).")(,|\n|$)'"; + } else { + $conds = array('1=0'); } return array($conds,$limit); } @@ -678,9 +680,8 @@ $pageLink = "<a href=\"{$url}\">{$date}</a>"; } - $data = wfMsg( 'widthheight', - $wgLang->formatNum( $file->getWidth() ), - $wgLang->formatNum( $file->getHeight() ) ) . + $data = wfMsg( 'widthheight', $wgLang->formatNum( $file->getWidth() ), + $wgLang->formatNum( $file->getHeight() ) ) . ' (' . wfMsgExt( 'nbytes', 'parsemag', $wgLang->formatNum( $file->getSize() ) ) . ')'; $data = htmlspecialchars( $data ); @@ -707,9 +708,8 @@ $del = ' <tt>' . wfMsgHtml( 'deletedrev' ) . '</tt>'; } - $data = wfMsg( 'widthheight', - $wgLang->formatNum( $file->getWidth() ), - $wgLang->formatNum( $file->getHeight() ) ) . + $data = wfMsg( 'widthheight', $wgLang->formatNum( $file->getWidth() ), + $wgLang->formatNum( $file->getHeight() ) ) . ' (' . wfMsgExt( 'nbytes', 'parsemag', $wgLang->formatNum( $file->getSize() ) ) . ')'; $data = htmlspecialchars( $data ); @@ -1467,7 +1467,7 @@ * @param int $diff The xor of the old and new bitfields. * @param array $arr The array to update. */ - function checkItem( $desc, $field, $diff, $new, &$arr ) { + protected static function checkItem( $desc, $field, $diff, $new, &$arr ) { if( $diff & $field ) { $arr[ ( $new & $field ) ? 0 : 1 ][] = $desc; } @@ -1485,15 +1485,15 @@ * @param int $o The old bitfield. * @return An array as described above. */ - function getChanges( $n, $o ) { + protected static function getChanges( $n, $o ) { $diff = $n ^ $o; $ret = array( 0 => array(), 1 => array(), 2 => array() ); // Build bitfield changes in language - $this->checkItem( wfMsgForContent( 'revdelete-content' ), + self::checkItem( wfMsgForContent( 'revdelete-content' ), Revision::DELETED_TEXT, $diff, $n, $ret ); - $this->checkItem( wfMsgForContent( 'revdelete-summary' ), + self::checkItem( wfMsgForContent( 'revdelete-summary' ), Revision::DELETED_COMMENT, $diff, $n, $ret ); - $this->checkItem( wfMsgForContent( 'revdelete-uname' ), + self::checkItem( wfMsgForContent( 'revdelete-uname' ), Revision::DELETED_USER, $diff, $n, $ret ); // Restriction application to sysops if( $diff & Revision::DELETED_RESTRICTED ) { @@ -1513,15 +1513,12 @@ * @param int $count The number of effected revisions. * @param int $nbitfield The new bitfield for the revision. * @param int $obitfield The old bitfield for the revision. - * @param string $comment The comment associated with the change. * @param bool $isForLog */ - function getLogMessage( $count, $nbitfield, $obitfield, $comment, $isForLog = false ) { - global $wgContLang; - + public static function getLogMessage( $count, $nbitfield, $obitfield, $isForLog = false ) { + global $wgLang; $s = ''; - $changes = $this->getChanges( $nbitfield, $obitfield ); - + $changes = self::getChanges( $nbitfield, $obitfield ); if( count( $changes[0] ) ) { $s .= wfMsgForContent ( 'revdelete-hid', implode ( ', ', $changes[0] ) ); } @@ -1532,15 +1529,9 @@ if( count( $changes[2] ) ) { $s .= $s ? ' (' . $changes[2][0] . ')' : $changes[2][0]; } - $msg = $isForLog ? 'logdelete-log-message' : 'revdelete-log-message'; - $ret = wfMsgExt ( $msg, array( 'parsemag', 'content' ), - $s, $wgContLang->formatNum( $count ) ); + return wfMsgExt( $msg, array( 'parsemag', 'content' ), $s, $wgLang->formatNum($count) ); - if( $comment ) $ret .= ": $comment"; - - return $ret; - } /** @@ -1561,16 +1552,15 @@ $logtype = ( ($nbitfield | $obitfield) & Revision::DELETED_RESTRICTED ) ? 'suppress' : 'delete'; $log = new LogPage( $logtype ); + $itemCSV = implode(',',$items); - $reason = $this->getLogMessage( $count, $nbitfield, $obitfield, $comment, $param == 'logid' ); - if( $param == 'logid' ) { - $params = array( implode( ',', $items) ); - $log->addEntry( 'event', $title, $reason, $params ); + $params = array( $itemCSV, "ofield={$obitfield}", "nfield={$nbitfield}" ); + $log->addEntry( 'event', $title, $comment, $params ); } else { // Add params for effected page and ids - $params = array( $param, implode( ',', $items) ); - $log->addEntry( 'revision', $title, $reason, $params ); + $params = array( $param, $itemCSV, "ofield={$obitfield}", "nfield={$nbitfield}" ); + $log->addEntry( 'revision', $title, $comment, $params ); } } } _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs