MediaWiki  1.23.2
PatrolLog.php
Go to the documentation of this file.
1 <?php
29 class PatrolLog {
39  public static function record( $rc, $auto = false, User $user = null ) {
40  global $wgLogAutopatrol;
41 
42  // do not log autopatrolled edits if setting disables it
43  if ( $auto && !$wgLogAutopatrol ) {
44  return false;
45  }
46 
47  if ( !$rc instanceof RecentChange ) {
48  $rc = RecentChange::newFromId( $rc );
49  if ( !is_object( $rc ) ) {
50  return false;
51  }
52  }
53 
54  if ( !$user ) {
56  $user = $wgUser;
57  }
58 
59  $entry = new ManualLogEntry( 'patrol', 'patrol' );
60  $entry->setTarget( $rc->getTitle() );
61  $entry->setParameters( self::buildParams( $rc, $auto ) );
62  $entry->setPerformer( $user );
63  $logid = $entry->insert();
64  if ( !$auto ) {
65  $entry->publish( $logid, 'udp' );
66  }
67 
68  return true;
69  }
70 
78  private static function buildParams( $change, $auto ) {
79  return array(
80  '4::curid' => $change->getAttribute( 'rc_this_oldid' ),
81  '5::previd' => $change->getAttribute( 'rc_last_oldid' ),
82  '6::auto' => (int)$auto
83  );
84  }
85 }
$wgUser
$wgUser
Definition: Setup.php:552
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
RecentChange
Utility class for creating new RC entries.
Definition: RecentChange.php:63
PatrolLog\buildParams
static buildParams( $change, $auto)
Prepare log parameters for a patrolled change.
Definition: PatrolLog.php:78
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
RecentChange\newFromId
static newFromId( $rcid)
Obtain the recent change with a given rc_id value.
Definition: RecentChange.php:124
PatrolLog\record
static record( $rc, $auto=false, User $user=null)
Record a log event for a change being patrolled.
Definition: PatrolLog.php:39
PatrolLog
Class containing static functions for working with logs of patrol events.
Definition: PatrolLog.php:29
$user
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Definition: hooks.txt:237
ManualLogEntry
Class for creating log entries manually, for example to inject them into the database.
Definition: LogEntry.php:339
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:59