43 private bool $useRCPatrol;
44 private bool $useNPPatrol;
45 private bool $useFilePatrol;
56 $this->connectionProvider = $connectionProvider;
57 $this->userFactory = $userFactory;
58 $this->hookContainer = $hookContainer;
59 $this->revertedTagUpdateManager = $revertedTagUpdateManager;
84 if ( $tags === null ) {
86 } elseif ( is_string( $tags ) ) {
92 if ( !$this->useRCPatrol &&
95 $recentChange->
getAttribute(
'rc_log_type' ) ==
'upload' ) )
97 return PermissionStatus::newFatal(
'rcpatroldisabled' );
102 && !$performer->isAllowed(
'autopatrol' )
104 return PermissionStatus::newFatal(
'markedaspatrollederror-noautopatrol' );
107 $status = PermissionStatus::newEmpty();
108 $performer->authorizeWrite(
'patrol', $recentChange->
getTitle(), $status );
109 if ( !$status->isGood() ) {
113 $user = $this->userFactory->newFromAuthority( $performer );
114 $hookRunner =
new HookRunner( $this->hookContainer );
116 if ( !$hookRunner->onMarkPatrolled( $recentChange->
getAttribute(
'rc_id' ), $user,
false,
false, $tags ) ) {
117 return PermissionStatus::newFatal(
'hookaborted' );
128 if ( $affectedRowCount === 0 ) {
138 $hookRunner->onMarkPatrolledComplete( $recentChange->
getAttribute(
'rc_id' ), $user,
false,
false );
151 $dbw = $this->connectionProvider->getPrimaryDatabase();
152 $dbw->newUpdateQueryBuilder()
153 ->update(
'recentchanges' )
154 ->set( [
'rc_patrolled' => self::PRC_PATROLLED ] )
157 'rc_patrolled' => self::PRC_UNPATROLLED,
159 ->caller( __METHOD__ )->execute();
161 $affectedRowCount = $dbw->affectedRows();
164 if ( $affectedRowCount === 0 ) {
170 $recentChange->
getTitle()->invalidateCache();
173 $revisionId = $recentChange->
getAttribute(
'rc_this_oldid' );
175 $this->revertedTagUpdateManager->approveRevertedTagForRevision( $revisionId );
178 return $affectedRowCount;
if(!defined('MW_SETUP_CALLBACK'))
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()