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 );
186 $row = $db->selectRow(
'recentchanges', self::selectFields(), $conds,
$fname );
187 if ( $row !==
false ) {
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'] ) {
263 $this->mPerformer = User::newFromId( $this->mAttribs[
'rc_user'] );
265 $this->mPerformer = User::newFromName( $this->mAttribs[
'rc_user_text'],
false );
276 public function save( $noudp =
false ) {
280 if ( !is_array( $this->mExtra ) ) {
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();
317 Hooks::run(
'RecentChange_save', [ &$rc ] );
319 # Notify external application via UDP
324 # E-mail notifications
331 if ( Hooks::run(
'AbortEmailNotification', [
$editor,
$title, $this ] ) ) {
332 # @todo FIXME: This would be better as an extension hook
334 $enotif->notifyOnPageChange(
337 $this->mAttribs[
'rc_timestamp'],
338 $this->mAttribs[
'rc_comment'],
339 $this->mAttribs[
'rc_minor'],
340 $this->mAttribs[
'rc_last_oldid'],
341 $this->mExtra[
'pageStatus']
348 if ( $this->mAttribs[
'rc_user'] > 0 ) {
359 if ( $feeds ===
null ) {
365 foreach ( $feeds
as $feed ) {
367 'omit_bots' =>
false,
368 'omit_anon' =>
false,
369 'omit_user' =>
false,
370 'omit_minor' =>
false,
371 'omit_patrolled' =>
false,
375 ( $feed[
'omit_bots'] && $this->mAttribs[
'rc_bot'] ) ||
376 ( $feed[
'omit_anon'] && $performer->isAnon() ) ||
377 ( $feed[
'omit_user'] && !$performer->isAnon() ) ||
378 ( $feed[
'omit_minor'] && $this->mAttribs[
'rc_minor'] ) ||
379 ( $feed[
'omit_patrolled'] && $this->mAttribs[
'rc_patrolled'] ) ||
387 if ( isset( $this->mExtra[
'actionCommentIRC'] ) ) {
388 $actionComment = $this->mExtra[
'actionCommentIRC'];
390 $actionComment =
null;
394 $formatter = is_object( $feed[
'formatter'] ) ? $feed[
'formatter'] :
new $feed[
'formatter']();
395 $line = $formatter->getLine( $feed, $this, $actionComment );
404 $engine->send( $feed,
$line );
418 $scheme = parse_url( $uri, PHP_URL_SCHEME );
420 throw new MWException( __FUNCTION__ .
": Invalid stream logger URI: '$uri'" );
424 throw new MWException( __FUNCTION__ .
": Unknown stream logger URI scheme: $scheme" );
450 return $change->doMarkPatrolled(
$wgUser,
$auto, $tags );
472 $this->
getAttribute(
'rc_log_type' ) ==
'upload' ) ) ) {
473 $errors[] = [
'rcpatroldisabled' ];
476 $right =
$auto ?
'autopatrol' :
'patrol';
477 $errors = array_merge( $errors, $this->
getTitle()->getUserPermissionsErrors( $right,
$user ) );
478 if ( !Hooks::run(
'MarkPatrolled',
481 $errors[] = [
'hookaborted' ];
485 if (
$user->getName() === $this->getAttribute(
'rc_user_text' )
486 && !
$user->isAllowed(
'autopatrol' )
488 $errors[] = [
'markedaspatrollederror-noautopatrol' ];
503 'MarkPatrolledComplete',
528 $this->
getTitle()->invalidateCache();
530 return $dbw->affectedRows();
554 $bot, $ip =
'', $oldSize = 0, $newSize = 0, $newId = 0, $patrol = 0,
559 $rc->mPerformer =
$user;
562 'rc_namespace' =>
$title->getNamespace(),
563 'rc_title' =>
$title->getDBkey(),
566 'rc_minor' => $minor ? 1 : 0,
567 'rc_cur_id' =>
$title->getArticleID(),
568 'rc_user' =>
$user->getId(),
569 'rc_user_text' =>
$user->getName(),
571 'rc_this_oldid' => $newId,
572 'rc_last_oldid' => $oldId,
573 'rc_bot' => $bot ? 1 : 0,
575 'rc_patrolled' => intval( $patrol ),
576 'rc_new' => 0, # obsolete
577 'rc_old_len' => $oldSize,
578 'rc_new_len' => $newSize,
581 'rc_log_type' =>
null,
582 'rc_log_action' =>
'',
587 'prefixedDBkey' =>
$title->getPrefixedDBkey(),
588 'lastTimestamp' => $lastTimestamp,
589 'oldSize' => $oldSize,
590 'newSize' => $newSize,
591 'pageStatus' =>
'changed'
594 DeferredUpdates::addCallableUpdate(
function()
use ( $rc, $tags ) {
596 if ( $rc->mAttribs[
'rc_patrolled'] ) {
597 PatrolLog::record( $rc, true, $rc->getPerformer() );
599 if ( count( $tags ) ) {
601 $rc->mAttribs[
'rc_this_oldid'],
null,
null );
627 $ip =
'', $size = 0, $newId = 0, $patrol = 0, $tags = []
631 $rc->mPerformer =
$user;
634 'rc_namespace' =>
$title->getNamespace(),
635 'rc_title' =>
$title->getDBkey(),
638 'rc_minor' => $minor ? 1 : 0,
639 'rc_cur_id' =>
$title->getArticleID(),
640 'rc_user' =>
$user->getId(),
641 'rc_user_text' =>
$user->getName(),
643 'rc_this_oldid' => $newId,
644 'rc_last_oldid' => 0,
645 'rc_bot' => $bot ? 1 : 0,
647 'rc_patrolled' => intval( $patrol ),
648 'rc_new' => 1, # obsolete
650 'rc_new_len' => $size,
653 'rc_log_type' =>
null,
654 'rc_log_action' =>
'',
659 'prefixedDBkey' =>
$title->getPrefixedDBkey(),
660 'lastTimestamp' => 0,
663 'pageStatus' =>
'created'
666 DeferredUpdates::addCallableUpdate(
function()
use ( $rc, $tags ) {
668 if ( $rc->mAttribs[
'rc_patrolled'] ) {
669 PatrolLog::record( $rc, true, $rc->getPerformer() );
671 if ( count( $tags ) ) {
673 $rc->mAttribs[
'rc_this_oldid'],
null,
null );
696 $action, $target, $logComment,
$params, $newId = 0, $actionCommentIRC =
''
700 # Don't add private logs to RC!
705 $target, $logComment,
$params, $newId, $actionCommentIRC );
729 $type, $action, $target, $logComment,
$params, $newId = 0, $actionCommentIRC =
'',
730 $revId = 0, $isPatrollable =
false ) {
733 # # Get pageStatus for email notification
734 switch (
$type .
'-' . $action ) {
735 case 'delete-delete':
736 $pageStatus =
'deleted';
739 case 'move-move_redir':
740 $pageStatus =
'moved';
742 case 'delete-restore':
743 $pageStatus =
'restored';
745 case 'upload-upload':
746 $pageStatus =
'created';
748 case 'upload-overwrite':
750 $pageStatus =
'changed';
755 $markPatrolled = $isPatrollable ?
$user->isAllowed(
'autopatrol' ) :
true;
758 $rc->mTitle = $target;
759 $rc->mPerformer =
$user;
762 'rc_namespace' => $target->getNamespace(),
763 'rc_title' => $target->getDBkey(),
767 'rc_cur_id' => $target->getArticleID(),
768 'rc_user' =>
$user->getId(),
769 'rc_user_text' =>
$user->getName(),
770 'rc_comment' => $logComment,
771 'rc_this_oldid' =>
$revId,
772 'rc_last_oldid' => 0,
773 'rc_bot' =>
$user->isAllowed(
'bot' ) ?
$wgRequest->getBool(
'bot',
true ) : 0,
775 'rc_patrolled' => $markPatrolled ? 1 : 0,
776 'rc_new' => 0, # obsolete
777 'rc_old_len' =>
null,
778 'rc_new_len' =>
null,
780 'rc_logid' => $newId,
781 'rc_log_type' =>
$type,
782 'rc_log_action' => $action,
787 'prefixedDBkey' =>
$title->getPrefixedDBkey(),
788 'lastTimestamp' => 0,
789 'actionComment' => $actionComment,
790 'pageStatus' => $pageStatus,
791 'actionCommentIRC' => $actionCommentIRC
819 Title $categoryTitle,
831 $rc->mTitle = $categoryTitle;
832 $rc->mPerformer =
$user;
836 'rc_title' => $categoryTitle->
getDBkey(),
842 'rc_user_text' =>
$user ?
$user->getName() :
'',
844 'rc_this_oldid' => $newRevId,
845 'rc_last_oldid' => $oldRevId,
846 'rc_bot' => $bot ? 1 : 0,
849 'rc_new' => 0, # obsolete
850 'rc_old_len' =>
null,
851 'rc_new_len' =>
null,
852 'rc_deleted' => $deleted,
854 'rc_log_type' =>
null,
855 'rc_log_action' =>
'',
863 'lastTimestamp' => $lastTimestamp,
866 'pageStatus' =>
'changed'
891 $this->mAttribs = get_object_vars( $row );
892 $this->mAttribs[
'rc_timestamp'] =
wfTimestamp(
TS_MW, $this->mAttribs[
'rc_timestamp'] );
893 $this->mAttribs[
'rc_deleted'] = $row->rc_deleted;
903 return isset( $this->mAttribs[
$name] ) ? $this->mAttribs[
$name] :
null;
920 if ( $this->mAttribs[
'rc_type'] ==
RC_EDIT ) {
921 $trail =
"curid=" . (int)( $this->mAttribs[
'rc_cur_id'] ) .
922 "&oldid=" . (int)( $this->mAttribs[
'rc_last_oldid'] );
926 $trail .=
'&diff=' . (int)( $this->mAttribs[
'rc_this_oldid'] );
944 $old = $this->mAttribs[
'rc_old_len'];
947 $new = $this->mAttribs[
'rc_new_len'];
949 if ( $old ===
null || $new ===
null ) {
960 throw new MWException(
"Attempt to write \"" . $ip .
961 "\" as an IP address into recent changes" );
998 MediaWiki\suppressWarnings();
1000 MediaWiki\restoreWarnings();
1002 return $unserializedParams;
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
unserialize( $serialized)
$wgRCFeeds
Recentchanges items are periodically purged; entries older than this many seconds will go.
$wgPutIPinRC
Log IP addresses in the recentchanges table; can be accessed only by extensions (e....
$wgUseFilePatrol
Use file patrolling to check new files on Special:Newfiles.
$wgLogRestrictions
This restricts log access to those who have a certain right Users without this will not see it in the...
$wgShowUpdatedMarker
Show "Updated (since my last visit)" marker in RC view, watchlist and history view for watched pages ...
$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.
$wgRCMaxAge
Recentchanges items are periodically purged; entries older than this many seconds will go.
$wgRCEngines
Used by RecentChange::getEngine to find the correct engine to use for a given URI scheme.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.
if(is_null($wgLocalTZoffset)) if(! $wgDBerrorLogTZ) $wgRequest
static showCharacterDifference( $old, $new, IContextSource $context=null)
Show formatted char difference.
This module processes the email notifications when the current page is changed.
static isIPAddress( $ip)
Determine if a string is as valid IP address or network (CIDR prefix).
static singleton( $wiki=false)
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.
static parseToRCType( $type)
Parsing text to RC_* constants.
reallyMarkPatrolled()
Mark this RecentChange patrolled, without error checking.
static getEngine( $uri)
Gets the stream engine object for a given URI from $wgRCEngines.
parseParams()
Parses and returns the rc_params attribute.
static array $changeTypes
Array of change types.
static selectFields()
Return the list of recentchanges fields that should be selected to create a new recentchanges object.
getPerformer()
Get the User object of the person who performed this change.
static checkIPAddress( $ip)
static getChangeTypes()
Get an array of all change types.
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...
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 markPatrolled( $change, $auto=false, $tags=null)
Mark a given change as patrolled.
int $counter
Line number of recent change.
doMarkPatrolled(User $user, $auto=false, $tags=null)
Mark this RecentChange as patrolled.
static newLogEntry( $timestamp, &$title, &$user, $actionComment, $ip, $type, $action, $target, $logComment, $params, $newId=0, $actionCommentIRC='', $revId=0, $isPatrollable=false)
getCharacterDifference( $old=0, $new=0)
Returns the change size (HTML).
static parseFromRCType( $rcType)
Parsing RC_* constants to human-readable test.
notifyRCFeeds(array $feeds=null)
Notify all the feeds about the change.
save( $noudp=false)
Writes the data in this object to the database.
getParam( $name)
Get a parameter value.
static newFromConds( $conds, $fname=__METHOD__, $dbType=DB_SLAVE)
Find the first recent change matching some specific conditions.
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.
getAttribute( $name)
Get an attribute value.
static notifyLog( $timestamp, &$title, &$user, $actionComment, $ip, $type, $action, $target, $logComment, $params, $newId=0, $actionCommentIRC='')
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.
diffLinkTrail( $forceCur)
Gets the end part of the diff URL associated with this object Blank if no diff link should be display...
static newFromId( $rcid)
Obtain the recent change with a given rc_id value.
static newCacheUpdateJob()
This is to display changes made to all articles linked in an article.
Represents a title within MediaWiki.
getNamespace()
Get the namespace index, i.e.
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
getPrefixedDBkey()
Get the prefixed database key form.
getDBkey()
Get the main part with underscores.
getArticleID( $flags=0)
Get the article ID for this Title from the link cache, adding it if necessary.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
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
when a variable name is used in a it is silently declared as a new local masking the global
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
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
the array() calling protocol came about after MediaWiki 1.4rc1.
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
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
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
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
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
namespace and then decline to actually register it file or subcat img or subcat $title
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
null for the local 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 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
Allows to change the fields on the form that will be generated $name
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