74 'Passing a Revision for the $revision parameter to ' . __METHOD__ .
75 ' was deprecated in MediaWiki 1.35',
86 $this->newForCategorizationCallback = [ RecentChange::class,
'newForCategorization' ];
99 if ( !defined(
'MW_PHPUNIT_TEST' ) ) {
100 throw new MWException(
'Cannot override newForCategorization callback in operation.' );
102 $this->newForCategorizationCallback = $callback;
109 $this->numTemplateLinks = $this->pageTitle->getBacklinkCache()->getNumLinks(
'templatelinks' );
143 $this->pageTitle->getPrefixedText(),
144 $this->numTemplateLinks
147 $this->getPreviousRevisionTimestamp(),
149 $type === self::CATEGORY_ADDITION
167 Title $categoryTitle,
187 # If no revision is given, the change was probably triggered by parser functions
189 $revisionStore = MediaWikiServices::getInstance()->getRevisionStore();
191 $correspondingRc = $revisionStore->getRecentChange( $this->revision );
192 if ( $correspondingRc ===
null ) {
193 $correspondingRc = $revisionStore->getRecentChange(
195 RevisionStore::READ_LATEST
198 if ( $correspondingRc !==
null ) {
199 $bot = $correspondingRc->getAttribute(
'rc_bot' ) ?: 0;
200 $ip = $correspondingRc->getAttribute(
'rc_ip' ) ?:
'';
201 $lastRevId = $correspondingRc->getAttribute(
'rc_last_oldid' ) ?: 0;
235 if ( $this->revision ) {
236 $userIdentity = $this->revision->getUser( RevisionRecord::RAW );
237 if ( $userIdentity ) {
242 $username =
wfMessage(
'autochange-username' )->inContentLanguage()->text();
244 # User::newFromName() can return false on a badly configured wiki.
245 if ( $user && !$user->isLoggedIn() ) {
246 $user->addToDatabase();
270 self::CATEGORY_ADDITION =>
'recentchanges-page-added-to-category',
271 self::CATEGORY_REMOVAL =>
'recentchanges-page-removed-from-category',
274 $msgKey = $array[
$type];
277 $msgKey .=
'-bundled';
280 return wfMessage( $msgKey, $prefixedText )->inContentLanguage()->text();
290 $rl = MediaWikiServices::getInstance()->getRevisionLookup();
291 $latestRev = $rl->getRevisionByTitle( $this->pageTitle );
293 $previousRev = $rl->getPreviousRevision( $latestRev );
294 if ( $previousRev ) {
295 return $previousRev->getTimestamp();
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
wfDeprecatedMsg( $msg, $version=false, $component=false, $callerOffset=2)
Log a deprecation warning with arbitrary message text.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
getPreviousRevisionTimestamp()
Returns the timestamp of the page's previous revision or null if the latest revision does not refer t...
callable null $newForCategorizationCallback
getChangeMessageText( $type, $prefixedText, $numTemplateLinks)
Returns the change message according to the type of category membership change.
createRecentChangesEntry(Title $categoryTitle, $type)
Create a recentchanges entry using RecentChange::notifyCategorization()
__construct(Title $pageTitle, $revision=null)
notifyCategorization( $timestamp, Title $categoryTitle, ?User $user, $comment, Title $pageTitle, $lastTimestamp, $revision, $added)
triggerCategoryRemovedNotification(Title $categoryTitle)
Create a recentchanges entry for category removals.
triggerCategoryAddedNotification(Title $categoryTitle)
Create a recentchanges entry for category additions.
int $numTemplateLinks
Number of pages this WikiPage is embedded by Set by CategoryMembershipChange::checkTemplateLinks()
getUser()
Get the user associated with this change.
string $timestamp
Current timestamp, set during CategoryMembershipChange::__construct()
Title $pageTitle
Title instance of the categorized page.
RevisionRecord null $revision
Latest Revision instance of the categorized page.
overrideNewForCategorizationCallback(callable $callback)
Overrides the default new for categorization callback This is intended for use while testing and will...
checkTemplateLinks()
Determines the number of template links for recursive link updates.
Represents a title within MediaWiki.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
static newFromIdentity(UserIdentity $identity)
Returns a User object corresponding to the given UserIdentity.