46 private bool $useRCPatrol;
47 private bool $useNPPatrol;
48 private bool $useFilePatrol;
59 $this->connectionProvider = $connectionProvider;
60 $this->userFactory = $userFactory;
61 $this->hookContainer = $hookContainer;
62 $this->revertedTagUpdateManager = $revertedTagUpdateManager;
87 if ( $tags === null ) {
89 } elseif ( is_string( $tags ) ) {
95 if ( !$this->useRCPatrol &&
98 $recentChange->
getAttribute(
'rc_log_type' ) ==
'upload' ) )
100 return PermissionStatus::newFatal(
'rcpatroldisabled' );
105 && !$performer->isAllowed(
'autopatrol' )
107 return PermissionStatus::newFatal(
'markedaspatrollederror-noautopatrol' );
110 $status = PermissionStatus::newEmpty();
111 $performer->authorizeWrite(
'patrol', $recentChange->
getTitle(), $status );
112 if ( !$status->isGood() ) {
116 $user = $this->userFactory->newFromAuthority( $performer );
117 $hookRunner =
new HookRunner( $this->hookContainer );
119 if ( !$hookRunner->onMarkPatrolled( $recentChange->
getAttribute(
'rc_id' ), $user,
false,
false, $tags ) ) {
120 return PermissionStatus::newFatal(
'hookaborted' );
131 if ( $affectedRowCount === 0 ) {
141 $hookRunner->onMarkPatrolledComplete( $recentChange->
getAttribute(
'rc_id' ), $user,
false,
false );
142 $hookRunner->onMarkPatrolledAudit( $recentChange, $user, $logId );
155 $dbw = $this->connectionProvider->getPrimaryDatabase();
156 $dbw->newUpdateQueryBuilder()
157 ->update(
'recentchanges' )
158 ->set( [
'rc_patrolled' => self::PRC_PATROLLED ] )
161 'rc_patrolled' => self::PRC_UNPATROLLED,
163 ->caller( __METHOD__ )->execute();
165 $affectedRowCount = $dbw->affectedRows();
168 if ( $affectedRowCount === 0 ) {
174 $recentChange->
getTitle()->invalidateCache();
177 $revisionId = $recentChange->
getAttribute(
'rc_this_oldid' );
179 $this->revertedTagUpdateManager->approveRevertedTagForRevision( $revisionId );
182 return $affectedRowCount;
202 $page = $recentChange->
getPage() ?? PageReferenceValue::localReference(
NS_SPECIAL,
'Badtitle' );
203 $entry->setTarget( $page );
204 $entry->setParameters( [
205 '4::curid' => $recentChange->
getAttribute(
'rc_this_oldid' ),
206 '5::previd' => $recentChange->
getAttribute(
'rc_last_oldid' ),
209 $entry->setPerformer( $user );
210 $entry->addTags( $tags );
212 $logId = $entry->insert();
213 $entry->publish( $logId,
'udp' );
if(!defined('MW_SETUP_CALLBACK'))
Class for creating new log entries and inserting them into the database.
A class containing constants representing the names of configuration variables.
const UseRCPatrol
Name constant for the UseRCPatrol setting, for use with Config::get()
const UseNPPatrol
Name constant for the UseNPPatrol setting, for use with Config::get()
const UseFilePatrol
Name constant for the UseFilePatrol setting, for use with Config::get()