summaryrefslogtreecommitdiff
path: root/includes/PatrolLog.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2012-05-03 13:01:35 +0200
committerPierre Schmitz <pierre@archlinux.de>2012-05-03 13:01:35 +0200
commitd9022f63880ce039446fba8364f68e656b7bf4cb (patch)
tree16b40fbf17bf7c9ee6f4ead25b16dd192378050a /includes/PatrolLog.php
parent27cf83d177256813e2e802241085fce5dd0f3fb9 (diff)
Update to MediaWiki 1.19.0
Diffstat (limited to 'includes/PatrolLog.php')
-rw-r--r--includes/PatrolLog.php88
1 files changed, 0 insertions, 88 deletions
diff --git a/includes/PatrolLog.php b/includes/PatrolLog.php
deleted file mode 100644
index 0df48a85..00000000
--- a/includes/PatrolLog.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-
-/**
- * Class containing static functions for working with
- * logs of patrol events
- *
- * @author Rob Church <robchur@gmail.com>
- */
-class PatrolLog {
-
- /**
- * Record a log event for a change being patrolled
- *
- * @param $rc Mixed: change identifier or RecentChange object
- * @param $auto Boolean: was this patrol event automatic?
- */
- public static function record( $rc, $auto = false ) {
- if( !( $rc instanceof RecentChange ) ) {
- $rc = RecentChange::newFromId( $rc );
- if( !is_object( $rc ) )
- return false;
- }
- $title = Title::makeTitleSafe( $rc->getAttribute( 'rc_namespace' ), $rc->getAttribute( 'rc_title' ) );
- if( is_object( $title ) ) {
- $params = self::buildParams( $rc, $auto );
- $log = new LogPage( 'patrol', false, $auto ? "skipUDP" : "UDP" ); # False suppresses RC entries
- $log->addEntry( 'patrol', $title, '', $params );
- return true;
- }
- return false;
- }
-
- /**
- * Generate the log action text corresponding to a patrol log item
- *
- * @param $title Title of the page that was patrolled
- * @param $params Array: log parameters (from logging.log_params)
- * @param $lang Language object to use, or false
- * @return String
- */
- public static function makeActionText( $title, $params, $lang ) {
- list( $cur, /* $prev */, $auto ) = $params;
- if( is_object( $lang ) ) {
- # Standard link to the page in question
- $link = Linker::link( $title );
- if( $title->exists() ) {
- # Generate a diff link
- $query = array(
- 'oldid' => $cur,
- 'diff' => 'prev'
- );
-
- $diff = Linker::link(
- $title,
- htmlspecialchars( wfMsg( 'patrol-log-diff', $lang->formatNum( $cur, true ) ) ),
- array(),
- $query,
- array( 'known', 'noclasses' )
- );
- } else {
- # Don't bother with a diff link, it's useless
- $diff = htmlspecialchars( wfMsg( 'patrol-log-diff', $cur ) );
- }
- # 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 {
- $text = $title->getPrefixedText();
- return wfMsgForContent( 'patrol-log-line', wfMsgHtml('patrol-log-diff',$cur), "[[$text]]", '' );
- }
- }
-
- /**
- * Prepare log parameters for a patrolled change
- *
- * @param $change RecentChange to represent
- * @param $auto Boolean: 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
- );
- }
-}