Go to the documentation of this file.
134 if ( is_array(
$type ) ) {
143 if ( !array_key_exists(
$type, self::$changeTypes ) ) {
146 return self::$changeTypes[
$type];
156 return array_search( $rcType, self::$changeTypes,
true ) ?:
"$rcType";
167 return array_keys( self::$changeTypes );
195 $row = $db->selectRow(
'recentchanges', self::selectFields(), $conds,
$fname );
196 if ( $row !==
false ) {
251 $this->mExtra = $extra;
258 if ( $this->mTitle ===
false ) {
259 $this->mTitle =
Title::makeTitle( $this->mAttribs[
'rc_namespace'], $this->mAttribs[
'rc_title'] );
271 if ( $this->mPerformer ===
false ) {
272 if ( $this->mAttribs[
'rc_user'] ) {
286 public function save( $noudp =
false ) {
290 if ( !is_array( $this->mExtra ) ) {
295 $this->mAttribs[
'rc_ip'] =
'';
298 # Strict mode fixups (not-NULL fields)
299 foreach ( [
'minor',
'bot',
'new',
'patrolled',
'deleted' ]
as $field ) {
300 $this->mAttribs[
"rc_$field"] = (int)$this->mAttribs[
"rc_$field"];
302 # ...more fixups (NULL fields)
303 foreach ( [
'old_len',
'new_len' ]
as $field ) {
304 $this->mAttribs[
"rc_$field"] = isset( $this->mAttribs[
"rc_$field"] )
305 ? (int)$this->mAttribs[
"rc_$field"]
309 # If our database is strict about IP addresses, use NULL instead of an empty string
310 $strictIPs = in_array( $dbw->getType(), [
'oracle',
'postgres' ] );
311 if ( $strictIPs && $this->mAttribs[
'rc_ip'] ==
'' ) {
312 unset( $this->mAttribs[
'rc_ip'] );
315 # Trim spaces on user supplied text
316 $this->mAttribs[
'rc_comment'] = trim( $this->mAttribs[
'rc_comment'] );
318 # Fixup database timestamps
319 $this->mAttribs[
'rc_timestamp'] = $dbw->timestamp( $this->mAttribs[
'rc_timestamp'] );
321 # # If we are using foreign keys, an entry of 0 for the page_id will fail, so use NULL
322 if ( $this->mAttribs[
'rc_cur_id'] == 0 ) {
323 unset( $this->mAttribs[
'rc_cur_id'] );
326 # Convert mAttribs['rc_comment'] for CommentStore
328 $comment = $row[
'rc_comment'];
329 unset( $row[
'rc_comment'], $row[
'rc_comment_text'], $row[
'rc_comment_data'] );
332 # Don't reuse an existing rc_id for the new row, if one happens to be
333 # set for some reason.
334 unset( $row[
'rc_id'] );
337 $dbw->insert(
'recentchanges', $row, __METHOD__ );
340 $this->mAttribs[
'rc_id'] = $dbw->insertId();
347 if (
count( $this->tags ) ) {
349 $this->mAttribs[
'rc_this_oldid'], $this->mAttribs[
'rc_logid'],
null, $this );
352 # Notify external application via UDP
357 # E-mail notifications
369 $dbw->onTransactionIdle(
372 $enotif->notifyOnPageChange(
375 $this->mAttribs[
'rc_timestamp'],
376 $this->mAttribs[
'rc_comment'],
377 $this->mAttribs[
'rc_minor'],
378 $this->mAttribs[
'rc_last_oldid'],
379 $this->mExtra[
'pageStatus']
388 if ( $this->mAttribs[
'rc_user'] > 0 ) {
399 if ( $feeds ===
null ) {
407 'omit_bots' =>
false,
408 'omit_anon' =>
false,
409 'omit_user' =>
false,
410 'omit_minor' =>
false,
411 'omit_patrolled' =>
false,
415 (
$params[
'omit_bots'] && $this->mAttribs[
'rc_bot'] ) ||
416 (
$params[
'omit_anon'] && $performer->isAnon() ) ||
417 (
$params[
'omit_user'] && !$performer->isAnon() ) ||
418 (
$params[
'omit_minor'] && $this->mAttribs[
'rc_minor'] ) ||
419 (
$params[
'omit_patrolled'] && $this->mAttribs[
'rc_patrolled'] ) ||
425 if ( isset( $this->mExtra[
'actionCommentIRC'] ) ) {
426 $actionComment = $this->mExtra[
'actionCommentIRC'];
428 $actionComment =
null;
432 $feed->notify( $this, $actionComment );
447 $scheme = parse_url( $uri, PHP_URL_SCHEME );
449 throw new MWException(
"Invalid RCFeed uri: '$uri'" );
452 throw new MWException(
"Unknown RCFeedEngine scheme: '$scheme'" );
454 if ( defined(
'MW_PHPUNIT_TEST' ) && is_object(
$wgRCEngines[$scheme] ) ) {
502 $this->
getAttribute(
'rc_log_type' ) ==
'upload' ) ) ) {
503 $errors[] = [
'rcpatroldisabled' ];
506 $right =
$auto ?
'autopatrol' :
'patrol';
507 $errors = array_merge( $errors, $this->
getTitle()->getUserPermissionsErrors( $right,
$user ) );
511 $errors[] = [
'hookaborted' ];
518 $errors[] = [
'markedaspatrollederror-noautopatrol' ];
533 'MarkPatrolledComplete',
558 $this->
getTitle()->invalidateCache();
560 return $dbw->affectedRows();
583 $timestamp, &
$title, $minor, &
$user, $comment, $oldId, $lastTimestamp,
584 $bot, $ip =
'', $oldSize = 0, $newSize = 0, $newId = 0, $patrol = 0,
589 $rc->mPerformer =
$user;
591 'rc_timestamp' => $timestamp,
592 'rc_namespace' =>
$title->getNamespace(),
593 'rc_title' =>
$title->getDBkey(),
596 'rc_minor' => $minor ? 1 : 0,
597 'rc_cur_id' =>
$title->getArticleID(),
598 'rc_user' =>
$user->getId(),
599 'rc_user_text' =>
$user->getName(),
600 'rc_comment' => &$comment,
601 'rc_comment_text' => &$comment,
602 'rc_comment_data' =>
null,
603 'rc_this_oldid' => $newId,
604 'rc_last_oldid' => $oldId,
605 'rc_bot' => $bot ? 1 : 0,
607 'rc_patrolled' => intval( $patrol ),
608 'rc_new' => 0, # obsolete
609 'rc_old_len' => $oldSize,
610 'rc_new_len' => $newSize,
613 'rc_log_type' =>
null,
614 'rc_log_action' =>
'',
619 'prefixedDBkey' =>
$title->getPrefixedDBkey(),
620 'lastTimestamp' => $lastTimestamp,
621 'oldSize' => $oldSize,
622 'newSize' => $newSize,
623 'pageStatus' =>
'changed'
628 $rc->addTags(
$tags );
630 if ( $rc->mAttribs[
'rc_patrolled'] ) {
659 $timestamp, &
$title, $minor, &
$user, $comment, $bot,
660 $ip =
'', $size = 0, $newId = 0, $patrol = 0,
$tags = []
664 $rc->mPerformer =
$user;
666 'rc_timestamp' => $timestamp,
667 'rc_namespace' =>
$title->getNamespace(),
668 'rc_title' =>
$title->getDBkey(),
671 'rc_minor' => $minor ? 1 : 0,
672 'rc_cur_id' =>
$title->getArticleID(),
673 'rc_user' =>
$user->getId(),
674 'rc_user_text' =>
$user->getName(),
675 'rc_comment' => &$comment,
676 'rc_comment_text' => &$comment,
677 'rc_comment_data' =>
null,
678 'rc_this_oldid' => $newId,
679 'rc_last_oldid' => 0,
680 'rc_bot' => $bot ? 1 : 0,
682 'rc_patrolled' => intval( $patrol ),
683 'rc_new' => 1, # obsolete
685 'rc_new_len' => $size,
688 'rc_log_type' =>
null,
689 'rc_log_action' =>
'',
694 'prefixedDBkey' =>
$title->getPrefixedDBkey(),
695 'lastTimestamp' => 0,
698 'pageStatus' =>
'created'
703 $rc->addTags(
$tags );
705 if ( $rc->mAttribs[
'rc_patrolled'] ) {
732 $action, $target, $logComment,
$params, $newId = 0, $actionCommentIRC =
''
736 # Don't add private logs to RC!
741 $target, $logComment,
$params, $newId, $actionCommentIRC );
765 $type, $action, $target, $logComment,
$params, $newId = 0, $actionCommentIRC =
'',
766 $revId = 0, $isPatrollable =
false ) {
769 # # Get pageStatus for email notification
770 switch (
$type .
'-' . $action ) {
771 case 'delete-delete':
772 case 'delete-delete_redir':
773 $pageStatus =
'deleted';
776 case 'move-move_redir':
777 $pageStatus =
'moved';
779 case 'delete-restore':
780 $pageStatus =
'restored';
782 case 'upload-upload':
783 $pageStatus =
'created';
785 case 'upload-overwrite':
787 $pageStatus =
'changed';
792 $markPatrolled = $isPatrollable ?
$user->isAllowed(
'autopatrol' ) :
true;
795 $rc->mTitle = $target;
796 $rc->mPerformer =
$user;
798 'rc_timestamp' => $timestamp,
799 'rc_namespace' => $target->getNamespace(),
800 'rc_title' => $target->getDBkey(),
804 'rc_cur_id' => $target->getArticleID(),
805 'rc_user' =>
$user->getId(),
806 'rc_user_text' =>
$user->getName(),
807 'rc_comment' => &$logComment,
808 'rc_comment_text' => &$logComment,
809 'rc_comment_data' =>
null,
810 'rc_this_oldid' => $revId,
811 'rc_last_oldid' => 0,
812 'rc_bot' =>
$user->isAllowed(
'bot' ) ? (int)
$wgRequest->getBool(
'bot',
true ) : 0,
814 'rc_patrolled' => $markPatrolled ? 1 : 0,
815 'rc_new' => 0, # obsolete
816 'rc_old_len' =>
null,
817 'rc_new_len' =>
null,
819 'rc_logid' => $newId,
820 'rc_log_type' =>
$type,
821 'rc_log_action' => $action,
826 'prefixedDBkey' =>
$title->getPrefixedDBkey(),
827 'lastTimestamp' => 0,
828 'actionComment' => $actionComment,
829 'pageStatus' => $pageStatus,
830 'actionCommentIRC' => $actionCommentIRC
859 Title $categoryTitle,
875 if ( $added !==
null ) {
880 $rc->mTitle = $categoryTitle;
881 $rc->mPerformer =
$user;
883 'rc_timestamp' => $timestamp,
885 'rc_title' => $categoryTitle->
getDBkey(),
891 'rc_user_text' =>
$user ?
$user->getName() :
'',
892 'rc_comment' => &$comment,
893 'rc_comment_text' => &$comment,
894 'rc_comment_data' =>
null,
895 'rc_this_oldid' => $newRevId,
896 'rc_last_oldid' => $oldRevId,
897 'rc_bot' => $bot ? 1 : 0,
900 'rc_new' => 0, # obsolete
901 'rc_old_len' =>
null,
902 'rc_new_len' =>
null,
903 'rc_deleted' => $deleted,
905 'rc_log_type' =>
null,
906 'rc_log_action' =>
'',
912 'lastTimestamp' => $lastTimestamp,
915 'pageStatus' =>
'changed'
940 $this->mAttribs = get_object_vars( $row );
941 $this->mAttribs[
'rc_timestamp'] =
wfTimestamp( TS_MW, $this->mAttribs[
'rc_timestamp'] );
943 $this->mAttribs[
'rc_deleted'] = $row->rc_deleted;
945 if ( isset( $this->mAttribs[
'rc_ip'] ) ) {
947 $n = strpos( $this->mAttribs[
'rc_ip'],
'/' );
948 if ( $n !==
false ) {
949 $this->mAttribs[
'rc_ip'] = substr( $this->mAttribs[
'rc_ip'], 0, $n );
956 $this->mAttribs[
'rc_comment'] = &$comment;
957 $this->mAttribs[
'rc_comment_text'] = &$comment;
958 $this->mAttribs[
'rc_comment_data'] =
null;
968 if (
$name ===
'rc_comment' ) {
971 return isset( $this->mAttribs[
$name] ) ? $this->mAttribs[
$name] :
null;
988 if ( $this->mAttribs[
'rc_type'] ==
RC_EDIT ) {
989 $trail =
"curid=" . (int)( $this->mAttribs[
'rc_cur_id'] ) .
990 "&oldid=" . (int)( $this->mAttribs[
'rc_last_oldid'] );
994 $trail .=
'&diff=' . (int)( $this->mAttribs[
'rc_this_oldid'] );
1012 $old = $this->mAttribs[
'rc_old_len'];
1015 $new = $this->mAttribs[
'rc_new_len'];
1017 if ( $old ===
null || $new ===
null ) {
1028 throw new MWException(
"Attempt to write \"" . $ip .
1029 "\" as an IP address into recent changes" );
1066 MediaWiki\suppressWarnings();
1068 MediaWiki\restoreWarnings();
1070 return $unserializedParams;
1082 if ( is_string(
$tags ) ) {
1083 $this->tags[] =
$tags;
1085 $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...
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.
array $tags
List of tags to apply.
This is to display changes made to all articles linked in an article.
static newForCategorization( $timestamp, Title $categoryTitle, User $user=null, $comment, Title $pageTitle, $oldRevId, $newRevId, $lastTimestamp, $bot, $ip='', $deleted=0, $added=null)
Constructs a RecentChange object for the given categorization This does not call save() on the object...
static newFromConds( $conds, $fname=__METHOD__, $dbType=DB_REPLICA)
Find the first recent change matching some specific conditions.
$wgShowUpdatedMarker
Show "Updated (since my last visit)" marker in RC view, watchlist and history view for watched pages ...
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.
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
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
static parseToRCType( $type)
Parsing text to RC_* constants.
$wgUseRCPatrol
Use RC Patrolling to check for vandalism (from recent changes and watchlists) New pages and new files...
$wgUseNPPatrol
Use new page patrolling to check new pages on Special:Newpages.
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.
$wgPutIPinRC
Log IP addresses in the recentchanges table; can be accessed only by extensions (e....
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
$wgRCFeeds
Recentchanges items are periodically purged; entries older than this many seconds will go.
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
$wgUseFilePatrol
Use file patrolling to check new files on Special:Newfiles.
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 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
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.
$wgLogRestrictions
This restricts log access to those who have a certain right Users without this will not see it in the...
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
$wgRCMaxAge
Recentchanges items are periodically purged; entries older than this many seconds will go.
static showCharacterDifference( $old, $new, IContextSource $context=null)
Show formatted char difference.
static markPatrolled( $change, $auto=false, $tags=null)
Mark a given change as patrolled.
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.
$wgRCEngines
Used by RecentChange::getEngine to find the correct engine for a given URI scheme.
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...
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults error
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.