Go to the documentation of this file.
115 $rc->notificationtimestamp =
false;
116 $rc->numberofWatchingusers =
false;
127 public static function newFromId( $rcid ) {
141 $row =
$dbr->selectRow(
'recentchanges', self::selectFields(), $conds,
$fname,
$options );
142 if ( $row !==
false ) {
195 public function setExtra( $extra ) {
196 $this->mExtra = $extra;
204 if ( $this->mTitle ===
false ) {
205 $this->mTitle =
Title::makeTitle( $this->mAttribs[
'rc_namespace'], $this->mAttribs[
'rc_title'] );
217 if ( $this->mPerformer ===
false ) {
218 if ( $this->mAttribs[
'rc_user'] ) {
219 $this->mPerformer = User::newFromID( $this->mAttribs[
'rc_user'] );
232 public function save( $noudp =
false ) {
236 if ( !is_array( $this->mExtra ) ) {
237 $this->mExtra =
array();
240 if ( !$wgPutIPinRC ) {
241 $this->mAttribs[
'rc_ip'] =
'';
244 # If our database is strict about IP addresses, use NULL instead of an empty string
245 if ( $dbw->strictIPs() and $this->mAttribs[
'rc_ip'] ==
'' ) {
246 unset( $this->mAttribs[
'rc_ip'] );
249 # Trim spaces on user supplied text
250 $this->mAttribs[
'rc_comment'] = trim( $this->mAttribs[
'rc_comment'] );
252 # Make sure summary is truncated (whole multibyte characters)
253 $this->mAttribs[
'rc_comment'] =
$wgContLang->truncate( $this->mAttribs[
'rc_comment'], 255 );
255 # Fixup database timestamps
256 $this->mAttribs[
'rc_timestamp'] = $dbw->timestamp( $this->mAttribs[
'rc_timestamp'] );
257 $this->mAttribs[
'rc_id'] = $dbw->nextSequenceValue(
'recentchanges_rc_id_seq' );
259 ## If we are using foreign keys, an entry of 0 for the page_id will fail, so use NULL
260 if ( $dbw->cascadingDeletes() and $this->mAttribs[
'rc_cur_id'] == 0 ) {
261 unset( $this->mAttribs[
'rc_cur_id'] );
265 $dbw->insert(
'recentchanges', $this->mAttribs, __METHOD__ );
268 $this->mAttribs[
'rc_id'] = $dbw->insertId();
273 # Notify external application via UDP
278 # E-mail notifications
279 if ( $wgUseEnotif || $wgShowUpdatedMarker ) {
284 # @todo FIXME: This would be better as an extension hook
287 $this->mAttribs[
'rc_timestamp'],
288 $this->mAttribs[
'rc_comment'],
289 $this->mAttribs[
'rc_minor'],
290 $this->mAttribs[
'rc_last_oldid'],
291 $this->mExtra[
'pageStatus'] );
308 public static function sendToUDP(
$line, $address =
'', $prefix =
'', $port =
'' ) {
309 global $wgRC2UDPAddress, $wgRC2UDPInterwikiPrefix, $wgRC2UDPPort, $wgRC2UDPPrefix;
313 # Assume default for standard RC case
314 $address = $address ? $address : $wgRC2UDPAddress;
315 $prefix = $prefix ? $prefix : $wgRC2UDPPrefix;
316 $port = $port ? $port : $wgRC2UDPPort;
320 'uri' =>
"udp://$address:$port/$prefix",
321 'formatter' =>
'IRCColourfulRCFeedFormatter',
322 'add_interwiki_prefix' => $wgRC2UDPInterwikiPrefix,
325 $engine->send( $feed,
$line );
336 foreach ( $wgRCFeeds
as $feed ) {
338 'omit_bots' =>
false,
339 'omit_anon' =>
false,
340 'omit_user' =>
false,
341 'omit_minor' =>
false,
342 'omit_patrolled' =>
false,
346 ( $feed[
'omit_bots'] && $this->mAttribs[
'rc_bot'] ) ||
347 ( $feed[
'omit_anon'] && $performer->isAnon() ) ||
348 ( $feed[
'omit_user'] && !$performer->isAnon() ) ||
349 ( $feed[
'omit_minor'] && $this->mAttribs[
'rc_minor'] ) ||
350 ( $feed[
'omit_patrolled'] && $this->mAttribs[
'rc_patrolled'] ) ||
358 if ( isset( $this->mExtra[
'actionCommentIRC'] ) ) {
359 $actionComment = $this->mExtra[
'actionCommentIRC'];
361 $actionComment =
null;
365 $formatter =
new $feed[
'formatter']();
366 $line = $formatter->getLine( $feed, $this, $actionComment );
368 $engine->send( $feed,
$line );
379 public static function getEngine( $uri ) {
382 $scheme = parse_url( $uri, PHP_URL_SCHEME );
384 throw new MWException( __FUNCTION__ .
": Invalid stream logger URI: '$uri'" );
387 if ( !isset( $wgRCEngines[$scheme] ) ) {
388 throw new MWException( __FUNCTION__ .
": Unknown stream logger URI scheme: $scheme" );
391 return new $wgRCEngines[$scheme];
410 public static function markPatrolled( $change, $auto =
false ) {
421 return $change->doMarkPatrolled(
$wgUser, $auto );
434 global $wgUseRCPatrol, $wgUseNPPatrol;
438 if ( !$wgUseRCPatrol && ( !$wgUseNPPatrol || $this->
getAttribute(
'rc_type' ) !=
RC_NEW ) ) {
439 $errors[] =
array(
'rcpatroldisabled' );
442 $right = $auto ?
'autopatrol' :
'patrol';
443 $errors = array_merge( $errors, $this->
getTitle()->getUserPermissionsErrors(
$right,
$user ) );
445 $errors[] =
array(
'hookaborted' );
452 $errors[] =
array(
'markedaspatrollederror-noautopatrol' );
488 $this->
getTitle()->invalidateCache();
490 return $dbw->affectedRows();
512 $lastTimestamp, $bot, $ip =
'', $oldSize = 0, $newSize = 0, $newId = 0, $patrol = 0 ) {
515 $rc->mPerformer =
$user;
516 $rc->mAttribs =
array(
518 'rc_namespace' =>
$title->getNamespace(),
519 'rc_title' =>
$title->getDBkey(),
522 'rc_minor' => $minor ? 1 : 0,
523 'rc_cur_id' =>
$title->getArticleID(),
524 'rc_user' =>
$user->getId(),
525 'rc_user_text' =>
$user->getName(),
527 'rc_this_oldid' => $newId,
528 'rc_last_oldid' => $oldId,
529 'rc_bot' => $bot ? 1 : 0,
531 'rc_patrolled' => intval( $patrol ),
532 'rc_new' => 0, # obsolete
533 'rc_old_len' => $oldSize,
534 'rc_new_len' => $newSize,
537 'rc_log_type' =>
null,
538 'rc_log_action' =>
'',
543 'prefixedDBkey' =>
$title->getPrefixedDBkey(),
544 'lastTimestamp' => $lastTimestamp,
545 'oldSize' => $oldSize,
546 'newSize' => $newSize,
547 'pageStatus' =>
'changed'
571 $ip =
'',
$size = 0, $newId = 0, $patrol = 0 ) {
574 $rc->mPerformer =
$user;
575 $rc->mAttribs =
array(
577 'rc_namespace' =>
$title->getNamespace(),
578 'rc_title' =>
$title->getDBkey(),
581 'rc_minor' => $minor ? 1 : 0,
582 'rc_cur_id' =>
$title->getArticleID(),
583 'rc_user' =>
$user->getId(),
584 'rc_user_text' =>
$user->getName(),
586 'rc_this_oldid' => $newId,
587 'rc_last_oldid' => 0,
588 'rc_bot' => $bot ? 1 : 0,
590 'rc_patrolled' => intval( $patrol ),
591 'rc_new' => 1, # obsolete
593 'rc_new_len' =>
$size,
596 'rc_log_type' =>
null,
597 'rc_log_action' =>
'',
602 'prefixedDBkey' =>
$title->getPrefixedDBkey(),
603 'lastTimestamp' => 0,
606 'pageStatus' =>
'created'
629 $action, $target, $logComment,
$params, $newId = 0, $actionCommentIRC =
''
631 global $wgLogRestrictions;
633 # Don't add private logs to RC!
634 if ( isset( $wgLogRestrictions[
$type] ) && $wgLogRestrictions[
$type] !=
'*' ) {
638 $target, $logComment,
$params, $newId, $actionCommentIRC );
660 $type, $action, $target, $logComment,
$params, $newId = 0, $actionCommentIRC =
'' ) {
663 ## Get pageStatus for email notification
664 switch (
$type .
'-' . $action ) {
665 case 'delete-delete':
666 $pageStatus =
'deleted';
669 case 'move-move_redir':
670 $pageStatus =
'moved';
672 case 'delete-restore':
673 $pageStatus =
'restored';
675 case 'upload-upload':
676 $pageStatus =
'created';
678 case 'upload-overwrite':
680 $pageStatus =
'changed';
685 $rc->mTitle = $target;
686 $rc->mPerformer =
$user;
687 $rc->mAttribs =
array(
689 'rc_namespace' => $target->getNamespace(),
690 'rc_title' => $target->getDBkey(),
694 'rc_cur_id' => $target->getArticleID(),
695 'rc_user' =>
$user->getId(),
696 'rc_user_text' =>
$user->getName(),
697 'rc_comment' => $logComment,
698 'rc_this_oldid' => 0,
699 'rc_last_oldid' => 0,
700 'rc_bot' =>
$user->isAllowed(
'bot' ) ? $wgRequest->getBool(
'bot',
true ) : 0,
703 'rc_new' => 0, # obsolete
704 'rc_old_len' =>
null,
705 'rc_new_len' =>
null,
707 'rc_logid' => $newId,
708 'rc_log_type' =>
$type,
709 'rc_log_action' => $action,
714 'prefixedDBkey' =>
$title->getPrefixedDBkey(),
715 'lastTimestamp' => 0,
716 'actionComment' => $actionComment,
717 'pageStatus' => $pageStatus,
718 'actionCommentIRC' => $actionCommentIRC
730 $this->mAttribs = get_object_vars( $row );
731 $this->mAttribs[
'rc_timestamp'] =
wfTimestamp(
TS_MW, $this->mAttribs[
'rc_timestamp'] );
732 $this->mAttribs[
'rc_deleted'] = $row->rc_deleted;
743 $this->mAttribs =
array(
745 'rc_user' => $row->rev_user,
746 'rc_user_text' => $row->rev_user_text,
747 'rc_namespace' => $row->page_namespace,
748 'rc_title' => $row->page_title,
749 'rc_comment' => $row->rev_comment,
750 'rc_minor' => $row->rev_minor_edit ? 1 : 0,
752 'rc_source' => $row->page_is_new ? self::SRC_NEW : self::SRC_EDIT,
753 'rc_cur_id' => $row->page_id,
754 'rc_this_oldid' => $row->rev_id,
755 'rc_last_oldid' => isset( $row->rc_last_oldid ) ? $row->rc_last_oldid : 0,
758 'rc_id' => $row->rc_id,
759 'rc_patrolled' => $row->rc_patrolled,
760 'rc_new' => $row->page_is_new, # obsolete
761 'rc_old_len' => $row->rc_old_len,
762 'rc_new_len' => $row->rc_new_len,
763 'rc_params' => isset( $row->rc_params ) ? $row->rc_params :
'',
764 'rc_log_type' => isset( $row->rc_log_type ) ? $row->rc_log_type :
null,
765 'rc_log_action' => isset( $row->rc_log_action ) ? $row->rc_log_action :
null,
766 'rc_logid' => isset( $row->rc_logid ) ? $row->rc_logid : 0,
767 'rc_deleted' => $row->rc_deleted
778 return isset( $this->mAttribs[
$name] ) ? $this->mAttribs[
$name] :
null;
795 if ( $this->mAttribs[
'rc_type'] ==
RC_EDIT ) {
796 $trail =
"curid=" . (int)( $this->mAttribs[
'rc_cur_id'] ) .
797 "&oldid=" . (int)( $this->mAttribs[
'rc_last_oldid'] );
801 $trail .=
'&diff=' . (int)( $this->mAttribs[
'rc_this_oldid'] );
819 $old = $this->mAttribs[
'rc_old_len'];
822 $new = $this->mAttribs[
'rc_new_len'];
824 if ( $old ===
null || $new ===
null ) {
840 $method = __METHOD__;
842 $dbw->onTransactionIdle(
function () use ( $dbw, $method ) {
845 $cutoff = $dbw->timestamp( time() - $wgRCMaxAge );
848 array(
'rc_timestamp < ' . $dbw->addQuotes( $cutoff ) ),
858 throw new MWException(
"Attempt to write \"" . $ip .
859 "\" as an IP address into recent changes" );
862 $ip = $wgRequest->getIP();
getCharacterDifference( $old=0, $new=0)
Returns the change size (HTML).
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
static markPatrolled( $change, $auto=false)
Mark a given change as patrolled.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
static notifyEdit( $timestamp, &$title, $minor, &$user, $comment, $oldId, $lastTimestamp, $bot, $ip='', $oldSize=0, $newSize=0, $newId=0, $patrol=0)
Makes an entry in the database corresponding to an edit.
This is to display changes made to all articles linked in an article.
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
Utility class for creating new RC entries.
static notifyNew( $timestamp, &$title, $minor, &$user, $comment, $bot, $ip='', $size=0, $newId=0, $patrol=0)
Makes an entry in the database corresponding to page creation Note: the title object must be loaded w...
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
static newLogEntry( $timestamp, &$title, &$user, $actionComment, $ip, $type, $action, $target, $logComment, $params, $newId=0, $actionCommentIRC='')
return false if a UserGetRights hook might remove the named right $right
static newFromConds( $conds, $fname=__METHOD__, $options=array())
Find the first recent change matching some specific conditions.
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.
loadFromRow( $row)
Initialises the members of this object from a mysql row object.
reallyMarkPatrolled()
Mark this RecentChange patrolled, without error checking.
wfReadOnly()
Check whether the wiki is in read-only mode.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
int $counter
Line number of recent change.
static cleanupForIRC( $text)
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
loadFromCurRow( $row)
Makes a pseudo-RC entry from a cur row.
static sendToUDP( $line, $address='', $prefix='', $port='')
Send some text to UDP.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
static getEngine( $uri)
Gets the stream engine object for a given URI from $wgRCEngines.
in this case you re responsible for computing and outputting the entire conflict i the difference between revisions and your text headers and sections & $editor
static newFromCurRow( $row)
No uses left in Gerrit on 2013-11-19.
doMarkPatrolled(User $user, $auto=false)
Mark this RecentChange as patrolled.
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
static notifyLog( $timestamp, &$title, &$user, $actionComment, $ip, $type, $action, $target, $logComment, $params, $newId=0, $actionCommentIRC='')
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
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...
Sends the notification to the specified host in a UDP packet.
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 & $options
notifyRCFeeds()
Notify all the feeds about the change.
static newFromId( $rcid)
Obtain the recent change with a given rc_id value.
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
static record( $rc, $auto=false, User $user=null)
Record a log event for a change being patrolled.
presenting them properly to the user as errors is done by the caller $title
Allows to change the fields on the form that will be generated $name
static showCharacterDifference( $old, $new, IContextSource $context=null)
Show formatted char difference.
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
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.
Prior to maintenance scripts were a hodgepodge of code that had no cohesion or formal method of action Beginning in
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
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 purgeExpiredChanges()
Purge expired changes from the recentchanges table.
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...
getPerformer()
Get the User object of the person who performed this change.
This module processes the email notifications when the current page is changed.
save( $noudp=false)
Writes the data in this object to the database.
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
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
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 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 isIPAddress( $ip)
Determine if a string is as valid IP address or network (CIDR prefix).
isAllowed( $action='')
Internal mechanics of testing a permission.