*/
public function doMarkPatrolled( User $user, $auto = false, $tags = null ) {
global $wgUseRCPatrol, $wgUseNPPatrol, $wgUseFilePatrol;
+
$errors = [];
// If recentchanges patrol is disabled, only new pages or new file versions
// can be patrolled, provided the appropriate config variable is set
PatrolLog::record( $this, $auto, $user, $tags );
Hooks::run(
- 'MarkPatrolledComplete',
- [ $this->getAttribute( 'rc_id' ), &$user, false, $auto ]
+ 'MarkPatrolledComplete',
+ [ $this->getAttribute( 'rc_id' ), &$user, false, $auto ]
);
return [];
* @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
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;
* Try to load file metadata from memcached. Returns true on success.
* @return bool
*/
- function loadFromCache() {
+ private function loadFromCache() {
$this->dataLoaded = false;
$this->extraDataLoaded = false;
$key = $this->getCacheKey();
/**
* Save the file metadata to memcached
*/
- function saveToCache() {
+ private function saveToCache() {
$this->load();
$key = $this->getCacheKey();
// Purge any custom thumbnail caches
Hooks::run( 'LocalFilePurgeThumbnails', [ $this, $archiveName ] );
+ // Delete thumbnails
$dir = array_shift( $files );
$this->purgeThumbList( $dir, $files );
* @param array $options
*/
public function purgeThumbnails( $options = [] ) {
- // Delete thumbnails
$files = $this->getThumbnails();
// Always purge all files from CDN regardless of handler filters
$urls = [];
// Purge any custom thumbnail caches
Hooks::run( 'LocalFilePurgeThumbnails', [ $this, false ] );
+ // Delete thumbnails
$dir = array_shift( $files );
$this->purgeThumbList( $dir, $files );
$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 );
$this->newName = $this->file->repo->getNameFromTitle( $this->target );
$this->oldRel = $this->oldHash . $this->oldName;
$this->newRel = $this->newHash . $this->newName;
- $this->db = $file->getRepo()->getMasterDb();
+ $this->db = $file->getRepo()->getMasterDB();
}
/**