MediaWiki  1.23.6
RecentChange.php
Go to the documentation of this file.
1 <?php
63 class RecentChange {
64  // Constants for the rc_source field. Extensions may also have
65  // their own source constants.
66  const SRC_EDIT = 'mw.edit';
67  const SRC_NEW = 'mw.new';
68  const SRC_LOG = 'mw.log';
69  const SRC_EXTERNAL = 'mw.external'; // obsolete
70 
71  public $mAttribs = array();
72  public $mExtra = array();
73 
77  public $mTitle = false;
78 
82  private $mPerformer = false;
83 
84  public $numberofWatchingusers = 0; # Dummy to prevent error message in SpecialRecentChangesLinked
86 
90  public $counter = -1;
91 
92  # Factory methods
93 
98  public static function newFromRow( $row ) {
99  $rc = new RecentChange;
100  $rc->loadFromRow( $row );
101 
102  return $rc;
103  }
104 
111  public static function newFromCurRow( $row ) {
112  wfDeprecated( __METHOD__, '1.22' );
113  $rc = new RecentChange;
114  $rc->loadFromCurRow( $row );
115  $rc->notificationtimestamp = false;
116  $rc->numberofWatchingusers = false;
117 
118  return $rc;
119  }
120 
127  public static function newFromId( $rcid ) {
128  return self::newFromConds( array( 'rc_id' => $rcid ), __METHOD__ );
129  }
130 
139  public static function newFromConds( $conds, $fname = __METHOD__, $options = array() ) {
140  $dbr = wfGetDB( DB_SLAVE );
141  $row = $dbr->selectRow( 'recentchanges', self::selectFields(), $conds, $fname, $options );
142  if ( $row !== false ) {
143  return self::newFromRow( $row );
144  } else {
145  return null;
146  }
147  }
148 
154  public static function selectFields() {
155  return array(
156  'rc_id',
157  'rc_timestamp',
158  'rc_user',
159  'rc_user_text',
160  'rc_namespace',
161  'rc_title',
162  'rc_comment',
163  'rc_minor',
164  'rc_bot',
165  'rc_new',
166  'rc_cur_id',
167  'rc_this_oldid',
168  'rc_last_oldid',
169  'rc_type',
170  'rc_source',
171  'rc_patrolled',
172  'rc_ip',
173  'rc_old_len',
174  'rc_new_len',
175  'rc_deleted',
176  'rc_logid',
177  'rc_log_type',
178  'rc_log_action',
179  'rc_params',
180  );
181  }
182 
183  # Accessors
184 
188  public function setAttribs( $attribs ) {
189  $this->mAttribs = $attribs;
190  }
191 
195  public function setExtra( $extra ) {
196  $this->mExtra = $extra;
197  }
198 
203  public function &getTitle() {
204  if ( $this->mTitle === false ) {
205  $this->mTitle = Title::makeTitle( $this->mAttribs['rc_namespace'], $this->mAttribs['rc_title'] );
206  }
207 
208  return $this->mTitle;
209  }
210 
216  public function getPerformer() {
217  if ( $this->mPerformer === false ) {
218  if ( $this->mAttribs['rc_user'] ) {
219  $this->mPerformer = User::newFromID( $this->mAttribs['rc_user'] );
220  } else {
221  $this->mPerformer = User::newFromName( $this->mAttribs['rc_user_text'], false );
222  }
223  }
224 
225  return $this->mPerformer;
226  }
227 
232  public function save( $noudp = false ) {
233  global $wgPutIPinRC, $wgUseEnotif, $wgShowUpdatedMarker, $wgContLang;
234 
235  $dbw = wfGetDB( DB_MASTER );
236  if ( !is_array( $this->mExtra ) ) {
237  $this->mExtra = array();
238  }
239 
240  if ( !$wgPutIPinRC ) {
241  $this->mAttribs['rc_ip'] = '';
242  }
243 
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'] );
247  }
248 
249  # Trim spaces on user supplied text
250  $this->mAttribs['rc_comment'] = trim( $this->mAttribs['rc_comment'] );
251 
252  # Make sure summary is truncated (whole multibyte characters)
253  $this->mAttribs['rc_comment'] = $wgContLang->truncate( $this->mAttribs['rc_comment'], 255 );
254 
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' );
258 
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'] );
262  }
263 
264  # Insert new row
265  $dbw->insert( 'recentchanges', $this->mAttribs, __METHOD__ );
266 
267  # Set the ID
268  $this->mAttribs['rc_id'] = $dbw->insertId();
269 
270  # Notify extensions
271  wfRunHooks( 'RecentChange_save', array( &$this ) );
272 
273  # Notify external application via UDP
274  if ( !$noudp ) {
275  $this->notifyRCFeeds();
276  }
277 
278  # E-mail notifications
279  if ( $wgUseEnotif || $wgShowUpdatedMarker ) {
280  $editor = $this->getPerformer();
281  $title = $this->getTitle();
282 
283  if ( wfRunHooks( 'AbortEmailNotification', array( $editor, $title ) ) ) {
284  # @todo FIXME: This would be better as an extension hook
285  $enotif = new EmailNotification();
286  $enotif->notifyOnPageChange( $editor, $title,
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'] );
292  }
293  }
294  }
295 
299  public function notifyRC2UDP() {
300  wfDeprecated( __METHOD__, '1.22' );
301  $this->notifyRCFeeds();
302  }
303 
308  public static function sendToUDP( $line, $address = '', $prefix = '', $port = '' ) {
309  global $wgRC2UDPAddress, $wgRC2UDPInterwikiPrefix, $wgRC2UDPPort, $wgRC2UDPPrefix;
310 
311  wfDeprecated( __METHOD__, '1.22' );
312 
313  # Assume default for standard RC case
314  $address = $address ? $address : $wgRC2UDPAddress;
315  $prefix = $prefix ? $prefix : $wgRC2UDPPrefix;
316  $port = $port ? $port : $wgRC2UDPPort;
317 
318  $engine = new UDPRCFeedEngine();
319  $feed = array(
320  'uri' => "udp://$address:$port/$prefix",
321  'formatter' => 'IRCColourfulRCFeedFormatter',
322  'add_interwiki_prefix' => $wgRC2UDPInterwikiPrefix,
323  );
324 
325  $engine->send( $feed, $line );
326  }
327 
331  public function notifyRCFeeds() {
332  global $wgRCFeeds;
333 
334  $performer = $this->getPerformer();
335 
336  foreach ( $wgRCFeeds as $feed ) {
337  $feed += array(
338  'omit_bots' => false,
339  'omit_anon' => false,
340  'omit_user' => false,
341  'omit_minor' => false,
342  'omit_patrolled' => false,
343  );
344 
345  if (
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'] ) ||
351  $this->mAttribs['rc_type'] == RC_EXTERNAL
352  ) {
353  continue;
354  }
355 
356  $engine = self::getEngine( $feed['uri'] );
357 
358  if ( isset( $this->mExtra['actionCommentIRC'] ) ) {
359  $actionComment = $this->mExtra['actionCommentIRC'];
360  } else {
361  $actionComment = null;
362  }
363 
365  $formatter = new $feed['formatter']();
366  $line = $formatter->getLine( $feed, $this, $actionComment );
367 
368  $engine->send( $feed, $line );
369  }
370  }
371 
379  public static function getEngine( $uri ) {
380  global $wgRCEngines;
381 
382  $scheme = parse_url( $uri, PHP_URL_SCHEME );
383  if ( !$scheme ) {
384  throw new MWException( __FUNCTION__ . ": Invalid stream logger URI: '$uri'" );
385  }
386 
387  if ( !isset( $wgRCEngines[$scheme] ) ) {
388  throw new MWException( __FUNCTION__ . ": Unknown stream logger URI scheme: $scheme" );
389  }
390 
391  return new $wgRCEngines[$scheme];
392  }
393 
397  public static function cleanupForIRC( $text ) {
398  wfDeprecated( __METHOD__, '1.22' );
399 
401  }
402 
410  public static function markPatrolled( $change, $auto = false ) {
411  global $wgUser;
412 
413  $change = $change instanceof RecentChange
414  ? $change
415  : RecentChange::newFromId( $change );
416 
417  if ( !$change instanceof RecentChange ) {
418  return null;
419  }
420 
421  return $change->doMarkPatrolled( $wgUser, $auto );
422  }
423 
433  public function doMarkPatrolled( User $user, $auto = false ) {
434  global $wgUseRCPatrol, $wgUseNPPatrol;
435  $errors = array();
436  // If recentchanges patrol is disabled, only new pages
437  // can be patrolled
438  if ( !$wgUseRCPatrol && ( !$wgUseNPPatrol || $this->getAttribute( 'rc_type' ) != RC_NEW ) ) {
439  $errors[] = array( 'rcpatroldisabled' );
440  }
441  // Automatic patrol needs "autopatrol", ordinary patrol needs "patrol"
442  $right = $auto ? 'autopatrol' : 'patrol';
443  $errors = array_merge( $errors, $this->getTitle()->getUserPermissionsErrors( $right, $user ) );
444  if ( !wfRunHooks( 'MarkPatrolled', array( $this->getAttribute( 'rc_id' ), &$user, false ) ) ) {
445  $errors[] = array( 'hookaborted' );
446  }
447  // Users without the 'autopatrol' right can't patrol their
448  // own revisions
449  if ( $user->getName() == $this->getAttribute( 'rc_user_text' )
450  && !$user->isAllowed( 'autopatrol' )
451  ) {
452  $errors[] = array( 'markedaspatrollederror-noautopatrol' );
453  }
454  if ( $errors ) {
455  return $errors;
456  }
457  // If the change was patrolled already, do nothing
458  if ( $this->getAttribute( 'rc_patrolled' ) ) {
459  return array();
460  }
461  // Actually set the 'patrolled' flag in RC
462  $this->reallyMarkPatrolled();
463  // Log this patrol event
464  PatrolLog::record( $this, $auto, $user );
465  wfRunHooks( 'MarkPatrolledComplete', array( $this->getAttribute( 'rc_id' ), &$user, false ) );
466 
467  return array();
468  }
469 
474  public function reallyMarkPatrolled() {
475  $dbw = wfGetDB( DB_MASTER );
476  $dbw->update(
477  'recentchanges',
478  array(
479  'rc_patrolled' => 1
480  ),
481  array(
482  'rc_id' => $this->getAttribute( 'rc_id' )
483  ),
484  __METHOD__
485  );
486  // Invalidate the page cache after the page has been patrolled
487  // to make sure that the Patrol link isn't visible any longer!
488  $this->getTitle()->invalidateCache();
489 
490  return $dbw->affectedRows();
491  }
492 
511  public static function notifyEdit( $timestamp, &$title, $minor, &$user, $comment, $oldId,
512  $lastTimestamp, $bot, $ip = '', $oldSize = 0, $newSize = 0, $newId = 0, $patrol = 0 ) {
513  $rc = new RecentChange;
514  $rc->mTitle = $title;
515  $rc->mPerformer = $user;
516  $rc->mAttribs = array(
517  'rc_timestamp' => $timestamp,
518  'rc_namespace' => $title->getNamespace(),
519  'rc_title' => $title->getDBkey(),
520  'rc_type' => RC_EDIT,
521  'rc_source' => self::SRC_EDIT,
522  'rc_minor' => $minor ? 1 : 0,
523  'rc_cur_id' => $title->getArticleID(),
524  'rc_user' => $user->getId(),
525  'rc_user_text' => $user->getName(),
526  'rc_comment' => $comment,
527  'rc_this_oldid' => $newId,
528  'rc_last_oldid' => $oldId,
529  'rc_bot' => $bot ? 1 : 0,
530  'rc_ip' => self::checkIPAddress( $ip ),
531  'rc_patrolled' => intval( $patrol ),
532  'rc_new' => 0, # obsolete
533  'rc_old_len' => $oldSize,
534  'rc_new_len' => $newSize,
535  'rc_deleted' => 0,
536  'rc_logid' => 0,
537  'rc_log_type' => null,
538  'rc_log_action' => '',
539  'rc_params' => ''
540  );
541 
542  $rc->mExtra = array(
543  'prefixedDBkey' => $title->getPrefixedDBkey(),
544  'lastTimestamp' => $lastTimestamp,
545  'oldSize' => $oldSize,
546  'newSize' => $newSize,
547  'pageStatus' => 'changed'
548  );
549  $rc->save();
550 
551  return $rc;
552  }
553 
570  public static function notifyNew( $timestamp, &$title, $minor, &$user, $comment, $bot,
571  $ip = '', $size = 0, $newId = 0, $patrol = 0 ) {
572  $rc = new RecentChange;
573  $rc->mTitle = $title;
574  $rc->mPerformer = $user;
575  $rc->mAttribs = array(
576  'rc_timestamp' => $timestamp,
577  'rc_namespace' => $title->getNamespace(),
578  'rc_title' => $title->getDBkey(),
579  'rc_type' => RC_NEW,
580  'rc_source' => self::SRC_NEW,
581  'rc_minor' => $minor ? 1 : 0,
582  'rc_cur_id' => $title->getArticleID(),
583  'rc_user' => $user->getId(),
584  'rc_user_text' => $user->getName(),
585  'rc_comment' => $comment,
586  'rc_this_oldid' => $newId,
587  'rc_last_oldid' => 0,
588  'rc_bot' => $bot ? 1 : 0,
589  'rc_ip' => self::checkIPAddress( $ip ),
590  'rc_patrolled' => intval( $patrol ),
591  'rc_new' => 1, # obsolete
592  'rc_old_len' => 0,
593  'rc_new_len' => $size,
594  'rc_deleted' => 0,
595  'rc_logid' => 0,
596  'rc_log_type' => null,
597  'rc_log_action' => '',
598  'rc_params' => ''
599  );
600 
601  $rc->mExtra = array(
602  'prefixedDBkey' => $title->getPrefixedDBkey(),
603  'lastTimestamp' => 0,
604  'oldSize' => 0,
605  'newSize' => $size,
606  'pageStatus' => 'created'
607  );
608  $rc->save();
609 
610  return $rc;
611  }
612 
628  public static function notifyLog( $timestamp, &$title, &$user, $actionComment, $ip, $type,
629  $action, $target, $logComment, $params, $newId = 0, $actionCommentIRC = ''
630  ) {
631  global $wgLogRestrictions;
632 
633  # Don't add private logs to RC!
634  if ( isset( $wgLogRestrictions[$type] ) && $wgLogRestrictions[$type] != '*' ) {
635  return false;
636  }
637  $rc = self::newLogEntry( $timestamp, $title, $user, $actionComment, $ip, $type, $action,
638  $target, $logComment, $params, $newId, $actionCommentIRC );
639  $rc->save();
640 
641  return true;
642  }
643 
659  public static function newLogEntry( $timestamp, &$title, &$user, $actionComment, $ip,
660  $type, $action, $target, $logComment, $params, $newId = 0, $actionCommentIRC = '' ) {
661  global $wgRequest;
662 
663  ## Get pageStatus for email notification
664  switch ( $type . '-' . $action ) {
665  case 'delete-delete':
666  $pageStatus = 'deleted';
667  break;
668  case 'move-move':
669  case 'move-move_redir':
670  $pageStatus = 'moved';
671  break;
672  case 'delete-restore':
673  $pageStatus = 'restored';
674  break;
675  case 'upload-upload':
676  $pageStatus = 'created';
677  break;
678  case 'upload-overwrite':
679  default:
680  $pageStatus = 'changed';
681  break;
682  }
683 
684  $rc = new RecentChange;
685  $rc->mTitle = $target;
686  $rc->mPerformer = $user;
687  $rc->mAttribs = array(
688  'rc_timestamp' => $timestamp,
689  'rc_namespace' => $target->getNamespace(),
690  'rc_title' => $target->getDBkey(),
691  'rc_type' => RC_LOG,
692  'rc_source' => self::SRC_LOG,
693  'rc_minor' => 0,
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,
701  'rc_ip' => self::checkIPAddress( $ip ),
702  'rc_patrolled' => 1,
703  'rc_new' => 0, # obsolete
704  'rc_old_len' => null,
705  'rc_new_len' => null,
706  'rc_deleted' => 0,
707  'rc_logid' => $newId,
708  'rc_log_type' => $type,
709  'rc_log_action' => $action,
710  'rc_params' => $params
711  );
712 
713  $rc->mExtra = array(
714  'prefixedDBkey' => $title->getPrefixedDBkey(),
715  'lastTimestamp' => 0,
716  'actionComment' => $actionComment, // the comment appended to the action, passed from LogPage
717  'pageStatus' => $pageStatus,
718  'actionCommentIRC' => $actionCommentIRC
719  );
720 
721  return $rc;
722  }
723 
729  public function loadFromRow( $row ) {
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; // MUST be set
733  }
734 
741  public function loadFromCurRow( $row ) {
742  wfDeprecated( __METHOD__, '1.22' );
743  $this->mAttribs = array(
744  'rc_timestamp' => wfTimestamp( TS_MW, $row->rev_timestamp ),
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,
751  'rc_type' => $row->page_is_new ? RC_NEW : RC_EDIT,
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,
756  'rc_bot' => 0,
757  'rc_ip' => '',
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 // MUST be set
768  );
769  }
770 
777  public function getAttribute( $name ) {
778  return isset( $this->mAttribs[$name] ) ? $this->mAttribs[$name] : null;
779  }
780 
784  public function getAttributes() {
785  return $this->mAttribs;
786  }
787 
794  public function diffLinkTrail( $forceCur ) {
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'] );
798  if ( $forceCur ) {
799  $trail .= '&diff=0';
800  } else {
801  $trail .= '&diff=' . (int)( $this->mAttribs['rc_this_oldid'] );
802  }
803  } else {
804  $trail = '';
805  }
806 
807  return $trail;
808  }
809 
817  public function getCharacterDifference( $old = 0, $new = 0 ) {
818  if ( $old === 0 ) {
819  $old = $this->mAttribs['rc_old_len'];
820  }
821  if ( $new === 0 ) {
822  $new = $this->mAttribs['rc_new_len'];
823  }
824  if ( $old === null || $new === null ) {
825  return '';
826  }
827 
828  return ChangesList::showCharacterDifference( $old, $new );
829  }
830 
835  public static function purgeExpiredChanges() {
836  if ( wfReadOnly() ) {
837  return;
838  }
839 
840  $method = __METHOD__;
841  $dbw = wfGetDB( DB_MASTER );
842  $dbw->onTransactionIdle( function () use ( $dbw, $method ) {
843  global $wgRCMaxAge;
844 
845  $cutoff = $dbw->timestamp( time() - $wgRCMaxAge );
846  $dbw->delete(
847  'recentchanges',
848  array( 'rc_timestamp < ' . $dbw->addQuotes( $cutoff ) ),
849  $method
850  );
851  } );
852  }
853 
854  private static function checkIPAddress( $ip ) {
855  global $wgRequest;
856  if ( $ip ) {
857  if ( !IP::isIPAddress( $ip ) ) {
858  throw new MWException( "Attempt to write \"" . $ip .
859  "\" as an IP address into recent changes" );
860  }
861  } else {
862  $ip = $wgRequest->getIP();
863  if ( !$ip ) {
864  $ip = '';
865  }
866  }
867 
868  return $ip;
869  }
870 
880  public static function isInRCLifespan( $timestamp, $tolerance = 0 ) {
881  global $wgRCMaxAge;
882 
883  return wfTimestamp( TS_UNIX, $timestamp ) > time() - $tolerance - $wgRCMaxAge;
884  }
885 }
RecentChange\getCharacterDifference
getCharacterDifference( $old=0, $new=0)
Returns the change size (HTML).
Definition: RecentChange.php:814
Title\makeTitle
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:398
$wgUser
$wgUser
Definition: Setup.php:552
RC_EXTERNAL
const RC_EXTERNAL
Definition: Defines.php:183
DB_MASTER
const DB_MASTER
Definition: Defines.php:56
RecentChange\markPatrolled
static markPatrolled( $change, $auto=false)
Mark a given change as patrolled.
Definition: RecentChange.php:407
php
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
Definition: skin.txt:62
RecentChange\setExtra
setExtra( $extra)
Definition: RecentChange.php:192
RecentChange\notifyEdit
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.
Definition: RecentChange.php:508
SpecialRecentChangesLinked
This is to display changes made to all articles linked in an article.
Definition: SpecialRecentchangeslinked.php:29
RecentChange\getAttributes
getAttributes()
Definition: RecentChange.php:781
wfGetDB
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:3659
$timestamp
if( $limit) $timestamp
Definition: importImages.php:104
RecentChange
Utility class for creating new RC entries.
Definition: RecentChange.php:63
RecentChange\notifyNew
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...
Definition: RecentChange.php:567
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:2483
RecentChange\$mAttribs
$mAttribs
Definition: RecentChange.php:71
RecentChange\newLogEntry
static newLogEntry( $timestamp, &$title, &$user, $actionComment, $ip, $type, $action, $target, $logComment, $params, $newId=0, $actionCommentIRC='')
Definition: RecentChange.php:656
RC_LOG
const RC_LOG
Definition: Defines.php:181
$right
return false if a UserGetRights hook might remove the named right $right
Definition: hooks.txt:2798
RecentChange\newFromConds
static newFromConds( $conds, $fname=__METHOD__, $options=array())
Find the first recent change matching some specific conditions.
Definition: RecentChange.php:136
$fname
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.
Definition: Setup.php:35
RecentChange\loadFromRow
loadFromRow( $row)
Initialises the members of this object from a mysql row object.
Definition: RecentChange.php:726
RecentChange\reallyMarkPatrolled
reallyMarkPatrolled()
Mark this RecentChange patrolled, without error checking.
Definition: RecentChange.php:471
$params
$params
Definition: styleTest.css.php:40
RC_EDIT
const RC_EDIT
Definition: Defines.php:178
wfReadOnly
wfReadOnly()
Check whether the wiki is in read-only mode.
Definition: GlobalFunctions.php:1313
User\newFromName
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition: User.php:388
RecentChange\$counter
int $counter
Line number of recent change.
Definition: RecentChange.php:87
RecentChange\setAttribs
setAttribs( $attribs)
Definition: RecentChange.php:185
RecentChange\cleanupForIRC
static cleanupForIRC( $text)
Definition: RecentChange.php:394
$wgContLang
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
Definition: design.txt:56
RecentChange\SRC_LOG
const SRC_LOG
Definition: RecentChange.php:68
RecentChange\loadFromCurRow
loadFromCurRow( $row)
Makes a pseudo-RC entry from a cur row.
Definition: RecentChange.php:738
$dbr
$dbr
Definition: testCompression.php:48
RecentChange\sendToUDP
static sendToUDP( $line, $address='', $prefix='', $port='')
Send some text to UDP.
Definition: RecentChange.php:305
MWException
MediaWiki exception.
Definition: MWException.php:26
wfDeprecated
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
Definition: GlobalFunctions.php:1127
RecentChange\getEngine
static getEngine( $uri)
Gets the stream engine object for a given URI from $wgRCEngines.
Definition: RecentChange.php:376
RecentChange\$notificationtimestamp
$notificationtimestamp
Definition: RecentChange.php:83
$editor
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
Definition: hooks.txt:1038
RecentChange\newFromCurRow
static newFromCurRow( $row)
No uses left in Gerrit on 2013-11-19.
Definition: RecentChange.php:108
RecentChange\doMarkPatrolled
doMarkPatrolled(User $user, $auto=false)
Mark this RecentChange as patrolled.
Definition: RecentChange.php:430
RecentChange\newFromRow
static newFromRow( $row)
Definition: RecentChange.php:95
wfRunHooks
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
Definition: GlobalFunctions.php:4010
RecentChange\notifyLog
static notifyLog( $timestamp, &$title, &$user, $actionComment, $ip, $type, $action, $target, $logComment, $params, $newId=0, $actionCommentIRC='')
Definition: RecentChange.php:625
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
RecentChange\SRC_EDIT
const SRC_EDIT
Definition: RecentChange.php:66
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
RecentChange\diffLinkTrail
diffLinkTrail( $forceCur)
Gets the end part of the diff URL associated with this object Blank if no diff link should be display...
Definition: RecentChange.php:791
$comment
$comment
Definition: importImages.php:107
RecentChange\SRC_NEW
const SRC_NEW
Definition: RecentChange.php:67
RecentChange\notifyRC2UDP
notifyRC2UDP()
Definition: RecentChange.php:296
UDPRCFeedEngine
Sends the notification to the specified host in a UDP packet.
Definition: UDPRCFeedEngine.php:27
$options
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
Definition: hooks.txt:1530
RecentChange\notifyRCFeeds
notifyRCFeeds()
Notify all the feeds about the change.
Definition: RecentChange.php:328
RecentChange\newFromId
static newFromId( $rcid)
Obtain the recent change with a given rc_id value.
Definition: RecentChange.php:124
$line
$line
Definition: cdb.php:57
TS_MW
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
Definition: GlobalFunctions.php:2431
PatrolLog\record
static record( $rc, $auto=false, User $user=null)
Record a log event for a change being patrolled.
Definition: PatrolLog.php:39
$title
presenting them properly to the user as errors is done by the caller $title
Definition: hooks.txt:1324
RecentChange\$mExtra
$mExtra
Definition: RecentChange.php:72
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:336
$size
$size
Definition: RandomTest.php:75
ChangesList\showCharacterDifference
static showCharacterDifference( $old, $new, IContextSource $context=null)
Show formatted char difference.
Definition: ChangesList.php:189
RC_NEW
const RC_NEW
Definition: Defines.php:179
$user
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
Definition: hooks.txt:237
RecentChange\getAttribute
getAttribute( $name)
Get an attribute value.
Definition: RecentChange.php:774
$wgUseEnotif
$wgUseEnotif
Definition: Setup.php:288
RecentChange\checkIPAddress
static checkIPAddress( $ip)
Definition: RecentChange.php:851
DB_SLAVE
const DB_SLAVE
Definition: Defines.php:55
Title
Represents a title within MediaWiki.
Definition: Title.php:35
RecentChange\selectFields
static selectFields()
Return the list of recentchanges fields that should be selected to create a new recentchanges object.
Definition: RecentChange.php:151
IRCColourfulRCFeedFormatter\cleanupForIRC
static cleanupForIRC( $text)
Remove newlines, carriage returns and decode html entites.
Definition: IRCColourfulRCFeedFormatter.php:118
RecentChange\$mTitle
Title $mTitle
Definition: RecentChange.php:76
in
Prior to maintenance scripts were a hodgepodge of code that had no cohesion or formal method of action Beginning in
Definition: maintenance.txt:1
TS_UNIX
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
Definition: GlobalFunctions.php:2426
as
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
Definition: distributors.txt:9
RecentChange\purgeExpiredChanges
static purgeExpiredChanges()
Purge expired changes from the recentchanges table.
Definition: RecentChange.php:832
RecentChange\isInRCLifespan
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...
Definition: RecentChange.php:877
RecentChange\getPerformer
getPerformer()
Get the User object of the person who performed this change.
Definition: RecentChange.php:213
EmailNotification
This module processes the email notifications when the current page is changed.
Definition: UserMailer.php:475
RecentChange\save
save( $noudp=false)
Writes the data in this object to the database.
Definition: RecentChange.php:229
RecentChange\getTitle
& getTitle()
Definition: RecentChange.php:200
$attribs
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
Definition: hooks.txt:1530
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:59
message
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
Definition: hooks.txt:1624
RecentChange\$mPerformer
User $mPerformer
Definition: RecentChange.php:80
RecentChange\$numberofWatchingusers
$numberofWatchingusers
Definition: RecentChange.php:82
IP\isIPAddress
static isIPAddress( $ip)
Determine if a string is as valid IP address or network (CIDR prefix).
Definition: IP.php:74
RecentChange\SRC_EXTERNAL
const SRC_EXTERNAL
Definition: RecentChange.php:69
User\isAllowed
isAllowed( $action='')
Internal mechanics of testing a permission.
Definition: User.php:3030
$type
$type
Definition: testCompression.php:46