r37369 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r37368‎ | r37369 | r37370 >
Date:06:44, 9 July 2008
Author:werdna
Status:old
Tags:
Comment:
Core change for AbuseFilter extension: allow log entries to specify the doer of the action.
Modified paths:
  • /trunk/phase3/includes/LogPage.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/LogPage.php
@@ -35,7 +35,7 @@
3636 const DELETED_USER = 4;
3737 const DELETED_RESTRICTED = 8;
3838 /* @access private */
39 - var $type, $action, $comment, $params, $target;
 39+ var $type, $action, $comment, $params, $target, $doer;
4040 /* @acess public */
4141 var $updateRecentChanges;
4242
@@ -56,7 +56,6 @@
5757 $fname = 'LogPage::saveContent';
5858
5959 $dbw = wfGetDB( DB_MASTER );
60 - $uid = $wgUser->getId();
6160 $log_id = $dbw->nextSequenceValue( 'log_log_id_seq' );
6261
6362 $this->timestamp = $now = wfTimestampNow();
@@ -65,7 +64,7 @@
6665 'log_type' => $this->type,
6766 'log_action' => $this->action,
6867 'log_timestamp' => $dbw->timestamp( $now ),
69 - 'log_user' => $uid,
 68+ 'log_user' => $this->doer->getId(),
7069 'log_namespace' => $this->target->getNamespace(),
7170 'log_title' => $this->target->getDBkey(),
7271 'log_comment' => $this->comment,
@@ -83,7 +82,7 @@
8483 if( !isset($wgLogRestrictions[$this->type]) || $wgLogRestrictions[$this->type]=='*' ) {
8584 $titleObj = SpecialPage::getTitleFor( 'Log', $this->type );
8685 $rcComment = $this->getRcComment();
87 - RecentChange::notifyLog( $now, $titleObj, $wgUser, $rcComment, '',
 86+ RecentChange::notifyLog( $now, $titleObj, $this->doer, $rcComment, '',
8887 $this->type, $this->action, $this->target, $this->comment, $this->params, $newId );
8988 }
9089 }
@@ -246,8 +245,9 @@
247246 * @param object &$target A title object.
248247 * @param string $comment Description associated
249248 * @param array $params Parameters passed later to wfMsg.* functions
 249+ * @param User $doer The user doing the action
250250 */
251 - function addEntry( $action, $target, $comment, $params = array() ) {
 251+ function addEntry( $action, $target, $comment, $params = array(), $doer = null ) {
252252 if ( !is_array( $params ) ) {
253253 $params = array( $params );
254254 }
@@ -256,6 +256,15 @@
257257 $this->target = $target;
258258 $this->comment = $comment;
259259 $this->params = LogPage::makeParamBlob( $params );
 260+
 261+ if ($doer === null) {
 262+ global $wgUser;
 263+ $doer = $wgUser->getId();
 264+ } elseif (!is_object( $doer ) ) {
 265+ $doer = User::newFromId( $doer );
 266+ }
 267+
 268+ $this->doer = $doer;
260269
261270 $this->actionText = LogPage::actionText( $this->type, $action, $target, NULL, $params );
262271
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -2384,6 +2384,7 @@
23852385 'block-log-flags-nocreate' => 'account creation disabled',
23862386 'block-log-flags-noautoblock' => 'autoblock disabled',
23872387 'block-log-flags-noemail' => 'e-mail blocked',
 2388+'block-log-flags-angry-autoblock' => 'enhanced autoblock enabled',
23882389 'range_block_disabled' => 'The sysop ability to create range blocks is disabled.',
23892390 'ipb_expiry_invalid' => 'Expiry time invalid.',
23902391 'ipb_expiry_temp' => 'Hidden username blocks must be permanent.',

Status & tagging log