Go to the documentation of this file.
130 if ( is_array(
$type ) ) {
139 if ( !array_key_exists(
$type, self::$changeTypes ) ) {
142 return self::$changeTypes[
$type];
152 return array_search( $rcType, self::$changeTypes,
true ) ?:
"$rcType";
163 return array_keys( self::$changeTypes );
191 $row = $db->selectRow(
'recentchanges', self::selectFields(), $conds,
$fname );
192 if ( $row !==
false ) {
246 $this->mExtra = $extra;
253 if ( $this->mTitle ===
false ) {
254 $this->mTitle =
Title::makeTitle( $this->mAttribs[
'rc_namespace'], $this->mAttribs[
'rc_title'] );
266 if ( $this->mPerformer ===
false ) {
267 if ( $this->mAttribs[
'rc_user'] ) {
281 public function save( $noudp =
false ) {
285 if ( !is_array( $this->mExtra ) ) {
289 if ( !$wgPutIPinRC ) {
290 $this->mAttribs[
'rc_ip'] =
'';
293 # Strict mode fixups (not-NULL fields)
294 foreach ( [
'minor',
'bot',
'new',
'patrolled',
'deleted' ]
as $field ) {
295 $this->mAttribs[
"rc_$field"] = (int)$this->mAttribs[
"rc_$field"];
297 # ...more fixups (NULL fields)
298 foreach ( [
'old_len',
'new_len' ]
as $field ) {
299 $this->mAttribs[
"rc_$field"] = isset( $this->mAttribs[
"rc_$field"] )
300 ? (int)$this->mAttribs[
"rc_$field"]
304 # If our database is strict about IP addresses, use NULL instead of an empty string
305 $strictIPs = in_array( $dbw->getType(), [
'oracle',
'postgres' ] );
306 if ( $strictIPs && $this->mAttribs[
'rc_ip'] ==
'' ) {
307 unset( $this->mAttribs[
'rc_ip'] );
310 # Trim spaces on user supplied text
311 $this->mAttribs[
'rc_comment'] = trim( $this->mAttribs[
'rc_comment'] );
313 # Make sure summary is truncated (whole multibyte characters)
314 $this->mAttribs[
'rc_comment'] =
$wgContLang->truncate( $this->mAttribs[
'rc_comment'], 255 );
316 # Fixup database timestamps
317 $this->mAttribs[
'rc_timestamp'] = $dbw->timestamp( $this->mAttribs[
'rc_timestamp'] );
318 $this->mAttribs[
'rc_id'] = $dbw->nextSequenceValue(
'recentchanges_rc_id_seq' );
320 # # If we are using foreign keys, an entry of 0 for the page_id will fail, so use NULL
321 if ( $this->mAttribs[
'rc_cur_id'] == 0 ) {
322 unset( $this->mAttribs[
'rc_cur_id'] );
326 $dbw->insert(
'recentchanges', $this->mAttribs, __METHOD__ );
329 $this->mAttribs[
'rc_id'] = $dbw->insertId();
336 if (
count( $this->tags ) ) {
338 $this->mAttribs[
'rc_this_oldid'], $this->mAttribs[
'rc_logid'],
null, $this );
341 # Notify external application via UDP
346 # E-mail notifications
347 if ( $wgUseEnotif || $wgShowUpdatedMarker ) {
358 $dbw->onTransactionIdle(
361 $enotif->notifyOnPageChange(
364 $this->mAttribs[
'rc_timestamp'],
365 $this->mAttribs[
'rc_comment'],
366 $this->mAttribs[
'rc_minor'],
367 $this->mAttribs[
'rc_last_oldid'],
368 $this->mExtra[
'pageStatus']
377 if ( $this->mAttribs[
'rc_user'] > 0 ) {
388 if ( $feeds ===
null ) {
396 'omit_bots' =>
false,
397 'omit_anon' =>
false,
398 'omit_user' =>
false,
399 'omit_minor' =>
false,
400 'omit_patrolled' =>
false,
404 (
$params[
'omit_bots'] && $this->mAttribs[
'rc_bot'] ) ||
405 (
$params[
'omit_anon'] && $performer->isAnon() ) ||
406 (
$params[
'omit_user'] && !$performer->isAnon() ) ||
407 (
$params[
'omit_minor'] && $this->mAttribs[
'rc_minor'] ) ||
408 (
$params[
'omit_patrolled'] && $this->mAttribs[
'rc_patrolled'] ) ||
414 if ( isset( $this->mExtra[
'actionCommentIRC'] ) ) {
415 $actionComment = $this->mExtra[
'actionCommentIRC'];
417 $actionComment =
null;
421 $feed->notify( $this, $actionComment );
435 $scheme = parse_url( $uri, PHP_URL_SCHEME );
437 throw new MWException(
"Invalid RCFeed uri: '$uri'" );
439 if ( !isset( $wgRCEngines[$scheme] ) ) {
440 throw new MWException(
"Unknown RCFeedEngine scheme: '$scheme'" );
442 if ( defined(
'MW_PHPUNIT_TEST' ) && is_object( $wgRCEngines[$scheme] ) ) {
443 return $wgRCEngines[$scheme];
445 return new $wgRCEngines[$scheme](
$params );
483 global $wgUseRCPatrol, $wgUseNPPatrol, $wgUseFilePatrol;
488 if ( !$wgUseRCPatrol && ( !$wgUseNPPatrol || $this->
getAttribute(
'rc_type' ) !=
RC_NEW ) &&
490 $this->
getAttribute(
'rc_log_type' ) ==
'upload' ) ) ) {
491 $errors[] = [
'rcpatroldisabled' ];
494 $right =
$auto ?
'autopatrol' :
'patrol';
495 $errors = array_merge( $errors, $this->
getTitle()->getUserPermissionsErrors( $right,
$user ) );
499 $errors[] = [
'hookaborted' ];
506 $errors[] = [
'markedaspatrollederror-noautopatrol' ];
521 'MarkPatrolledComplete',
546 $this->
getTitle()->invalidateCache();
548 return $dbw->affectedRows();
571 $timestamp, &
$title, $minor, &
$user, $comment, $oldId, $lastTimestamp,
572 $bot, $ip =
'', $oldSize = 0, $newSize = 0, $newId = 0, $patrol = 0,
577 $rc->mPerformer =
$user;
579 'rc_timestamp' => $timestamp,
580 'rc_namespace' =>
$title->getNamespace(),
581 'rc_title' =>
$title->getDBkey(),
584 'rc_minor' => $minor ? 1 : 0,
585 'rc_cur_id' =>
$title->getArticleID(),
586 'rc_user' =>
$user->getId(),
587 'rc_user_text' =>
$user->getName(),
588 'rc_comment' => $comment,
589 'rc_this_oldid' => $newId,
590 'rc_last_oldid' => $oldId,
591 'rc_bot' => $bot ? 1 : 0,
593 'rc_patrolled' => intval( $patrol ),
594 'rc_new' => 0, # obsolete
595 'rc_old_len' => $oldSize,
596 'rc_new_len' => $newSize,
599 'rc_log_type' =>
null,
600 'rc_log_action' =>
'',
605 'prefixedDBkey' =>
$title->getPrefixedDBkey(),
606 'lastTimestamp' => $lastTimestamp,
607 'oldSize' => $oldSize,
608 'newSize' => $newSize,
609 'pageStatus' =>
'changed'
614 $rc->addTags(
$tags );
616 if ( $rc->mAttribs[
'rc_patrolled'] ) {
645 $timestamp, &
$title, $minor, &
$user, $comment, $bot,
646 $ip =
'', $size = 0, $newId = 0, $patrol = 0,
$tags = []
650 $rc->mPerformer =
$user;
652 'rc_timestamp' => $timestamp,
653 'rc_namespace' =>
$title->getNamespace(),
654 'rc_title' =>
$title->getDBkey(),
657 'rc_minor' => $minor ? 1 : 0,
658 'rc_cur_id' =>
$title->getArticleID(),
659 'rc_user' =>
$user->getId(),
660 'rc_user_text' =>
$user->getName(),
661 'rc_comment' => $comment,
662 'rc_this_oldid' => $newId,
663 'rc_last_oldid' => 0,
664 'rc_bot' => $bot ? 1 : 0,
666 'rc_patrolled' => intval( $patrol ),
667 'rc_new' => 1, # obsolete
669 'rc_new_len' => $size,
672 'rc_log_type' =>
null,
673 'rc_log_action' =>
'',
678 'prefixedDBkey' =>
$title->getPrefixedDBkey(),
679 'lastTimestamp' => 0,
682 'pageStatus' =>
'created'
687 $rc->addTags(
$tags );
689 if ( $rc->mAttribs[
'rc_patrolled'] ) {
716 $action, $target, $logComment,
$params, $newId = 0, $actionCommentIRC =
''
718 global $wgLogRestrictions;
720 # Don't add private logs to RC!
721 if ( isset( $wgLogRestrictions[
$type] ) && $wgLogRestrictions[
$type] !=
'*' ) {
725 $target, $logComment,
$params, $newId, $actionCommentIRC );
749 $type, $action, $target, $logComment,
$params, $newId = 0, $actionCommentIRC =
'',
750 $revId = 0, $isPatrollable =
false ) {
753 # # Get pageStatus for email notification
754 switch (
$type .
'-' . $action ) {
755 case 'delete-delete':
756 case 'delete-delete_redir':
757 $pageStatus =
'deleted';
760 case 'move-move_redir':
761 $pageStatus =
'moved';
763 case 'delete-restore':
764 $pageStatus =
'restored';
766 case 'upload-upload':
767 $pageStatus =
'created';
769 case 'upload-overwrite':
771 $pageStatus =
'changed';
776 $markPatrolled = $isPatrollable ?
$user->isAllowed(
'autopatrol' ) :
true;
779 $rc->mTitle = $target;
780 $rc->mPerformer =
$user;
782 'rc_timestamp' => $timestamp,
783 'rc_namespace' => $target->getNamespace(),
784 'rc_title' => $target->getDBkey(),
788 'rc_cur_id' => $target->getArticleID(),
789 'rc_user' =>
$user->getId(),
790 'rc_user_text' =>
$user->getName(),
791 'rc_comment' => $logComment,
792 'rc_this_oldid' =>
$revId,
793 'rc_last_oldid' => 0,
794 'rc_bot' =>
$user->isAllowed(
'bot' ) ? (int)
$wgRequest->getBool(
'bot',
true ) : 0,
796 'rc_patrolled' => $markPatrolled ? 1 : 0,
797 'rc_new' => 0, # obsolete
798 'rc_old_len' =>
null,
799 'rc_new_len' =>
null,
801 'rc_logid' => $newId,
802 'rc_log_type' =>
$type,
803 'rc_log_action' => $action,
808 'prefixedDBkey' =>
$title->getPrefixedDBkey(),
809 'lastTimestamp' => 0,
810 'actionComment' => $actionComment,
811 'pageStatus' => $pageStatus,
812 'actionCommentIRC' => $actionCommentIRC
840 Title $categoryTitle,
852 $rc->mTitle = $categoryTitle;
853 $rc->mPerformer =
$user;
855 'rc_timestamp' => $timestamp,
857 'rc_title' => $categoryTitle->
getDBkey(),
863 'rc_user_text' =>
$user ?
$user->getName() :
'',
864 'rc_comment' => $comment,
865 'rc_this_oldid' => $newRevId,
866 'rc_last_oldid' => $oldRevId,
867 'rc_bot' => $bot ? 1 : 0,
870 'rc_new' => 0, # obsolete
871 'rc_old_len' =>
null,
872 'rc_new_len' =>
null,
873 'rc_deleted' => $deleted,
875 'rc_log_type' =>
null,
876 'rc_log_action' =>
'',
884 'lastTimestamp' => $lastTimestamp,
887 'pageStatus' =>
'changed'
912 $this->mAttribs = get_object_vars( $row );
913 $this->mAttribs[
'rc_timestamp'] =
wfTimestamp( TS_MW, $this->mAttribs[
'rc_timestamp'] );
914 $this->mAttribs[
'rc_deleted'] = $row->rc_deleted;
924 return isset( $this->mAttribs[
$name] ) ? $this->mAttribs[
$name] :
null;
941 if ( $this->mAttribs[
'rc_type'] ==
RC_EDIT ) {
942 $trail =
"curid=" . (int)( $this->mAttribs[
'rc_cur_id'] ) .
943 "&oldid=" . (int)( $this->mAttribs[
'rc_last_oldid'] );
947 $trail .=
'&diff=' . (int)( $this->mAttribs[
'rc_this_oldid'] );
965 $old = $this->mAttribs[
'rc_old_len'];
968 $new = $this->mAttribs[
'rc_new_len'];
970 if ( $old ===
null || $new ===
null ) {
981 throw new MWException(
"Attempt to write \"" . $ip .
982 "\" as an IP address into recent changes" );
1006 return wfTimestamp( TS_UNIX, $timestamp ) > time() - $tolerance - $wgRCMaxAge;
1019 MediaWiki\suppressWarnings();
1021 MediaWiki\restoreWarnings();
1023 return $unserializedParams;
1035 if ( is_string(
$tags ) ) {
1036 $this->tags[] =
$tags;
1038 $this->tags = array_merge(
$tags, $this->tags );
getCharacterDifference( $old=0, $new=0)
Returns the change size (HTML).
static notifyNew( $timestamp, &$title, $minor, &$user, $comment, $bot, $ip='', $size=0, $newId=0, $patrol=0, $tags=[])
Makes an entry in the database corresponding to page creation Note: the title object must be loaded w...
static newFromId( $id)
Static factory method for creation from a given user ID.
array $tags
List of tags to apply.
return true to allow those checks to and false if checking is done remove or add to the links of a group of changes in EnhancedChangesList Hook subscribers can return false to omit this line from recentchanges use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped true if there is text before this autocomment $auto
This is to display changes made to all articles linked in an article.
static newFromConds( $conds, $fname=__METHOD__, $dbType=DB_REPLICA)
Find the first recent change matching some specific conditions.
getPrefixedDBkey()
Get the prefixed database key form.
static record( $rc, $auto=false, User $user=null, $tags=null)
Record a log event for a change being patrolled.
Utility class for creating new RC entries.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
static newForCategorization( $timestamp, Title $categoryTitle, User $user=null, $comment, Title $pageTitle, $oldRevId, $newRevId, $lastTimestamp, $bot, $ip='', $deleted=0)
Constructs a RecentChange object for the given categorization This does not call save() on the object...
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
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
getArticleID( $flags=0)
Get the article ID for this Title from the link cache, adding it if necessary.
static getEngine( $uri, $params=[])
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.
unserialize( $serialized)
loadFromRow( $row)
Initialises the members of this object from a mysql row object.
static getChangeTypes()
Get an array of all change types.
reallyMarkPatrolled()
Mark this RecentChange patrolled, without error checking.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
int $counter
Line number of recent change.
static notifyEdit( $timestamp, &$title, $minor, &$user, $comment, $oldId, $lastTimestamp, $bot, $ip='', $oldSize=0, $newSize=0, $newId=0, $patrol=0, $tags=[])
Makes an entry in the database corresponding to an edit.
Allows to change the fields on the form that will be generated $name
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
static parseToRCType( $type)
Parsing text to RC_* constants.
static newCacheUpdateJob()
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
parseParams()
Parses and returns the rc_params attribute.
static addCallableUpdate( $callable, $stage=self::POSTSEND, IDatabase $dbw=null)
Add a callable update.
getDBkey()
Get the main part with underscores.
namespace and then decline to actually register it file or subcat img or subcat $title
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
getNamespace()
Get the namespace index, i.e.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
null for the wiki Added in
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing & $attribs
static notifyLog( $timestamp, &$title, &$user, $actionComment, $ip, $type, $action, $target, $logComment, $params, $newId=0, $actionCommentIRC='')
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 message
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
when a variable name is used in a it is silently declared as a new masking the global
diffLinkTrail( $forceCur)
Gets the end part of the diff URL associated with this object Blank if no diff link should be display...
passed in as a query string parameter to the various URLs constructed here(i.e. $prevlink) $ldel you ll need to handle error etc yourself modifying $error and returning true will cause the contents of $error to be echoed at the top of the edit form as wikitext Return true without altering $error to allow the edit to proceed & $editor
static newFromId( $rcid)
Obtain the recent change with a given rc_id value.
doMarkPatrolled(User $user, $auto=false, $tags=null)
Mark this RecentChange as patrolled.
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 incomplete not yet checked for validity & $retval
static showCharacterDifference( $old, $new, IContextSource $context=null)
Show formatted char difference.
static markPatrolled( $change, $auto=false, $tags=null)
Mark a given change as patrolled.
&</p >< p >< sup id="cite_ref-blank_1-1" class="reference">< a href="#cite_note-blank-1"> &</p >< div class="mw-references-wrap">< ol class="references">< li id="cite_note-blank-1">< span class="mw-cite-backlink"> ↑< sup >< a href="#cite_ref-blank_1-0"></a ></sup >< sup >< a href="#cite_ref-blank_1-1"></a ></sup ></span >< span class="reference-text">< span class="error mw-ext-cite-error" lang="en" dir="ltr"> Cite error
addTags( $tags)
Tags to append to the recent change, and associated revision/log.
getAttribute( $name)
Get an attribute value.
static checkIPAddress( $ip)
Represents a title within MediaWiki.
static selectFields()
Return the list of recentchanges fields that should be selected to create a new recentchanges object.
static parseFromRCType( $rcType)
Parsing RC_* constants to human-readable test.
static newLogEntry( $timestamp, &$title, &$user, $actionComment, $ip, $type, $action, $target, $logComment, $params, $newId=0, $actionCommentIRC='', $revId=0, $isPatrollable=false)
static singleton( $wiki=false)
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static factory(array $params)
static isInRCLifespan( $timestamp, $tolerance=0)
Check whether the given timestamp is new enough to have a RC row with a given tolerance as the recent...
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context $revId
notifyRCFeeds(array $feeds=null)
Notify all the feeds about the change.
getPerformer()
Get the User object of the person who performed this change.
This module processes the email notifications when the current page is changed.
if(! $wgDBerrorLogTZ) $wgRequest
save( $noudp=false)
Writes the data in this object to the database.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
static array $changeTypes
Array of change types.
getParam( $name)
Get a parameter value.
static isIPAddress( $ip)
Determine if a string is as valid IP address or network (CIDR prefix).
the array() calling protocol came about after MediaWiki 1.4rc1.
isAllowed( $action='')
Internal mechanics of testing a permission.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang