Index: trunk/phase3/includes/SpecialRevisiondelete.php |
— | — | @@ -1333,8 +1333,93 @@ |
1334 | 1334 | // Extensions that require referencing previous revisions may need this |
1335 | 1335 | wfRunHooks( 'ArticleRevisionVisiblitySet', array( &$title ) ); |
1336 | 1336 | } |
1337 | | - |
| 1337 | + |
1338 | 1338 | /** |
| 1339 | + * Checks for a change in the bitfield for a certain option and updates the |
| 1340 | + * provided array accordingly. |
| 1341 | + * |
| 1342 | + * @param String $desc Description to add to the array if the option was |
| 1343 | + * enabled / disabled. |
| 1344 | + * @param int $field The bitmask describing the single option. |
| 1345 | + * @param int $diff The xor of the old and new bitfields. |
| 1346 | + * @param array $arr The array to update. |
| 1347 | + */ |
| 1348 | + function checkItem ( $desc, $field, $diff, $new, $arr ) |
| 1349 | + { |
| 1350 | + if ( $diff & $field ) { |
| 1351 | + $arr [ ( $new & $field ) ? 0 : 1 ][] = $desc; |
| 1352 | + } |
| 1353 | + } |
| 1354 | + |
| 1355 | + /** |
| 1356 | + * Gets an array describing the changes made to the visibilit of the revision. |
| 1357 | + * If the resulting array is $arr, then $arr[0] will contain an array of strings |
| 1358 | + * describing the items that were hidden, $arr[2] will contain an array of strings |
| 1359 | + * describing the items that were unhidden, and $arr[3] will contain an array with |
| 1360 | + * a single string, which can be one of "applied restrictions to sysops", |
| 1361 | + * "removed restrictions from sysops", or null. |
| 1362 | + * |
| 1363 | + * @param int $n The new bitfield. |
| 1364 | + * @param int $o The old bitfield. |
| 1365 | + * @return An array as described above. |
| 1366 | + */ |
| 1367 | + function getChanges ( $n, $o ) |
| 1368 | + { |
| 1369 | + $diff = $n ^ $o; |
| 1370 | + $ret = array ( 0 => array(), 1 => array(), 2 => array() ); |
| 1371 | + |
| 1372 | + $this->checkItem ( wfMsg ( 'revdelete-content' ), 1, $diff, $n, &$ret ); |
| 1373 | + $this->checkItem ( wfMsg ( 'revdelete-summary' ), 2, $diff, $n, &$ret ); |
| 1374 | + $this->checkItem ( wfMsg ( 'revdelete-uname' ), 4, $diff, $n, &$ret ); |
| 1375 | + |
| 1376 | + // Restriction application to sysops |
| 1377 | + if ( $diff & 8 ) { |
| 1378 | + if ( $n & 8 ) |
| 1379 | + $ret[2][] = wfMsg ( 'revdelete-restricted' ); |
| 1380 | + else |
| 1381 | + $ret[2][] = wfMsg ( 'revdelete-unrestricted' ); |
| 1382 | + } |
| 1383 | + |
| 1384 | + return $ret; |
| 1385 | + } |
| 1386 | + |
| 1387 | + /** |
| 1388 | + * Gets a log message to describe the given revision visibility change. This |
| 1389 | + * message will be of the form "[hid {content, edit summary, username}]; |
| 1390 | + * [unhid {...}][applied restrictions to sysops] for $count revisions: $comment". |
| 1391 | + * |
| 1392 | + * @param int $count The number of effected revisions. |
| 1393 | + * @param int $nbitfield The new bitfield for the revision. |
| 1394 | + * @param int $obitfield The old bitfield for the revision. |
| 1395 | + * @param String $comment The comment associated with the change. |
| 1396 | + */ |
| 1397 | + function getLogMessage ( $count, $nbitfield, $obitfield, $comment ) |
| 1398 | + { |
| 1399 | + $s = ''; |
| 1400 | + $changes = $this->getChanges( $nbitfield, $obitfield ); |
| 1401 | + |
| 1402 | + if ( count ( $changes[0] ) ) { |
| 1403 | + $s .= wfMsg ( 'revdelete-hid', implode ( ', ', $changes[0] ) ); |
| 1404 | + } |
| 1405 | + |
| 1406 | + if ( count ( $changes[1] ) ) { |
| 1407 | + if ($s) $s .= '; '; |
| 1408 | + |
| 1409 | + $s .= wfMsg ( 'revdelete-unhid', implode ( ', ', $changes[1] ) ); |
| 1410 | + } |
| 1411 | + |
| 1412 | + if ( count ( $changes[2] )) { |
| 1413 | + if ($s) |
| 1414 | + $s .= ' (' . $changes[2][0] . ')'; |
| 1415 | + else |
| 1416 | + $s = $changes[2][0]; |
| 1417 | + } |
| 1418 | + |
| 1419 | + return wfMsg ( 'revdelete-log-message', $s, $count, $comment ); |
| 1420 | + |
| 1421 | + } |
| 1422 | + |
| 1423 | + /** |
1339 | 1424 | * Record a log entry on the action |
1340 | 1425 | * @param Title $title, page where item was removed from |
1341 | 1426 | * @param int $count the number of revisions altered for this page |
— | — | @@ -1349,17 +1434,16 @@ |
1350 | 1435 | // Put things hidden from sysops in the oversight log |
1351 | 1436 | $logtype = ( ($nbitfield | $obitfield) & Revision::DELETED_RESTRICTED ) ? 'suppress' : 'delete'; |
1352 | 1437 | $log = new LogPage( $logtype ); |
| 1438 | + |
| 1439 | + $reason = $this->getLogMessage ( $count, $nbitfield, $obitfield, $comment ); |
| 1440 | + |
1353 | 1441 | // FIXME: do this better |
1354 | 1442 | if( $param=='logid' ) { |
1355 | 1443 | $params = array( implode( ',', $items) ); |
1356 | | - $reason = wfMsgExt('logdelete-logaction', array('parsemag'), $count, $nbitfield ); |
1357 | | - if($comment) $reason .= ": $comment"; |
1358 | 1444 | $log->addEntry( 'event', $title, $reason, $params ); |
1359 | 1445 | } else { |
1360 | 1446 | // Add params for effected page and ids |
1361 | 1447 | $params = array( $target->getPrefixedText(), $param, implode( ',', $items) ); |
1362 | | - $reason = wfMsgExt('revdelete-logaction', array('parsemag'), $count, $nbitfield ); |
1363 | | - if($comment) $reason .= ": $comment"; |
1364 | 1448 | $log->addEntry( 'revision', $title, $reason, $params ); |
1365 | 1449 | } |
1366 | 1450 | } |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -1210,14 +1210,22 @@ |
1211 | 1211 | 'revdelete-submit' => 'Apply to selected revision', |
1212 | 1212 | 'revdelete-logentry' => 'changed revision visibility of [[$1]]', |
1213 | 1213 | 'logdelete-logentry' => 'changed event visibility of [[$1]]', |
1214 | | -'revdelete-logaction' => '$1 {{PLURAL:$1|revision|revisions}} set to mode $2', |
1215 | | -'logdelete-logaction' => '$1 {{PLURAL:$1|event|events}} set to mode $2', |
1216 | 1214 | 'revdelete-success' => "'''Revision visibility successfully set.'''", |
1217 | 1215 | 'logdelete-success' => "'''Log visibility successfully set.'''", |
1218 | 1216 | 'revdel-restore' => 'Change visiblity', |
1219 | 1217 | 'pagehist' => 'Page history', |
1220 | 1218 | 'deletedhist' => 'Deleted history', |
1221 | 1219 | |
| 1220 | +# Revision deletion - log messages |
| 1221 | +'revdelete-content' => 'content', |
| 1222 | +'revdelete-summary' => 'edit summary', |
| 1223 | +'revdelete-uname' => 'username', |
| 1224 | +'revdelete-restricted' => 'applied restrictions to sysops', |
| 1225 | +'revdelete-unrestricted' => 'removed restrictions for sysops', |
| 1226 | +'revdelete-hid' => 'hid $1', |
| 1227 | +'revdelete-unhid' => 'unhid $1', |
| 1228 | +'revdelete-log-message' => '$1 for $2 {{PLURAL:$2|revisions|revision}}: $3', |
| 1229 | + |
1222 | 1230 | # Suppression log |
1223 | 1231 | 'suppressionlog' => 'Suppression log', |
1224 | 1232 | 'suppressionlogtext' => 'Below is a list of the most recent deletions and blocks involving content hidden from sysops. See the [[Special:Ipblocklist|IP block list]] for the list of currently operational bans and blocks.', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -62,6 +62,7 @@ |
63 | 63 | * (bug 13450) Email confirmation can now be canceled before the expiration |
64 | 64 | * (bug 13490) Show upload/file size limit on upload form |
65 | 65 | * Redesign of Special:Userrights |
| 66 | +* Make rev_deleted log entries more intelligible. |
66 | 67 | |
67 | 68 | === Bug fixes in 1.13 === |
68 | 69 | |