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 );
173 return self::newFromConds( [
'rc_id' => $rcid ], __METHOD__ );
191 $row = $db->selectRow(
'recentchanges', self::selectFields(), $conds,
$fname );
192 if ( $row !==
false ) {
193 return self::newFromRow( $row );
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();
332 Hooks::run(
'RecentChange_save', [ &$this ] );
334 if ( count( $this->tags ) ) {
336 $this->mAttribs[
'rc_this_oldid'], $this->mAttribs[
'rc_logid'], null, $this );
339 # Notify external application via UDP
344 # E-mail notifications
345 if ( $wgUseEnotif || $wgShowUpdatedMarker ) {
356 $dbw->onTransactionIdle(
359 $enotif->notifyOnPageChange(
362 $this->mAttribs[
'rc_timestamp'],
363 $this->mAttribs[
'rc_comment'],
364 $this->mAttribs[
'rc_minor'],
365 $this->mAttribs[
'rc_last_oldid'],
366 $this->mExtra[
'pageStatus']
375 if ( $this->mAttribs[
'rc_user'] > 0 ) {
386 if ( $feeds === null ) {
392 foreach ( $feeds
as $feed ) {
394 'omit_bots' =>
false,
395 'omit_anon' =>
false,
396 'omit_user' =>
false,
397 'omit_minor' =>
false,
398 'omit_patrolled' =>
false,
402 ( $feed[
'omit_bots'] && $this->mAttribs[
'rc_bot'] ) ||
403 ( $feed[
'omit_anon'] && $performer->isAnon() ) ||
404 ( $feed[
'omit_user'] && !$performer->isAnon() ) ||
405 ( $feed[
'omit_minor'] && $this->mAttribs[
'rc_minor'] ) ||
406 ( $feed[
'omit_patrolled'] && $this->mAttribs[
'rc_patrolled'] ) ||
412 $engine = self::getEngine( $feed[
'uri'] );
414 if ( isset( $this->mExtra[
'actionCommentIRC'] ) ) {
415 $actionComment = $this->mExtra[
'actionCommentIRC'];
417 $actionComment = null;
421 $formatter = is_object( $feed[
'formatter'] ) ? $feed[
'formatter'] :
new $feed[
'formatter']();
422 $line = $formatter->getLine( $feed, $this, $actionComment );
445 $scheme = parse_url( $uri, PHP_URL_SCHEME );
447 throw new MWException( __FUNCTION__ .
": Invalid stream logger URI: '$uri'" );
450 if ( !isset( $wgRCEngines[$scheme] ) ) {
451 throw new MWException( __FUNCTION__ .
": Unknown stream logger URI scheme: $scheme" );
454 return new $wgRCEngines[$scheme];
477 return $change->doMarkPatrolled( $wgUser,
$auto,
$tags );
492 global $wgUseRCPatrol, $wgUseNPPatrol, $wgUseFilePatrol;
497 if ( !$wgUseRCPatrol && ( !$wgUseNPPatrol || $this->
getAttribute(
'rc_type' ) !=
RC_NEW ) &&
499 $this->
getAttribute(
'rc_log_type' ) ==
'upload' ) ) ) {
500 $errors[] = [
'rcpatroldisabled' ];
503 $right =
$auto ?
'autopatrol' :
'patrol';
504 $errors = array_merge( $errors, $this->
getTitle()->getUserPermissionsErrors( $right, $user ) );
508 $errors[] = [
'hookaborted' ];
515 $errors[] = [
'markedaspatrollederror-noautopatrol' ];
530 'MarkPatrolledComplete',
555 $this->
getTitle()->invalidateCache();
557 return $dbw->affectedRows();
581 $bot, $ip =
'', $oldSize = 0, $newSize = 0, $newId = 0, $patrol = 0,
586 $rc->mPerformer =
$user;
589 'rc_namespace' =>
$title->getNamespace(),
590 'rc_title' =>
$title->getDBkey(),
592 'rc_source' => self::SRC_EDIT,
593 'rc_minor' => $minor ? 1 : 0,
594 'rc_cur_id' =>
$title->getArticleID(),
595 'rc_user' =>
$user->getId(),
596 'rc_user_text' =>
$user->getName(),
598 'rc_this_oldid' => $newId,
599 'rc_last_oldid' => $oldId,
600 'rc_bot' => $bot ? 1 : 0,
601 'rc_ip' => self::checkIPAddress( $ip ),
602 'rc_patrolled' => intval( $patrol ),
603 'rc_new' => 0, # obsolete
604 'rc_old_len' => $oldSize,
605 'rc_new_len' => $newSize,
608 'rc_log_type' => null,
609 'rc_log_action' =>
'',
614 'prefixedDBkey' =>
$title->getPrefixedDBkey(),
615 'lastTimestamp' => $lastTimestamp,
616 'oldSize' => $oldSize,
617 'newSize' => $newSize,
618 'pageStatus' =>
'changed'
623 $rc->addTags(
$tags );
625 if ( $rc->mAttribs[
'rc_patrolled'] ) {
655 $ip =
'', $size = 0, $newId = 0, $patrol = 0,
$tags = []
659 $rc->mPerformer =
$user;
662 'rc_namespace' =>
$title->getNamespace(),
663 'rc_title' =>
$title->getDBkey(),
665 'rc_source' => self::SRC_NEW,
666 'rc_minor' => $minor ? 1 : 0,
667 'rc_cur_id' =>
$title->getArticleID(),
668 'rc_user' =>
$user->getId(),
669 'rc_user_text' =>
$user->getName(),
671 'rc_this_oldid' => $newId,
672 'rc_last_oldid' => 0,
673 'rc_bot' => $bot ? 1 : 0,
674 'rc_ip' => self::checkIPAddress( $ip ),
675 'rc_patrolled' => intval( $patrol ),
676 'rc_new' => 1, # obsolete
678 'rc_new_len' => $size,
681 'rc_log_type' => null,
682 'rc_log_action' =>
'',
687 'prefixedDBkey' =>
$title->getPrefixedDBkey(),
688 'lastTimestamp' => 0,
691 'pageStatus' =>
'created'
696 $rc->addTags(
$tags );
698 if ( $rc->mAttribs[
'rc_patrolled'] ) {
725 $action, $target, $logComment,
$params, $newId = 0, $actionCommentIRC =
''
727 global $wgLogRestrictions;
729 # Don't add private logs to RC!
730 if ( isset( $wgLogRestrictions[
$type] ) && $wgLogRestrictions[$type] !=
'*' ) {
734 $target, $logComment,
$params, $newId, $actionCommentIRC );
758 $type, $action, $target, $logComment,
$params, $newId = 0, $actionCommentIRC =
'',
759 $revId = 0, $isPatrollable =
false ) {
762 # # Get pageStatus for email notification
763 switch (
$type .
'-' . $action ) {
764 case 'delete-delete':
765 case 'delete-delete_redir':
766 $pageStatus =
'deleted';
769 case 'move-move_redir':
770 $pageStatus =
'moved';
772 case 'delete-restore':
773 $pageStatus =
'restored';
775 case 'upload-upload':
776 $pageStatus =
'created';
778 case 'upload-overwrite':
780 $pageStatus =
'changed';
785 $markPatrolled = $isPatrollable ?
$user->isAllowed(
'autopatrol' ) :
true;
788 $rc->mTitle = $target;
789 $rc->mPerformer =
$user;
792 'rc_namespace' => $target->getNamespace(),
793 'rc_title' => $target->getDBkey(),
795 'rc_source' => self::SRC_LOG,
797 'rc_cur_id' => $target->getArticleID(),
798 'rc_user' =>
$user->getId(),
799 'rc_user_text' =>
$user->getName(),
800 'rc_comment' => $logComment,
801 'rc_this_oldid' =>
$revId,
802 'rc_last_oldid' => 0,
803 'rc_bot' =>
$user->isAllowed(
'bot' ) ? (int)$wgRequest->getBool(
'bot',
true ) : 0,
804 'rc_ip' => self::checkIPAddress( $ip ),
805 'rc_patrolled' => $markPatrolled ? 1 : 0,
806 'rc_new' => 0, # obsolete
807 'rc_old_len' => null,
808 'rc_new_len' => null,
810 'rc_logid' => $newId,
811 'rc_log_type' =>
$type,
812 'rc_log_action' => $action,
817 'prefixedDBkey' =>
$title->getPrefixedDBkey(),
818 'lastTimestamp' => 0,
819 'actionComment' => $actionComment,
820 'pageStatus' => $pageStatus,
821 'actionCommentIRC' => $actionCommentIRC
849 Title $categoryTitle,
861 $rc->mTitle = $categoryTitle;
862 $rc->mPerformer =
$user;
866 'rc_title' => $categoryTitle->
getDBkey(),
868 'rc_source' => self::SRC_CATEGORIZE,
872 'rc_user_text' =>
$user ?
$user->getName() :
'',
874 'rc_this_oldid' => $newRevId,
875 'rc_last_oldid' => $oldRevId,
876 'rc_bot' => $bot ? 1 : 0,
877 'rc_ip' => self::checkIPAddress( $ip ),
879 'rc_new' => 0, # obsolete
880 'rc_old_len' => null,
881 'rc_new_len' => null,
882 'rc_deleted' => $deleted,
884 'rc_log_type' => null,
885 'rc_log_action' =>
'',
893 'lastTimestamp' => $lastTimestamp,
896 'pageStatus' =>
'changed'
921 $this->mAttribs = get_object_vars( $row );
922 $this->mAttribs[
'rc_timestamp'] =
wfTimestamp(
TS_MW, $this->mAttribs[
'rc_timestamp'] );
923 $this->mAttribs[
'rc_deleted'] = $row->rc_deleted;
933 return isset( $this->mAttribs[
$name] ) ? $this->mAttribs[
$name] : null;
950 if ( $this->mAttribs[
'rc_type'] ==
RC_EDIT ) {
951 $trail =
"curid=" . (int)( $this->mAttribs[
'rc_cur_id'] ) .
952 "&oldid=" . (int)( $this->mAttribs[
'rc_last_oldid'] );
956 $trail .=
'&diff=' . (int)( $this->mAttribs[
'rc_this_oldid'] );
974 $old = $this->mAttribs[
'rc_old_len'];
977 $new = $this->mAttribs[
'rc_new_len'];
979 if ( $old === null || $new === null ) {
990 throw new MWException(
"Attempt to write \"" . $ip .
991 "\" as an IP address into recent changes" );
994 $ip = $wgRequest->getIP();
1028 MediaWiki\suppressWarnings();
1030 MediaWiki\restoreWarnings();
1032 return $unserializedParams;
1044 if ( is_string(
$tags ) ) {
1045 $this->tags[] =
$tags;
1047 $this->tags = array_merge(
$tags, $this->tags );
static newFromName($name, $validate= 'valid')
Static factory method for creation from username.
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
This module processes the email notifications when the current page is changed.
Utility class for creating new RC entries.
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...
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
the array() calling protocol came about after MediaWiki 1.4rc1.
static getChangeTypes()
Get an array of all change types.
getArticleID($flags=0)
Get the article ID for this Title from the link cache, adding it if necessary.
doMarkPatrolled(User $user, $auto=false, $tags=null)
Mark this RecentChange as patrolled.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
if(!$wgDBerrorLogTZ) $wgRequest
getCharacterDifference($old=0, $new=0)
Returns the change size (HTML).
parseParams()
Parses and returns the rc_params attribute.
static newFromId($rcid)
Obtain the recent change with a given rc_id value.
static newFromConds($conds, $fname=__METHOD__, $dbType=DB_REPLICA)
Find the first recent change matching some specific conditions.
null for the local wiki Added in
getParam($name)
Get a parameter value.
static newFromId($id)
Static factory method for creation from a given user ID.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist 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
save($noudp=false)
Writes the data in this object to the database.
when a variable name is used in a it is silently declared as a new local masking the global
static newCacheUpdateJob()
static isIPAddress($ip)
Determine if a string is as valid IP address or network (CIDR prefix).
getName()
Get the user name, or the IP of an anonymous user.
static record($rc, $auto=false, User $user=null, $tags=null)
Record a log event for a change being patrolled.
getPerformer()
Get the User object of the person who performed this change.
getAttribute($name)
Get an attribute value.
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
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.
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...
wfTimestamp($outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
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
diffLinkTrail($forceCur)
Gets the end part of the diff URL associated with this object Blank if no diff link should be display...
static notifyLog($timestamp, &$title, &$user, $actionComment, $ip, $type, $action, $target, $logComment, $params, $newId=0, $actionCommentIRC= '')
isAllowed($action= '')
Internal mechanics of testing a permission.
getDBkey()
Get the main part with underscores.
static checkIPAddress($ip)
static showCharacterDifference($old, $new, IContextSource $context=null)
Show formatted char difference.
static array $changeTypes
Array of change types.
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
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
namespace and then decline to actually register it file or subcat img or subcat $title
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
getNamespace()
Get the namespace index, i.e.
array $tags
List of tags to apply.
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
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
static selectFields()
Return the list of recentchanges fields that should be selected to create a new recentchanges object...
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 local account $user
the value to return A Title object or null for latest all implement SearchIndexField $engine
static array static newFromRow($row)
static singleton($wiki=false)
static parseFromRCType($rcType)
Parsing RC_* constants to human-readable test.
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
reallyMarkPatrolled()
Mark this RecentChange patrolled, without error checking.
static getEngine($uri)
Gets the stream engine object for a given URI from $wgRCEngines.
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined...
static markPatrolled($change, $auto=false, $tags=null)
Mark a given change as patrolled.
notifyRCFeeds(array $feeds=null)
Notify all the feeds about the change.
addTags($tags)
Tags to append to the recent change, and associated revision/log.
int $counter
Line number of recent change.
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 local content language as $wgContLang
static addCallableUpdate($callable, $stage=self::POSTSEND, IDatabase $dbw=null)
Add a callable update.
This is to display changes made to all articles linked in an article.
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...
loadFromRow($row)
Initialises the members of this object from a mysql row object.
static newLogEntry($timestamp, &$title, &$user, $actionComment, $ip, $type, $action, $target, $logComment, $params, $newId=0, $actionCommentIRC= '', $revId=0, $isPatrollable=false)
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 local account incomplete not yet checked for validity & $retval
static parseToRCType($type)
Parsing text to RC_* constants.
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 one of or reset 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 makeTitle($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
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
getPrefixedDBkey()
Get the prefixed database key form.
Allows to change the fields on the form that will be generated $name