Migrate to modern logging system (part 1)
Start easy for easier review. LogFormatters get a new namespace.
Bug: T41045
Bug: T138728
Bug: T153322
Change-Id: I1233ecef7c8cb4bd5fb8e7f90897aa2dfde90d16
diff --git a/includes/CentralAuthUser.php b/includes/CentralAuthUser.php
index f0dc626..81ff2c4 100644
--- a/includes/CentralAuthUser.php
+++ b/includes/CentralAuthUser.php
@@ -1749,12 +1749,10 @@
if ( !$isLocked && $setLocked ) {
$lockStatus = $this->adminLock();
- $added[] =
- $context->msg( 'centralauth-log-status-locked' )->inContentLanguage()->text();
+ $added[] = 'locked';
} elseif ( $isLocked && !$setLocked ) {
$lockStatus = $this->adminUnlock();
- $removed[] =
- $context->msg( 'centralauth-log-status-locked' )->inContentLanguage()->text();
+ $removed[] = 'locked';
}
if ( $oldHiddenLevel != $setHidden ) {
@@ -1762,27 +1760,21 @@
switch ( $setHidden ) {
case self::HIDDEN_NONE:
if ( $oldHiddenLevel == self::HIDDEN_OVERSIGHT ) {
- $removed[] = $context->msg( 'centralauth-log-status-oversighted' )
- ->inContentLanguage()->text();
+ $removed[] = 'oversighted';
} else {
- $removed[] = $context->msg( 'centralauth-log-status-hidden' )
- ->inContentLanguage()->text();
+ $removed[] = 'hidden';
}
break;
case self::HIDDEN_LISTS:
- $added[] = $context->msg( 'centralauth-log-status-hidden' )
- ->inContentLanguage()->text();
+ $added[] = 'hidden';
if ( $oldHiddenLevel == self::HIDDEN_OVERSIGHT ) {
- $removed[] = $context->msg( 'centralauth-log-status-oversighted' )
- ->inContentLanguage()->text();
+ $removed[] = 'oversighted';
}
break;
case self::HIDDEN_OVERSIGHT:
- $added[] = $context->msg( 'centralauth-log-status-oversighted' )
- ->inContentLanguage()->text();
+ $added[] = 'oversighted';
if ( $oldHiddenLevel == self::HIDDEN_LISTS ) {
- $removed[] = $context->msg( 'centralauth-log-status-hidden' )
- ->inContentLanguage()->text();
+ $removed[] = 'hidden';
}
break;
}
@@ -1800,16 +1792,10 @@
// Setup Status object to return all of the information for logging
if ( $good && ( $added || $removed ) ) {
- $noChange = $context->msg( 'centralauth-log-status-none' )
- ->inContentLanguage()->text();
-
- $addedMsg = count( $added ) ? implode( ', ', $added ) : $noChange;
- $removedMsg = count( $removed ) ? implode( ', ', $removed ) : $noChange;
-
$returnStatus->successCount = count( $added ) + count( $removed );
$logParams = [
- 'added' => $addedMsg,
- 'removed' => $removedMsg,
+ 'added' => $added,
+ 'removed' => $removed,
];
$this->logAction(
@@ -3110,14 +3096,13 @@
->getCanonicalName( NS_USER );
// Not centralauth because of some weird length limitiations
$logType = $suppressLog ? 'suppress' : 'globalauth';
- $log = new LogPage( $logType );
- $log->addEntry(
- $action,
- Title::newFromText( $nsUser . ":{$this->mName}@global" ),
- $reason,
- $params,
- $user
- );
+ $entry = new ManualLogEntry( $logType, $action );
+ $entry->setTarget( Title::newFromText( "$nsUser:{$this->mName}@global" ) );
+ $entry->setPerformer( $user );
+ $entry->setComment( $reason );
+ $entry->setParameters( $params );
+ $logid = $entry->insert();
+ $entry->publish( $logid );
}
/**