MediaWiki master
MediaWiki\RecentChanges\RecentChangeStore Class Reference

Inherits MediaWiki\RecentChanges\RecentChangeFactory, and MediaWiki\RecentChanges\RecentChangeLookup.

Collaboration diagram for MediaWiki\RecentChanges\RecentChangeStore:

Public Member Functions

 __construct (ActorStoreFactory $actorStoreFactory, ChangeTagsStore $changeTagsStore, IConnectionProvider $connectionProvider, CommentStore $commentStore, HookContainer $hookContainer, JobQueueGroup $jobQueueGroup, PermissionManager $permissionManager, RecentChangeRCFeedNotifier $recentChangeRCFeedNotifier, ServiceOptions $options, TitleFormatter $titleFormatter, WikiPageFactory $wikiPageFactory, UserFactory $userFactory, ?array $extensionSources)
 
 addSourceForTest ( $name, $info)
 Register an rc_source value.
 
 convertSourceToType (string $source)
 Convert an rc_source value to a legacy type string.
Since
1.45
Parameters
string$source
Returns
string

 
 convertTypeToSources ( $type)
 Convert a legacy type string, as used by the API, or an array of such strings, to an array of rc_source values.
Since
1.45
Parameters
string | string[]$type
Returns
string[]

 
 createCategorizationRecentChange (string $timestamp, PageIdentity $categoryTitle, ?UserIdentity $user, string $comment, PageIdentity $pageTitle, int $oldRevId, int $newRevId, bool $bot, string $ip='', int $deleted=0, ?bool $added=null, bool $forImport=false)
 Create a RecentChange for a category membership change.
Parameters
string$timestampTimestamp of the recent change to occur
PageIdentity$categoryTitlethe category a page is being added to or removed from
UserIdentity | null$userUser object of the user that made the change
string$commentChange summary
PageIdentity$pageTitlethe page that is being added or removed
int$oldRevIdParent revision ID of this change
int$newRevIdRevision ID of this change
bool$bottrue, if the change was made by a bot
string$ipIP address of the user, if the change was made anonymously
int$deletedIndicates whether the change has been deleted
bool | null$addedtrue, if the category was added, false for removed
bool$forImportWhether the associated revision was imported
Returns
RecentChange

 
 createEditRecentChange (string $timestamp, PageIdentity $page, bool $minor, UserIdentity $user, string $comment, int $oldId, bool $bot, string $ip='', ?int $oldSize=0, ?int $newSize=0, int $newId=0, int $patrol=0, array $tags=[], ?EditResult $editResult=null)
 Create a RecentChange for an edit.
Parameters
string$timestampTimestamp of the edit to occur
PageIdentity$pagePage of the edit to occur
bool$minorWhether the edit is minor
UserIdentity$userUser who made the edit
string$commentSummary of the edit
int$oldIdID of the previous revision
bool$botWhether the edit was made by a bot
string$ipIP address of the user, if the edit was made anonymously
int | null$oldSizeSize of the previous revision
int | null$newSizeSize of the new revision
int$newIdID of the new revision
int$patrolWhether the edit was patrolled (PRC_UNPATROLLED, PRC_PATROLLED, PRC_AUTOPATROLLED)
string[]$tags
EditResult | null$editResultEditResult associated with this edit. Can be safely skipped if the edit is not a revert. Used only for marking revert tags.
Returns
RecentChange

 
 createLogRecentChange (string $timestamp, PageReference $logPage, UserIdentity $user, string $actionComment, string $ip, string $type, string $action, PageReference $target, string $logComment, string $params, int $newId=0, string $actionCommentIRC='', int $revId=0, bool $isPatrollable=false, ?bool $forceBotFlag=null, int $deleted=0)
 Create a RecentChange for a log entry.
Parameters
string$timestampTimestamp of the log entry to occur
PageReference$logPage
UserIdentity$userUser who performed the log action
string$actionCommentSummary of the log action
string$ipIP address of the user, if the log action was made anonymously
string$typeLog type
string$actionLog action
PageReference$targetTarget of the log action
string$logComment
string$params
int$newId
string$actionCommentIRCIRC comment of the log action
int$revIdId of associated revision, if any
bool$isPatrollableWhether this log entry is patrollable
bool | null$forceBotFlagOverride the default behavior and set bot flag to the value of the argument. When omitted or null, it falls back to the global state.
int$deleted
Returns
RecentChange

 
 createNewPageRecentChange (string $timestamp, PageIdentity $page, bool $minor, UserIdentity $user, string $comment, bool $bot, string $ip='', ?int $size=0, int $newId=0, int $patrol=0, array $tags=[])
 Create a RecentChange for a new page.
Parameters
string$timestampTimestamp of the page creation to occur
PageIdentity$pagecreated page
bool$minorWhether the page creation is minor
UserIdentity$userUser who made the page creation
string$commentSummary of the page creation
bool$botWhether the page creation was made by a bot
string$ipIP address of the user, if the page creation was made anonymously
int | null$sizeSize of the new revision
int$newIdID of the new revision
int$patrolWhether the edit was patrolled (PRC_UNPATROLLED, PRC_PATROLLED, PRC_AUTOPATROLLED)
string[]$tags
Returns
RecentChange

 
 getAllSources ()
 Get all known rc_source values.
 
 getPrimarySources ()
 Get the rc_source values for events that are not replicated from elsewhere.
 
 getRecentChangeByConds (array $conds, string $fname=__METHOD__, bool $fromPrimary=false)
 Get the first recent change matching some specific conditions.
Parameters
array$condsArray of conditions
string$fnameOverride the method name in profiling/logs
bool$fromPrimaryWhether to fetch from the primary database
Returns
RecentChange|null

 
 getRecentChangeById (int $rcid)
 Get a recent change by its ID.
Parameters
int$rcidThe rc_id value to retrieve
Returns
RecentChange|null Null if no such recent change exists

 
 insertRecentChange (RecentChange $recentChange, bool $send=self::SEND_FEED)
 Insert a recent change into the database.For compatibility reasons, the SEND_ constants internally reference a value that may seem negated from their purpose (none=true, feed=false). This is because the parameter used to be called "$noudp", defaulting to false.
Parameters
RecentChange$recentChange
bool$sendself::SEND_FEED or self::SEND_NONE

 
 isFromPrimarySource (RecentChange $rc)
 Check if a recent change is from a primary source.
 
 newRecentChangeFromRow ( $row)
 Create a new RecentChange object from a database row.
Parameters
stdClass$rowDatabase row from recentchanges table
Returns
RecentChange

 

Static Public Member Functions

static isEnotifEnabled (ServiceOptions $options)
 Whether e-mail notifications are generally enabled on this wiki.
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Detailed Description

Since
1.45

Definition at line 37 of file RecentChangeStore.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\RecentChanges\RecentChangeStore::__construct ( ActorStoreFactory $actorStoreFactory,
ChangeTagsStore $changeTagsStore,
IConnectionProvider $connectionProvider,
CommentStore $commentStore,
HookContainer $hookContainer,
JobQueueGroup $jobQueueGroup,
PermissionManager $permissionManager,
RecentChangeRCFeedNotifier $recentChangeRCFeedNotifier,
ServiceOptions $options,
TitleFormatter $titleFormatter,
WikiPageFactory $wikiPageFactory,
UserFactory $userFactory,
?array $extensionSources )

Member Function Documentation

◆ addSourceForTest()

MediaWiki\RecentChanges\RecentChangeStore::addSourceForTest ( $name,
$info )

Register an rc_source value.

Access: internal
For testing
Parameters
string$name
array$info

Definition at line 628 of file RecentChangeStore.php.

◆ convertSourceToType()

MediaWiki\RecentChanges\RecentChangeStore::convertSourceToType ( string $source)

Convert an rc_source value to a legacy type string.

Since
1.45
Parameters
string$source
Returns
string

Implements MediaWiki\RecentChanges\RecentChangeLookup.

Definition at line 685 of file RecentChangeStore.php.

◆ convertTypeToSources()

MediaWiki\RecentChanges\RecentChangeStore::convertTypeToSources ( $type)

Convert a legacy type string, as used by the API, or an array of such strings, to an array of rc_source values.

Since
1.45
Parameters
string | string[]$type
Returns
string[]

Implements MediaWiki\RecentChanges\RecentChangeLookup.

Definition at line 660 of file RecentChangeStore.php.

◆ createCategorizationRecentChange()

MediaWiki\RecentChanges\RecentChangeStore::createCategorizationRecentChange ( string $timestamp,
PageIdentity $categoryTitle,
?UserIdentity $user,
string $comment,
PageIdentity $pageTitle,
int $oldRevId,
int $newRevId,
bool $bot,
string $ip = '',
int $deleted = 0,
?bool $added = null,
bool $forImport = false )

Create a RecentChange for a category membership change.

Parameters
string$timestampTimestamp of the recent change to occur
PageIdentity$categoryTitlethe category a page is being added to or removed from
UserIdentity | null$userUser object of the user that made the change
string$commentChange summary
PageIdentity$pageTitlethe page that is being added or removed
int$oldRevIdParent revision ID of this change
int$newRevIdRevision ID of this change
bool$bottrue, if the change was made by a bot
string$ipIP address of the user, if the change was made anonymously
int$deletedIndicates whether the change has been deleted
bool | null$addedtrue, if the category was added, false for removed
bool$forImportWhether the associated revision was imported
Returns
RecentChange

Implements MediaWiki\RecentChanges\RecentChangeFactory.

Definition at line 532 of file RecentChangeStore.php.

◆ createEditRecentChange()

MediaWiki\RecentChanges\RecentChangeStore::createEditRecentChange ( string $timestamp,
PageIdentity $page,
bool $minor,
UserIdentity $user,
string $comment,
int $oldId,
bool $bot,
string $ip = '',
?int $oldSize = 0,
?int $newSize = 0,
int $newId = 0,
int $patrol = 0,
array $tags = [],
?EditResult $editResult = null )

Create a RecentChange for an edit.

Parameters
string$timestampTimestamp of the edit to occur
PageIdentity$pagePage of the edit to occur
bool$minorWhether the edit is minor
UserIdentity$userUser who made the edit
string$commentSummary of the edit
int$oldIdID of the previous revision
bool$botWhether the edit was made by a bot
string$ipIP address of the user, if the edit was made anonymously
int | null$oldSizeSize of the previous revision
int | null$newSizeSize of the new revision
int$newIdID of the new revision
int$patrolWhether the edit was patrolled (PRC_UNPATROLLED, PRC_PATROLLED, PRC_AUTOPATROLLED)
string[]$tags
EditResult | null$editResultEditResult associated with this edit. Can be safely skipped if the edit is not a revert. Used only for marking revert tags.
Returns
RecentChange

Implements MediaWiki\RecentChanges\RecentChangeFactory.

Definition at line 307 of file RecentChangeStore.php.

◆ createLogRecentChange()

MediaWiki\RecentChanges\RecentChangeStore::createLogRecentChange ( string $timestamp,
PageReference $logPage,
UserIdentity $user,
string $actionComment,
string $ip,
string $type,
string $action,
PageReference $target,
string $logComment,
string $params,
int $newId = 0,
string $actionCommentIRC = '',
int $revId = 0,
bool $isPatrollable = false,
?bool $forceBotFlag = null,
int $deleted = 0 )

Create a RecentChange for a log entry.

Parameters
string$timestampTimestamp of the log entry to occur
PageReference$logPage
UserIdentity$userUser who performed the log action
string$actionCommentSummary of the log action
string$ipIP address of the user, if the log action was made anonymously
string$typeLog type
string$actionLog action
PageReference$targetTarget of the log action
string$logComment
string$params
int$newId
string$actionCommentIRCIRC comment of the log action
int$revIdId of associated revision, if any
bool$isPatrollableWhether this log entry is patrollable
bool | null$forceBotFlagOverride the default behavior and set bot flag to the value of the argument. When omitted or null, it falls back to the global state.
int$deleted
Returns
RecentChange

Implements MediaWiki\RecentChanges\RecentChangeFactory.

Definition at line 429 of file RecentChangeStore.php.

◆ createNewPageRecentChange()

MediaWiki\RecentChanges\RecentChangeStore::createNewPageRecentChange ( string $timestamp,
PageIdentity $page,
bool $minor,
UserIdentity $user,
string $comment,
bool $bot,
string $ip = '',
?int $size = 0,
int $newId = 0,
int $patrol = 0,
array $tags = [] )

Create a RecentChange for a new page.

Parameters
string$timestampTimestamp of the page creation to occur
PageIdentity$pagecreated page
bool$minorWhether the page creation is minor
UserIdentity$userUser who made the page creation
string$commentSummary of the page creation
bool$botWhether the page creation was made by a bot
string$ipIP address of the user, if the page creation was made anonymously
int | null$sizeSize of the new revision
int$newIdID of the new revision
int$patrolWhether the edit was patrolled (PRC_UNPATROLLED, PRC_PATROLLED, PRC_AUTOPATROLLED)
string[]$tags
Returns
RecentChange

Implements MediaWiki\RecentChanges\RecentChangeFactory.

Definition at line 370 of file RecentChangeStore.php.

◆ getAllSources()

MediaWiki\RecentChanges\RecentChangeStore::getAllSources ( )

Get all known rc_source values.

Returns
string[]

Implements MediaWiki\RecentChanges\RecentChangeLookup.

Definition at line 649 of file RecentChangeStore.php.

◆ getPrimarySources()

MediaWiki\RecentChanges\RecentChangeStore::getPrimarySources ( )

Get the rc_source values for events that are not replicated from elsewhere.

Returns
string[]

Implements MediaWiki\RecentChanges\RecentChangeLookup.

Definition at line 632 of file RecentChangeStore.php.

