jenkins-bot has submitted this change and it was merged.
Change subject: Allow to pass a rev id to a log entry without making it
unpatrolled
......................................................................
Allow to pass a rev id to a log entry without making it unpatrolled
This adds new methods to ManualLogEntry that allow to specify that
a log entry is patrollable. RecentChange::newLogEntry then checks
this in order to allow or not unpatrolled status instead of checking
if there is an associated rev id. This allows to associate a revision
to a log entry without possibly making the recent change unpatrolled,
and extensions can implement patrol of actions not dependent on an
associated revision id.
Bug: T127848
Change-Id: I98298047142819b69639e6ca9d77c5ba982a380c
---
M includes/changes/RecentChange.php
M includes/filerepo/file/LocalFile.php
M includes/logging/LogEntry.php
3 files changed, 37 insertions(+), 7 deletions(-)
Approvals:
Bartosz Dziewoński: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/changes/RecentChange.php
b/includes/changes/RecentChange.php
index b6a0868..f3bbb9e 100644
--- a/includes/changes/RecentChange.php
+++ b/includes/changes/RecentChange.php
@@ -719,11 +719,12 @@
* @param int $newId
* @param string $actionCommentIRC
* @param int $revId Id of associated revision, if any
+ * @param bool $isPatrollable Whether this log entry is patrollable
* @return RecentChange
*/
public static function newLogEntry( $timestamp, &$title, &$user,
$actionComment, $ip,
$type, $action, $target, $logComment, $params, $newId = 0,
$actionCommentIRC = '',
- $revId = 0 ) {
+ $revId = 0, $isPatrollable = false ) {
global $wgRequest;
# # Get pageStatus for email notification
@@ -747,9 +748,8 @@
break;
}
- // Allow unpatrolled status when an associated rev id is passed
- // May be used in core by moves and uploads
- $markPatrolled = ( $revId > 0 ) ? $user->isAllowed(
'autopatrol' ) : true;
+ // Allow unpatrolled status for patrollable log entries
+ $markPatrolled = $isPatrollable ? $user->isAllowed(
'autopatrol' ) : true;
$rc = new RecentChange;
$rc->mTitle = $target;
diff --git a/includes/filerepo/file/LocalFile.php
b/includes/filerepo/file/LocalFile.php
index 0a3ded7..a324283 100644
--- a/includes/filerepo/file/LocalFile.php
+++ b/includes/filerepo/file/LocalFile.php
@@ -1485,6 +1485,9 @@
$logEntry->setTags( $tags );
}
+ # Uploads can be patrolled
+ $logEntry->setIsPatrollable( true );
+
# Now that the log entry is up-to-date, make an RC
entry.
$logEntry->publish( $logId );
diff --git a/includes/logging/LogEntry.php b/includes/logging/LogEntry.php
index 1d0a543..20d0217 100644
--- a/includes/logging/LogEntry.php
+++ b/includes/logging/LogEntry.php
@@ -428,6 +428,9 @@
/** @var int ID of the log entry */
protected $id;
+ /** @var Can this log entry be patrolled? */
+ protected $isPatrollable = false;
+
/** @var bool Whether this is a legacy log entry */
protected $legacy = false;
@@ -543,6 +546,19 @@
$tags = [ $tags ];
}
$this->tags = $tags;
+ }
+
+ /**
+ * Set whether this log entry should be made patrollable
+ * This shouldn't depend on config, only on whether there is full
support
+ * in the software for patrolling this log entry.
+ * False by default
+ *
+ * @since 1.27
+ * @param bool $patrollable
+ */
+ public function setIsPatrollable( $patrollable ) {
+ $this->isPatrollable = (bool)$patrollable;
}
/**
@@ -679,7 +695,8 @@
LogEntryBase::makeParamBlob( $this->getParameters() ),
$newId,
$formatter->getIRCActionComment(), // Used for IRC feeds
- $this->getAssociatedRevId() // Used for e.g. moves and
uploads
+ $this->getAssociatedRevId(), // Used for e.g. moves and
uploads
+ $this->getIsPatrollable()
);
}
@@ -706,8 +723,8 @@
$rc->notifyRCFeeds();
}
- // Log the autopatrol if an associated rev id was passed
- if ( $this->getAssociatedRevId() > 0 &&
+ // Log the autopatrol if the log entry is patrollable
+ if ( $this->getIsPatrollable() &&
$rc->getAttribute( 'rc_patrolled' ) === 1 ) {
PatrolLog::record( $rc, true, $this->getPerformer() );
}
@@ -776,6 +793,16 @@
}
/**
+ * Whether this log entry is patrollable
+ *
+ * @since 1.27
+ * @return bool
+ */
+ public function getIsPatrollable() {
+ return $this->isPatrollable;
+ }
+
+ /**
* @since 1.25
* @return bool
*/
--
To view, visit https://gerrit.wikimedia.org/r/272800
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I98298047142819b69639e6ca9d77c5ba982a380c
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Cenarium <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Cenarium <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits