Avoid usage of deprecated setTags() method, use addTags() instead
$tags can be `null` as seen in most cases and this causes failures, so, the safer path is to make sure if $tags is a null, do nothing. Change-Id: I5b7e39adba5d08fdcd42c437a72a391be98c8695
This commit is contained in:
parent
2d911d1f8c
commit
89cd937798
14 changed files with 22 additions and 20 deletions
|
|
@ -181,7 +181,7 @@ class FileDeleteForm {
|
|||
$logEntry->setPerformer( $user );
|
||||
$logEntry->setTarget( $title );
|
||||
$logEntry->setComment( $logComment );
|
||||
$logEntry->setTags( $tags );
|
||||
$logEntry->addTags( $tags );
|
||||
$logid = $logEntry->insert();
|
||||
$logEntry->publish( $logid );
|
||||
|
||||
|
|
@ -212,7 +212,7 @@ class FileDeleteForm {
|
|||
$logEntry->setPerformer( $user );
|
||||
$logEntry->setTarget( clone $title );
|
||||
$logEntry->setComment( $reason );
|
||||
$logEntry->setTags( $tags );
|
||||
$logEntry->addTags( $tags );
|
||||
$logid = $logEntry->insert();
|
||||
$dbw->onTransactionPreCommitOrIdle(
|
||||
function () use ( $logEntry, $logid ) {
|
||||
|
|
|
|||
|
|
@ -598,7 +598,7 @@ class MovePage {
|
|||
'4::oldtitle' => $this->oldTitle->getPrefixedText(),
|
||||
] );
|
||||
$logEntry->setRelations( [ 'pr_id' => $logRelationsValues ] );
|
||||
$logEntry->setTags( $changeTags );
|
||||
$logEntry->addTags( $changeTags );
|
||||
$logId = $logEntry->insert();
|
||||
$logEntry->publish( $logId );
|
||||
}
|
||||
|
|
@ -895,7 +895,7 @@ class MovePage {
|
|||
# Log the move
|
||||
$logid = $logEntry->insert();
|
||||
|
||||
$logEntry->setTags( $changeTags );
|
||||
$logEntry->addTags( $changeTags );
|
||||
$logEntry->publish( $logid );
|
||||
|
||||
return $nullRevision;
|
||||
|
|
|
|||
|
|
@ -1001,7 +1001,7 @@ class ChangeTags {
|
|||
}
|
||||
$logEntry->setParameters( $params );
|
||||
$logEntry->setRelations( [ 'Tag' => $tag ] );
|
||||
$logEntry->setTags( $logEntryTags );
|
||||
$logEntry->addTags( $logEntryTags );
|
||||
|
||||
$logId = $logEntry->insert( $dbw );
|
||||
$logEntry->publish( $logId );
|
||||
|
|
|
|||
|
|
@ -1758,7 +1758,7 @@ class LocalFile extends File {
|
|||
|
||||
# Add change tags, if any
|
||||
if ( $tags ) {
|
||||
$logEntry->setTags( $tags );
|
||||
$logEntry->addTags( $tags );
|
||||
}
|
||||
|
||||
# Uploads can be patrolled
|
||||
|
|
|
|||
|
|
@ -191,18 +191,20 @@ class ManualLogEntry extends LogEntryBase implements Taggable {
|
|||
wfDebug( 'Overwriting existing ManualLogEntry tags' );
|
||||
}
|
||||
$this->tags = [];
|
||||
if ( $tags !== null ) {
|
||||
$this->addTags( $tags );
|
||||
}
|
||||
$this->addTags( $tags );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add change tags for the log entry
|
||||
*
|
||||
* @since 1.33
|
||||
* @param string|string[] $tags Tags to apply
|
||||
* @param string|string[]|null $tags Tags to apply
|
||||
*/
|
||||
public function addTags( $tags ) {
|
||||
if ( $tags === null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( is_string( $tags ) ) {
|
||||
$tags = [ $tags ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class PatrolLog {
|
|||
$entry->setTarget( $rc->getTitle() );
|
||||
$entry->setParameters( self::buildParams( $rc, $auto ) );
|
||||
$entry->setPerformer( $user );
|
||||
$entry->setTags( $tags );
|
||||
$entry->addTags( $tags );
|
||||
$logid = $entry->insert();
|
||||
if ( !$auto ) {
|
||||
$entry->publish( $logid, 'udp' );
|
||||
|
|
|
|||
|
|
@ -461,7 +461,7 @@ class PageArchive {
|
|||
$logEntry->setPerformer( $user );
|
||||
$logEntry->setTarget( $this->title );
|
||||
$logEntry->setComment( $comment );
|
||||
$logEntry->setTags( $tags );
|
||||
$logEntry->addTags( $tags );
|
||||
$logEntry->setParameters( [
|
||||
':assoc:count' => [
|
||||
'revisions' => $textRestored,
|
||||
|
|
|
|||
|
|
@ -2390,7 +2390,7 @@ class WikiPage implements Page, IDBAccessObject {
|
|||
if ( !is_null( $nullRevision ) ) {
|
||||
$logEntry->setAssociatedRevId( $nullRevision->getId() );
|
||||
}
|
||||
$logEntry->setTags( $tags );
|
||||
$logEntry->addTags( $tags );
|
||||
if ( $logRelationsField !== null && count( $logRelationsValues ) ) {
|
||||
$logEntry->setRelations( [ $logRelationsField => $logRelationsValues ] );
|
||||
}
|
||||
|
|
@ -2791,7 +2791,7 @@ class WikiPage implements Page, IDBAccessObject {
|
|||
$logEntry->setPerformer( $deleter );
|
||||
$logEntry->setTarget( $logTitle );
|
||||
$logEntry->setComment( $reason );
|
||||
$logEntry->setTags( $tags );
|
||||
$logEntry->addTags( $tags );
|
||||
$logid = $logEntry->insert();
|
||||
|
||||
$dbw->onTransactionPreCommitOrIdle(
|
||||
|
|
|
|||
|
|
@ -394,7 +394,7 @@ abstract class RevDelList extends RevisionListBase {
|
|||
}
|
||||
$logEntry->setRelations( $relations );
|
||||
// Apply change tags to the log entry
|
||||
$logEntry->setTags( $params['tags'] );
|
||||
$logEntry->addTags( $params['tags'] );
|
||||
$logId = $logEntry->insert();
|
||||
$logEntry->publish( $logId );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1031,7 +1031,7 @@ class SpecialBlock extends FormSpecialPage {
|
|||
$logId = $logEntry->insert();
|
||||
|
||||
if ( !empty( $data['Tags'] ) ) {
|
||||
$logEntry->setTags( $data['Tags'] );
|
||||
$logEntry->addTags( $data['Tags'] );
|
||||
}
|
||||
|
||||
$logEntry->publish( $logId );
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ class SpecialPageLanguage extends FormSpecialPage {
|
|||
$entry->setTarget( $title );
|
||||
$entry->setParameters( $logParams );
|
||||
$entry->setComment( $reason );
|
||||
$entry->setTags( $tags );
|
||||
$entry->addTags( $tags );
|
||||
|
||||
$logid = $entry->insert();
|
||||
$entry->publish( $logid );
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ class SpecialUnblock extends SpecialPage {
|
|||
$logEntry->setComment( $data['Reason'] );
|
||||
$logEntry->setPerformer( $performer );
|
||||
if ( isset( $data['Tags'] ) ) {
|
||||
$logEntry->setTags( $data['Tags'] );
|
||||
$logEntry->addTags( $data['Tags'] );
|
||||
}
|
||||
$logEntry->setRelations( [ 'ipb_id' => $block->getId() ] );
|
||||
$logId = $logEntry->insert();
|
||||
|
|
|
|||
|
|
@ -464,7 +464,7 @@ class UserrightsPage extends SpecialPage {
|
|||
] );
|
||||
$logid = $logEntry->insert();
|
||||
if ( count( $tags ) ) {
|
||||
$logEntry->setTags( $tags );
|
||||
$logEntry->addTags( $tags );
|
||||
}
|
||||
$logEntry->publish( $logid );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ class ImportReporter extends ContextSource {
|
|||
// Make sure the null revision will be tagged as well
|
||||
$logEntry->setAssociatedRevId( $nullRevId );
|
||||
if ( count( $this->logTags ) ) {
|
||||
$logEntry->setTags( $this->logTags );
|
||||
$logEntry->addTags( $this->logTags );
|
||||
}
|
||||
$logid = $logEntry->insert();
|
||||
$logEntry->publish( $logid );
|
||||
|
|
|
|||
Loading…
Reference in a new issue