◆ getRecentChangeByConds()

MediaWiki\RecentChanges\RecentChangeStore::getRecentChangeByConds ( array $conds,
string $fname = __METHOD__,
bool $fromPrimary = false )

Get the first recent change matching some specific conditions.

Parameters
array$condsArray of conditions
string$fnameOverride the method name in profiling/logs
bool$fromPrimaryWhether to fetch from the primary database
Returns
RecentChange|null

Implements MediaWiki\RecentChanges\RecentChangeLookup.

Definition at line 118 of file RecentChangeStore.php.

◆ getRecentChangeById()

MediaWiki\RecentChanges\RecentChangeStore::getRecentChangeById ( int $rcid)

Get a recent change by its ID.

Parameters
int$rcidThe rc_id value to retrieve
Returns
RecentChange|null Null if no such recent change exists

Implements MediaWiki\RecentChanges\RecentChangeLookup.

Definition at line 111 of file RecentChangeStore.php.

◆ insertRecentChange()

MediaWiki\RecentChanges\RecentChangeStore::insertRecentChange ( RecentChange $recentChange,
bool $send = self::SEND_FEED )

Insert a recent change into the database.For compatibility reasons, the SEND_ constants internally reference a value that may seem negated from their purpose (none=true, feed=false). This is because the parameter used to be called "$noudp", defaulting to false.

Parameters
RecentChange$recentChange
bool$sendself::SEND_FEED or self::SEND_NONE

Implements MediaWiki\RecentChanges\RecentChangeFactory.

Definition at line 145 of file RecentChangeStore.php.

References MediaWiki\RecentChanges\RecentChange\getAttribute(), MediaWiki\RecentChanges\RecentChange\getAttributes(), MediaWiki\RecentChanges\RecentChange\getEditResult(), MediaWiki\RecentChanges\RecentChange\getExtra(), MediaWiki\RecentChanges\RecentChange\getExtras(), MediaWiki\RecentChanges\RecentChange\getPage(), MediaWiki\RecentChanges\RecentChange\getPerformerIdentity(), MediaWiki\RecentChanges\RecentChange\getTags(), MediaWiki\RecentChanges\RecentChange\setAttribute(), and MediaWiki\RecentChanges\RecentChange\setExtra().

◆ isEnotifEnabled()

static MediaWiki\RecentChanges\RecentChangeStore::isEnotifEnabled ( ServiceOptions $options)
static

Whether e-mail notifications are generally enabled on this wiki.

This is used for:

  • performance optimization in RecentChangeStore::insertRecentChange(). After an edit, whether or not we need to use the RecentChangeNotifier to determine which RecentChangeNotifyJob to dispatch.
  • performance optmization in WatchlistManager. After using reset ("Mark all pages as seen") on Special:Watchlist, whether to only look for user talk data to reset, or whether to look at all possible pages for timestamps to reset.

TODO: Determine whether these optimizations still make sense.

FIXME: The $wgShowUpdatedMarker variable was added to this condtion in 2008 (2cf12c973d, SVN r35001) because at the time the per-user "last seen" marker for watchlist and page history, was managed by the RecentChangeNotifier/UserMailer classes. As of August 2022, this appears to no longer be the case.

Parameters
ServiceOptions$options
Returns
bool

Definition at line 298 of file RecentChangeStore.php.

◆ isFromPrimarySource()

MediaWiki\RecentChanges\RecentChangeStore::isFromPrimarySource ( RecentChange $rc)

Check if a recent change is from a primary source.

Parameters
RecentChange$rc
Returns
bool

Implements MediaWiki\RecentChanges\RecentChangeLookup.

Definition at line 645 of file RecentChangeStore.php.

◆ newRecentChangeFromRow()

MediaWiki\RecentChanges\RecentChangeStore::newRecentChangeFromRow ( $row)

Create a new RecentChange object from a database row.

Parameters
stdClass$rowDatabase row from recentchanges table
Returns
RecentChange

Implements MediaWiki\RecentChanges\RecentChangeFactory.

Definition at line 102 of file RecentChangeStore.php.

Member Data Documentation

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\RecentChanges\RecentChangeStore::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
const EnotifWatchlist
Name constant for the EnotifWatchlist setting, for use with Config::get()
const LogRestrictions
Name constant for the LogRestrictions setting, for use with Config::get()
const EnotifUserTalk
Name constant for the EnotifUserTalk setting, for use with Config::get()
const PutIPinRC
Name constant for the PutIPinRC setting, for use with Config::get()
const ShowUpdatedMarker
Name constant for the ShowUpdatedMarker setting, for use with Config::get()

Definition at line 39 of file RecentChangeStore.php.


The documentation for this class was generated from the following file: