* Suppress PHP warning about set_time_limit in installer when safe mode is on
* (bug 3000) Fall back to SCRIPT_NAME plus QUERY_STRING when REQUEST_URI is
not available, as on IIS with PHP-CGI
-
+* (bug 8621) Log revisions marked as patrolled
== Languages updated ==
# Mark as patrolled if the user can do so
if( $wgUser->isAllowed( 'autopatrol' ) ) {
RecentChange::markPatrolled( $rcid );
+ PatrolLog::record( $rcid, true );
}
}
$wgUser->incEditCount();
# Mark as patrolled if the user can
if( $wgUser->isAllowed( 'autopatrol' ) ) {
RecentChange::markPatrolled( $rcid );
+ PatrolLog::record( $rcid, true );
}
}
$wgUser->incEditCount();
# Mark the edit as patrolled
RecentChange::markPatrolled( $rcid );
+ PatrolLog::record( $rcid );
wfRunHooks( 'MarkPatrolledComplete', array( &$rcid, &$wgUser, false ) );
# Inform the user
'UserloginTemplate' => 'includes/templates/Userlogin.php',
'Language' => 'languages/Language.php',
'PasswordResetForm' => 'includes/SpecialResetpass.php',
+ 'PatrolLog' => 'includes/PatrolLog.php',
// API classes
'ApiBase' => 'includes/api/ApiBase.php',
'delete',
'upload',
'move',
- 'import' );
+ 'import',
+ 'patrol',
+);
/**
* Lists the message key string for each log type. The localized messages
'delete' => 'dellogpage',
'upload' => 'uploadlogpage',
'move' => 'movelogpage',
- 'import' => 'importlogpage' );
+ 'import' => 'importlogpage',
+ 'patrol' => 'patrol-log-page',
+);
/**
* Lists the message key string for descriptive text to be shown at the
'delete' => 'dellogpagetext',
'upload' => 'uploadlogpagetext',
'move' => 'movelogpagetext',
- 'import' => 'importlogpagetext', );
+ 'import' => 'importlogpagetext',
+ 'patrol' => 'patrol-log-header',
+);
/**
* Lists the message key string for formatting individual events of each
'move/move' => '1movedto2',
'move/move_redir' => '1movedto2_redir',
'import/upload' => 'import-logentry-upload',
- 'import/interwiki' => 'import-logentry-interwiki' );
+ 'import/interwiki' => 'import-logentry-interwiki',
+);
/**
* Experimental preview feature to fetch rendered text
global $wgLang, $wgContLang, $wgLogActions;
$key = "$type/$action";
+
+ if( $key == 'patrol/patrol' )
+ return PatrolLog::makeActionText( $title, $params, $skin );
+
if( isset( $wgLogActions[$key] ) ) {
if( is_null( $title ) ) {
$rv=wfMsg( $wgLogActions[$key] );
--- /dev/null
+<?php
+
+/**
+ * Class containing static functions for working with
+ * logs of patrol events
+ *
+ * @package MediaWiki
+ * @author Rob Church <robchur@gmail.com>
+ */
+class PatrolLog {
+
+ /**
+ * Record a log event for a change being patrolled
+ *
+ * @param mixed $change Change identifier or RecentChange object
+ * @param bool $auto Was this patrol event automatic?
+ */
+ public static function record( $change, $auto = false ) {
+ if( !( is_object( $change ) && $change instanceof RecentChange ) ) {
+ $change = RecentChange::newFromId( $change );
+ if( !is_object( $change ) )
+ return false;
+ }
+ $title = Title::makeTitleSafe( $change->getAttribute( 'rc_namespace' ),
+ $change->getAttribute( 'rc_title' ) );
+ if( is_object( $title ) ) {
+ $params = self::buildParams( $change, $auto );
+ $log = new LogPage( 'patrol', false ); # False suppresses RC entries
+ $log->addEntry( 'patrol', $title, '', $params );
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Generate the log action text corresponding to a patrol log item
+ *
+ * @param Title $title Title of the page that was patrolled
+ * @param array $params Log parameters (from logging.log_params)
+ * @param Skin $skin Skin to use for building links, etc.
+ * @return string
+ */
+ public static function makeActionText( $title, $params, $skin ) {
+ # This is a bit of a hack, but...if $skin is not a Skin, then *do nothing*
+ # -- this is fine, because the action text we would be queried for under
+ # these conditions would have gone into recentchanges, which we aren't
+ # supposed to be updating
+ if( is_object( $skin ) ) {
+ list( $cur, $prev, $auto ) = $params;
+ # Standard link to the page in question
+ $link = $skin->makeLinkObj( $title );
+ # Generate a diff link
+ $bits[] = 'oldid=' . urlencode( $cur );
+ $bits[] = 'diff=prev';
+ $bits = implode( '&', $bits );
+ $diff = $skin->makeLinkObj( $title, htmlspecialchars( wfMsg( 'patrol-log-diff', $cur ) ), $bits );
+ # Indicate whether or not the patrolling was automatic
+ $auto = $auto ? wfMsgHtml( 'patrol-log-auto' ) : '';
+ # Put it all together
+ return wfMsgHtml( 'patrol-log-line', $diff, $link, $auto );
+ } else {
+ return '';
+ }
+ }
+
+ /**
+ * Prepare log parameters for a patrolled change
+ *
+ * @param RecentChange $change RecentChange to represent
+ * @param bool $auto Whether the patrol event was automatic
+ * @return array
+ */
+ private static function buildParams( $change, $auto ) {
+ return array(
+ $change->getAttribute( 'rc_this_oldid' ),
+ $change->getAttribute( 'rc_last_oldid' ),
+ (int)$auto
+ );
+ }
+
+}
+
+?>
\ No newline at end of file
'markedaspatrollederrortext' => "You need to specify a revision to mark as patrolled.",
'markedaspatrollederror-noautopatrol' => 'You are not allowed to mark your own changes as patrolled.',
+# Patrol log
+'patrol-log-page' => 'Patrol log',
+'patrol-log-header' => '',
+'patrol-log-line' => 'marked $1 of $2 patrolled $3',
+'patrol-log-auto' => '(automatic)',
+'patrol-log-diff' => 'r$1',
+
# image deletion
'deletedrevision' => 'Deleted old revision $1.',