125 if ( is_array(
$type ) ) {
134 if ( !array_key_exists(
$type, self::$changeTypes ) ) {
137 return self::$changeTypes[
$type];
147 return array_search( $rcType, self::$changeTypes,
true ) ?:
"$rcType";
158 return array_keys( self::$changeTypes );
168 return self::newFromConds( [
'rc_id' => $rcid ], __METHOD__ );
186 $row = $db->selectRow(
'recentchanges', self::selectFields(), $conds,
$fname );
187 if ( $row !==
false ) {
188 return self::newFromRow( $row );
241 $this->mExtra = $extra;
248 if ( $this->mTitle ===
false ) {
249 $this->mTitle =
Title::makeTitle( $this->mAttribs[
'rc_namespace'], $this->mAttribs[
'rc_title'] );
261 if ( $this->mPerformer ===
false ) {
262 if ( $this->mAttribs[
'rc_user'] ) {
276 public function save( $noudp =
false ) {
280 if ( !is_array( $this->mExtra ) ) {
284 if ( !$wgPutIPinRC ) {
285 $this->mAttribs[
'rc_ip'] =
'';
288 # If our database is strict about IP addresses, use NULL instead of an empty string
289 if ( $dbw->strictIPs() && $this->mAttribs[
'rc_ip'] ==
'' ) {
290 unset( $this->mAttribs[
'rc_ip'] );
293 # Trim spaces on user supplied text
294 $this->mAttribs[
'rc_comment'] = trim( $this->mAttribs[
'rc_comment'] );
296 # Make sure summary is truncated (whole multibyte characters)
297 $this->mAttribs[
'rc_comment'] = $wgContLang->truncate( $this->mAttribs[
'rc_comment'], 255 );
299 # Fixup database timestamps
300 $this->mAttribs[
'rc_timestamp'] = $dbw->timestamp( $this->mAttribs[
'rc_timestamp'] );
301 $this->mAttribs[
'rc_id'] = $dbw->nextSequenceValue(
'recentchanges_rc_id_seq' );
303 # # If we are using foreign keys, an entry of 0 for the page_id will fail, so use NULL
304 if ( $dbw->cascadingDeletes() && $this->mAttribs[
'rc_cur_id'] == 0 ) {
305 unset( $this->mAttribs[
'rc_cur_id'] );
309 $dbw->insert(
'recentchanges', $this->mAttribs, __METHOD__ );
312 $this->mAttribs[
'rc_id'] = $dbw->insertId();
315 Hooks::run(
'RecentChange_save', [ &$this ] );
317 # Notify external application via UDP
322 # E-mail notifications
323 if ( $wgUseEnotif || $wgShowUpdatedMarker ) {
330 # @todo FIXME: This would be better as an extension hook
332 $enotif->notifyOnPageChange(
335 $this->mAttribs[
'rc_timestamp'],
336 $this->mAttribs[
'rc_comment'],
337 $this->mAttribs[
'rc_minor'],
338 $this->mAttribs[
'rc_last_oldid'],
339 $this->mExtra[
'pageStatus']
346 if ( $this->mAttribs[
'rc_user'] > 0 ) {
357 if ( $feeds === null ) {
363 foreach ( $feeds
as $feed ) {
365 'omit_bots' =>
false,
366 'omit_anon' =>
false,
367 'omit_user' =>
false,
368 'omit_minor' =>
false,
369 'omit_patrolled' =>
false,
373 ( $feed[
'omit_bots'] && $this->mAttribs[
'rc_bot'] ) ||
374 ( $feed[
'omit_anon'] && $performer->isAnon() ) ||
375 ( $feed[
'omit_user'] && !$performer->isAnon() ) ||
376 ( $feed[
'omit_minor'] && $this->mAttribs[
'rc_minor'] ) ||
377 ( $feed[
'omit_patrolled'] && $this->mAttribs[
'rc_patrolled'] ) ||
383 $engine = self::getEngine( $feed[
'uri'] );
385 if ( isset( $this->mExtra[
'actionCommentIRC'] ) ) {
386 $actionComment = $this->mExtra[
'actionCommentIRC'];
388 $actionComment = null;
392 $formatter = is_object( $feed[
'formatter'] ) ? $feed[
'formatter'] :
new $feed[
'formatter']();
393 $line = $formatter->getLine( $feed, $this, $actionComment );
402 $engine->send( $feed, $line );
416 $scheme = parse_url( $uri, PHP_URL_SCHEME );
418 throw new MWException( __FUNCTION__ .
": Invalid stream logger URI: '$uri'" );
421 if ( !isset( $wgRCEngines[$scheme] ) ) {
422 throw new MWException( __FUNCTION__ .
": Unknown stream logger URI scheme: $scheme" );
425 return new $wgRCEngines[$scheme];
448 return $change->doMarkPatrolled( $wgUser,
$auto, $tags );
468 if ( !$wgUseRCPatrol && ( !$wgUseNPPatrol || $this->
getAttribute(
'rc_type' ) !=
RC_NEW ) &&
470 $this->
getAttribute(
'rc_log_type' ) ==
'upload' ) ) ) {
471 $errors[] = [
'rcpatroldisabled' ];
474 $right =
$auto ?
'autopatrol' :
'patrol';
475 $errors = array_merge( $errors, $this->
getTitle()->getUserPermissionsErrors( $right, $user ) );
479 $errors[] = [
'hookaborted' ];
486 $errors[] = [
'markedaspatrollederror-noautopatrol' ];
501 'MarkPatrolledComplete',
526 $this->
getTitle()->invalidateCache();
528 return $dbw->affectedRows();
552 $bot, $ip =
'', $oldSize = 0, $newSize = 0, $newId = 0, $patrol = 0,
557 $rc->mPerformer =
$user;
560 'rc_namespace' =>
$title->getNamespace(),
561 'rc_title' =>
$title->getDBkey(),
563 'rc_source' => self::SRC_EDIT,
564 'rc_minor' => $minor ? 1 : 0,
565 'rc_cur_id' =>
$title->getArticleID(),
566 'rc_user' =>
$user->getId(),
567 'rc_user_text' =>
$user->getName(),
569 'rc_this_oldid' => $newId,
570 'rc_last_oldid' => $oldId,
571 'rc_bot' => $bot ? 1 : 0,
572 'rc_ip' => self::checkIPAddress( $ip ),
573 'rc_patrolled' => intval( $patrol ),
574 'rc_new' => 0, # obsolete
575 'rc_old_len' => $oldSize,
576 'rc_new_len' => $newSize,
579 'rc_log_type' => null,
580 'rc_log_action' =>
'',
585 'prefixedDBkey' =>
$title->getPrefixedDBkey(),
586 'lastTimestamp' => $lastTimestamp,
587 'oldSize' => $oldSize,
588 'newSize' => $newSize,
589 'pageStatus' =>
'changed'
594 if ( $rc->mAttribs[
'rc_patrolled'] ) {
597 if ( count( $tags ) ) {
599 $rc->mAttribs[
'rc_this_oldid'], null, null );
625 $ip =
'', $size = 0, $newId = 0, $patrol = 0, $tags = []
629 $rc->mPerformer =
$user;
632 'rc_namespace' =>
$title->getNamespace(),
633 'rc_title' =>
$title->getDBkey(),
635 'rc_source' => self::SRC_NEW,
636 'rc_minor' => $minor ? 1 : 0,
637 'rc_cur_id' =>
$title->getArticleID(),
638 'rc_user' =>
$user->getId(),
639 'rc_user_text' =>
$user->getName(),
641 'rc_this_oldid' => $newId,
642 'rc_last_oldid' => 0,
643 'rc_bot' => $bot ? 1 : 0,
644 'rc_ip' => self::checkIPAddress( $ip ),
645 'rc_patrolled' => intval( $patrol ),
646 'rc_new' => 1, # obsolete
648 'rc_new_len' => $size,
651 'rc_log_type' => null,
652 'rc_log_action' =>
'',
657 'prefixedDBkey' =>
$title->getPrefixedDBkey(),
658 'lastTimestamp' => 0,
661 'pageStatus' =>
'created'
666 if ( $rc->mAttribs[
'rc_patrolled'] ) {
669 if ( count( $tags ) ) {
671 $rc->mAttribs[
'rc_this_oldid'], null, null );
694 $action, $target, $logComment,
$params, $newId = 0, $actionCommentIRC =
''
698 # Don't add private logs to RC!
699 if ( isset( $wgLogRestrictions[
$type] ) && $wgLogRestrictions[$type] !=
'*' ) {
703 $target, $logComment,
$params, $newId, $actionCommentIRC );
727 $type, $action, $target, $logComment,
$params, $newId = 0, $actionCommentIRC =
'',
728 $revId = 0, $isPatrollable =
false ) {
731 # # Get pageStatus for email notification
732 switch (
$type .
'-' . $action ) {
733 case 'delete-delete':
734 $pageStatus =
'deleted';
737 case 'move-move_redir':
738 $pageStatus =
'moved';
740 case 'delete-restore':
741 $pageStatus =
'restored';
743 case 'upload-upload':
744 $pageStatus =
'created';
746 case 'upload-overwrite':
748 $pageStatus =
'changed';
753 $markPatrolled = $isPatrollable ?
$user->isAllowed(
'autopatrol' ) :
true;
756 $rc->mTitle = $target;
757 $rc->mPerformer =
$user;
760 'rc_namespace' => $target->getNamespace(),
761 'rc_title' => $target->getDBkey(),
763 'rc_source' => self::SRC_LOG,
765 'rc_cur_id' => $target->getArticleID(),
766 'rc_user' =>
$user->getId(),
767 'rc_user_text' =>
$user->getName(),
768 'rc_comment' => $logComment,
769 'rc_this_oldid' =>
$revId,
770 'rc_last_oldid' => 0,
771 'rc_bot' =>
$user->isAllowed(
'bot' ) ? $wgRequest->getBool(
'bot',
true ) : 0,
772 'rc_ip' => self::checkIPAddress( $ip ),
773 'rc_patrolled' => $markPatrolled ? 1 : 0,
774 'rc_new' => 0, # obsolete
775 'rc_old_len' => null,
776 'rc_new_len' => null,
778 'rc_logid' => $newId,
779 'rc_log_type' =>
$type,
780 'rc_log_action' => $action,
785 'prefixedDBkey' =>
$title->getPrefixedDBkey(),
786 'lastTimestamp' => 0,
787 'actionComment' => $actionComment,
788 'pageStatus' => $pageStatus,
789 'actionCommentIRC' => $actionCommentIRC
817 Title $categoryTitle,
829 $rc->mTitle = $categoryTitle;
830 $rc->mPerformer =
$user;
834 'rc_title' => $categoryTitle->
getDBkey(),
836 'rc_source' => self::SRC_CATEGORIZE,
840 'rc_user_text' =>
$user ?
$user->getName() :
'',
842 'rc_this_oldid' => $newRevId,
843 'rc_last_oldid' => $oldRevId,
844 'rc_bot' => $bot ? 1 : 0,
845 'rc_ip' => self::checkIPAddress( $ip ),
847 'rc_new' => 0, # obsolete
848 'rc_old_len' => null,
849 'rc_new_len' => null,
850 'rc_deleted' => $deleted,
852 'rc_log_type' => null,
853 'rc_log_action' =>
'',
861 'lastTimestamp' => $lastTimestamp,
864 'pageStatus' =>
'changed'
889 $this->mAttribs = get_object_vars( $row );
890 $this->mAttribs[
'rc_timestamp'] =
wfTimestamp(
TS_MW, $this->mAttribs[
'rc_timestamp'] );
891 $this->mAttribs[
'rc_deleted'] = $row->rc_deleted;
901 return isset( $this->mAttribs[
$name] ) ? $this->mAttribs[
$name] : null;
918 if ( $this->mAttribs[
'rc_type'] ==
RC_EDIT ) {
919 $trail =
"curid=" . (int)( $this->mAttribs[
'rc_cur_id'] ) .
920 "&oldid=" . (int)( $this->mAttribs[
'rc_last_oldid'] );
924 $trail .=
'&diff=' . (int)( $this->mAttribs[
'rc_this_oldid'] );
942 $old = $this->mAttribs[
'rc_old_len'];
945 $new = $this->mAttribs[
'rc_new_len'];
947 if ( $old === null || $new === null ) {
958 throw new MWException(
"Attempt to write \"" . $ip .
959 "\" as an IP address into recent changes" );
962 $ip = $wgRequest->getIP();
996 MediaWiki\suppressWarnings();
998 MediaWiki\restoreWarnings();
1000 return $unserializedParams;
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
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.
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.
$wgLogRestrictions
This restricts log access to those who have a certain right Users without this will not see it in the...
Represents a title within MediaWiki.
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).
$wgUseNPPatrol
Use new page patrolling to check new pages on Special:Newpages.
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.
$wgRCMaxAge
Recentchanges items are periodically purged; entries older than this many seconds will go...
getPerformer()
Get the User object of the person who performed this change.
getAttribute($name)
Get an attribute value.
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...
static addCallableUpdate($callable, $type=self::POSTSEND)
Add a callable update.
The User object encapsulates all of the user-specific settings (user_id, name, rights, email address, options, last login time).
wfTimestamp($outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
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.
$wgUseFilePatrol
Use file patrolling to check new files on Special:Newfiles.
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 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 after processing 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 checkIPAddress($ip)
$wgShowUpdatedMarker
Show "Updated (since my last visit)" marker in RC view, watchlist and history view for watched pages ...
static showCharacterDifference($old, $new, IContextSource $context=null)
Show formatted char difference.
static array $changeTypes
Array of change types.
$wgPutIPinRC
Log IP addresses in the recentchanges table; can be accessed only by extensions (e.g.
$wgRCEngines
Used by RecentChange::getEngine to find the correct engine to use for a given URI scheme...
Allows to change the fields on the form that will be generated are created Can be used to omit specific feeds from being outputted You must not use this hook to add use OutputPage::addFeedLink() instead.&$feedLinks conditions will AND in the final query as a Content object as a Content object $title
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
$wgUseRCPatrol
Use RC Patrolling to check for vandalism (from recent changes and watchlists) New pages and new files...
getNamespace()
Get the namespace index, i.e.
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
static array static newFromRow($row)
static singleton($wiki=false)
static parseFromRCType($rcType)
Parsing RC_* constants to human-readable test.
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
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.
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
$wgRCFeeds
Recentchanges items are periodically purged; entries older than this many seconds will go...
This is to display changes made to all articles linked in an article.
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
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 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.
if(is_null($wgLocalTZoffset)) if(!$wgDBerrorLogTZ) $wgRequest
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.
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 as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object to manipulate or replace but no entry for that model exists in $wgContentHandlers if desired whether it is OK to use $contentModel on $title Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok inclusive false for true for descending in case the handler function wants to provide a converted Content object Note that $result getContentModel() must return $toModel. 'CustomEditor'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 newFromConds($conds, $fname=__METHOD__, $dbType=DB_SLAVE)
Find the first recent change matching some specific conditions.
getPrefixedDBkey()
Get the prefixed database key form.
Allows to change the fields on the form that will be generated $name