Go to the documentation of this file.
26 use Wikimedia\Assert\Assert;
74 $this->newForCategorizationCallback = [
'RecentChange',
'newForCategorization' ];
87 if ( !defined(
'MW_PHPUNIT_TEST' ) ) {
88 throw new MWException(
'Cannot override newForCategorization callback in operation.' );
90 Assert::parameterType(
'callable', $callback,
'$callback' );
91 $this->newForCategorizationCallback = $callback;
98 $this->numTemplateLinks = $this->pageTitle->getBacklinkCache()->getNumLinks(
'templatelinks' );
132 $this->pageTitle->getPrefixedText(),
156 Title $categoryTitle,
176 # If no revision is given, the change was probably triggered by parser functions
178 $correspondingRc = $this->revision->getRecentChange();
179 if ( $correspondingRc ===
null ) {
180 $correspondingRc = $this->revision->getRecentChange( Revision::READ_LATEST );
182 if ( $correspondingRc !==
null ) {
183 $bot = $correspondingRc->getAttribute(
'rc_bot' ) ?: 0;
184 $ip = $correspondingRc->getAttribute(
'rc_ip' ) ?:
'';
185 $lastRevId = $correspondingRc->getAttribute(
'rc_last_oldid' ) ?: 0;
190 $rc = call_user_func_array(
191 $this->newForCategorizationCallback,
222 if ( $this->revision ) {
224 if ( $userId === 0 ) {
233 # User::newFromName() can return false on a badly configured wiki.
235 $user->addToDatabase();
259 self::CATEGORY_ADDITION =>
'recentchanges-page-added-to-category',
260 self::CATEGORY_REMOVAL =>
'recentchanges-page-removed-from-category',
263 $msgKey = $array[
$type];
266 $msgKey .=
'-bundled';
269 return wfMessage( $msgKey, $prefixedText )->inContentLanguage()->text();
280 $this->pageTitle->getPreviousRevisionID( $this->pageTitle->getLatestRevID() )
283 return $previousRev ? $previousRev->getTimestamp() :
null;
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
static newFromId( $id)
Static factory method for creation from a given user ID.
processing should stop and the error should be shown to the user * false
static newFromId( $id, $flags=0)
Load a page revision from a given revision ID number.
callable null $newForCategorizationCallback
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Title $pageTitle
Title instance of the categorized page.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
getChangeMessageText( $type, $prefixedText, $numTemplateLinks)
Returns the change message according to the type of category membership change.
triggerCategoryRemovedNotification(Title $categoryTitle)
Create a recentchanges entry for category removals.
overrideNewForCategorizationCallback( $callback)
Overrides the default new for categorization callback This is intended for use while testing and will...
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
triggerCategoryAddedNotification(Title $categoryTitle)
Create a recentchanges entry for category additions.
string $timestamp
Current timestamp, set during CategoryMembershipChange::__construct()
getPreviousRevisionTimestamp()
Returns the timestamp of the page's previous revision or null if the latest revision does not refer t...
Revision null $revision
Latest Revision instance of the categorized page.
getUser()
Get the user associated with this change.
notifyCategorization( $timestamp, Title $categoryTitle, User $user=null, $comment, Title $pageTitle, $lastTimestamp, $revision, $added)
createRecentChangesEntry(Title $categoryTitle, $type)
Create a recentchanges entry using RecentChange::notifyCategorization()
getVisibility()
Get the deletion bitfield of the revision.
Represents a title within MediaWiki.
__construct(Title $pageTitle, Revision $revision=null)
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<
int $numTemplateLinks
Number of pages this WikiPage is embedded by Set by CategoryMembershipChange::checkTemplateLinks()
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
this hook is for auditing only or null if authentication failed before getting that far $username
checkTemplateLinks()
Determines the number of template links for recursive link updates.