MediaWiki  master
SpecialWatchlist.php
Go to the documentation of this file.
1 <?php
25 
33  public function __construct( $page = 'Watchlist', $restriction = 'viewmywatchlist' ) {
34  parent::__construct( $page, $restriction );
35  }
36 
37  public function doesWrites() {
38  return true;
39  }
40 
46  function execute( $subpage ) {
47  // Anons don't get a watchlist
48  $this->requireLogin( 'watchlistanontext' );
49 
50  $output = $this->getOutput();
51  $request = $this->getRequest();
52  $this->addHelpLink( 'Help:Watching pages' );
54  'mediawiki.special.changeslist.visitedstatus',
55  ] );
56 
57  $mode = SpecialEditWatchlist::getMode( $request, $subpage );
58  if ( $mode !== false ) {
59  if ( $mode === SpecialEditWatchlist::EDIT_RAW ) {
60  $title = SpecialPage::getTitleFor( 'EditWatchlist', 'raw' );
61  } elseif ( $mode === SpecialEditWatchlist::EDIT_CLEAR ) {
62  $title = SpecialPage::getTitleFor( 'EditWatchlist', 'clear' );
63  } else {
64  $title = SpecialPage::getTitleFor( 'EditWatchlist' );
65  }
66 
67  $output->redirect( $title->getLocalURL() );
68 
69  return;
70  }
71 
72  $this->checkPermissions();
73 
74  $user = $this->getUser();
75  $opts = $this->getOptions();
76 
77  $config = $this->getConfig();
78  if ( ( $config->get( 'EnotifWatchlist' ) || $config->get( 'ShowUpdatedMarker' ) )
79  && $request->getVal( 'reset' )
80  && $request->wasPosted()
81  ) {
82  $user->clearAllNotifications();
83  $output->redirect( $this->getPageTitle()->getFullURL( $opts->getChangedValues() ) );
84 
85  return;
86  }
87 
88  parent::execute( $subpage );
89  }
90 
97  public function getSubpagesForPrefixSearch() {
98  return [
99  'clear',
100  'edit',
101  'raw',
102  ];
103  }
104 
110  public function getDefaultOptions() {
111  $opts = parent::getDefaultOptions();
112  $user = $this->getUser();
113 
114  $opts->add( 'days', $user->getOption( 'watchlistdays' ), FormOptions::FLOAT );
115  $opts->add( 'extended', $user->getBoolOption( 'extendwatchlist' ) );
116  if ( $this->getRequest()->getVal( 'action' ) == 'submit' ) {
117  // The user has submitted the form, so we dont need the default values
118  return $opts;
119  }
120 
121  $opts->add( 'hideminor', $user->getBoolOption( 'watchlisthideminor' ) );
122  $opts->add( 'hidebots', $user->getBoolOption( 'watchlisthidebots' ) );
123  $opts->add( 'hideanons', $user->getBoolOption( 'watchlisthideanons' ) );
124  $opts->add( 'hideliu', $user->getBoolOption( 'watchlisthideliu' ) );
125  $opts->add( 'hidepatrolled', $user->getBoolOption( 'watchlisthidepatrolled' ) );
126  $opts->add( 'hidemyself', $user->getBoolOption( 'watchlisthideown' ) );
127  $opts->add( 'hidecategorization', $user->getBoolOption( 'watchlisthidecategorization' ) );
128 
129  return $opts;
130  }
131 
137  protected function getCustomFilters() {
138  if ( $this->customFilters === null ) {
139  $this->customFilters = parent::getCustomFilters();
140  Hooks::run( 'SpecialWatchlistFilters', [ $this, &$this->customFilters ], '1.23' );
141  }
142 
143  return $this->customFilters;
144  }
145 
155  protected function fetchOptionsFromRequest( $opts ) {
156  static $compatibilityMap = [
157  'hideMinor' => 'hideminor',
158  'hideBots' => 'hidebots',
159  'hideAnons' => 'hideanons',
160  'hideLiu' => 'hideliu',
161  'hidePatrolled' => 'hidepatrolled',
162  'hideOwn' => 'hidemyself',
163  ];
164 
165  $params = $this->getRequest()->getValues();
166  foreach ( $compatibilityMap as $from => $to ) {
167  if ( isset( $params[$from] ) ) {
168  $params[$to] = $params[$from];
169  unset( $params[$from] );
170  }
171  }
172 
173  // Not the prettiest way to achieve this… FormOptions internally depends on data sanitization
174  // methods defined on WebRequest and removing this dependency would cause some code duplication.
175  $request = new DerivativeRequest( $this->getRequest(), $params );
176  $opts->fetchValuesFromRequest( $request );
177 
178  return $opts;
179  }
180 
187  public function buildMainQueryConds( FormOptions $opts ) {
188  $dbr = $this->getDB();
189  $conds = parent::buildMainQueryConds( $opts );
190 
191  // Calculate cutoff
192  if ( $opts['days'] > 0 ) {
193  $conds[] = 'rc_timestamp > ' .
194  $dbr->addQuotes( $dbr->timestamp( time() - intval( $opts['days'] * 86400 ) ) );
195  }
196 
197  return $conds;
198  }
199 
207  public function doMainQuery( $conds, $opts ) {
208  $dbr = $this->getDB();
209  $user = $this->getUser();
210 
211  # Toggle watchlist content (all recent edits or just the latest)
212  if ( $opts['extended'] ) {
213  $limitWatchlist = $user->getIntOption( 'wllimit' );
214  $usePage = false;
215  } else {
216  # Top log Ids for a page are not stored
217  $nonRevisionTypes = [ RC_LOG ];
218  Hooks::run( 'SpecialWatchlistGetNonRevisionTypes', [ &$nonRevisionTypes ] );
219  if ( $nonRevisionTypes ) {
220  $conds[] = $dbr->makeList(
221  [
222  'rc_this_oldid=page_latest',
223  'rc_type' => $nonRevisionTypes,
224  ],
225  LIST_OR
226  );
227  }
228  $limitWatchlist = 0;
229  $usePage = true;
230  }
231 
232  $tables = [ 'recentchanges', 'watchlist' ];
233  $fields = RecentChange::selectFields();
234  $query_options = [ 'ORDER BY' => 'rc_timestamp DESC' ];
235  $join_conds = [
236  'watchlist' => [
237  'INNER JOIN',
238  [
239  'wl_user' => $user->getId(),
240  'wl_namespace=rc_namespace',
241  'wl_title=rc_title'
242  ],
243  ],
244  ];
245 
246  if ( $this->getConfig()->get( 'ShowUpdatedMarker' ) ) {
247  $fields[] = 'wl_notificationtimestamp';
248  }
249  if ( $limitWatchlist ) {
250  $query_options['LIMIT'] = $limitWatchlist;
251  }
252 
253  $rollbacker = $user->isAllowed( 'rollback' );
254  if ( $usePage || $rollbacker ) {
255  $tables[] = 'page';
256  $join_conds['page'] = [ 'LEFT JOIN', 'rc_cur_id=page_id' ];
257  if ( $rollbacker ) {
258  $fields[] = 'page_latest';
259  }
260  }
261 
262  // Log entries with DELETED_ACTION must not show up unless the user has
263  // the necessary rights.
264  if ( !$user->isAllowed( 'deletedhistory' ) ) {
265  $bitmask = LogPage::DELETED_ACTION;
266  } elseif ( !$user->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
268  } else {
269  $bitmask = 0;
270  }
271  if ( $bitmask ) {
272  $conds[] = $dbr->makeList( [
273  'rc_type != ' . RC_LOG,
274  $dbr->bitAnd( 'rc_deleted', $bitmask ) . " != $bitmask",
275  ], LIST_OR );
276  }
277 
279  $tables,
280  $fields,
281  $conds,
282  $join_conds,
283  $query_options,
284  ''
285  );
286 
287  $this->runMainQueryHook( $tables, $fields, $conds, $query_options, $join_conds, $opts );
288 
289  return $dbr->select(
290  $tables,
291  $fields,
292  $conds,
293  __METHOD__,
294  $query_options,
295  $join_conds
296  );
297  }
298 
299  protected function runMainQueryHook( &$tables, &$fields, &$conds, &$query_options,
300  &$join_conds, $opts
301  ) {
302  return parent::runMainQueryHook( $tables, $fields, $conds, $query_options, $join_conds, $opts )
303  && Hooks::run(
304  'SpecialWatchlistQuery',
305  [ &$conds, &$tables, &$join_conds, &$fields, $opts ],
306  '1.23'
307  );
308  }
309 
315  protected function getDB() {
316  return wfGetDB( DB_SLAVE, 'watchlist' );
317  }
318 
322  public function outputFeedLinks() {
323  $user = $this->getUser();
324  $wlToken = $user->getTokenFromOption( 'watchlisttoken' );
325  if ( $wlToken ) {
326  $this->addFeedLinks( [
327  'action' => 'feedwatchlist',
328  'allrev' => 1,
329  'wlowner' => $user->getName(),
330  'wltoken' => $wlToken,
331  ] );
332  }
333  }
334 
341  public function outputChangesList( $rows, $opts ) {
342  $dbr = $this->getDB();
343  $user = $this->getUser();
344  $output = $this->getOutput();
345 
346  # Show a message about slave lag, if applicable
347  $lag = wfGetLB()->safeGetLag( $dbr );
348  if ( $lag > 0 ) {
349  $output->showLagWarning( $lag );
350  }
351 
352  # If no rows to display, show message before try to render the list
353  if ( $rows->numRows() == 0 ) {
354  $output->wrapWikiMsg(
355  "<div class='mw-changeslist-empty'>\n$1\n</div>", 'recentchanges-noresult'
356  );
357  return;
358  }
359 
360  $dbr->dataSeek( $rows, 0 );
361 
362  $list = ChangesList::newFromContext( $this->getContext() );
363  $list->setWatchlistDivs();
364  $list->initChangesListRows( $rows );
365  $dbr->dataSeek( $rows, 0 );
366 
367  if ( $this->getConfig()->get( 'RCShowWatchingUsers' )
368  && $user->getOption( 'shownumberswatching' )
369  ) {
370  $watchedItemStore = MediaWikiServices::getInstance()->getWatchedItemStore();
371  }
372 
373  $s = $list->beginRecentChangesList();
374  $userShowHiddenCats = $this->getUser()->getBoolOption( 'showhiddencats' );
375  $counter = 1;
376  foreach ( $rows as $obj ) {
377  # Make RC entry
378  $rc = RecentChange::newFromRow( $obj );
379 
380  # Skip CatWatch entries for hidden cats based on user preference
381  if (
382  $rc->getAttribute( 'rc_type' ) == RC_CATEGORIZE &&
383  !$userShowHiddenCats &&
384  $rc->getParam( 'hidden-cat' )
385  ) {
386  continue;
387  }
388 
389  $rc->counter = $counter++;
390 
391  if ( $this->getConfig()->get( 'ShowUpdatedMarker' ) ) {
392  $updated = $obj->wl_notificationtimestamp;
393  } else {
394  $updated = false;
395  }
396 
397  if ( isset( $watchedItemStore ) ) {
398  $rcTitleValue = new TitleValue( (int)$obj->rc_namespace, $obj->rc_title );
399  $rc->numberofWatchingusers = $watchedItemStore->countWatchers( $rcTitleValue );
400  } else {
401  $rc->numberofWatchingusers = 0;
402  }
403 
404  $changeLine = $list->recentChangesLine( $rc, $updated, $counter );
405  if ( $changeLine !== false ) {
406  $s .= $changeLine;
407  }
408  }
409  $s .= $list->endRecentChangesList();
410 
411  $output->addHTML( $s );
412  }
413 
420  public function doHeader( $opts, $numRows ) {
421  $user = $this->getUser();
422  $out = $this->getOutput();
423 
424  // if the user wishes, that the watchlist is reloaded, whenever a filter changes,
425  // add the module for that
426  if ( $user->getBoolOption( 'watchlistreloadautomatically' ) ) {
427  $out->addModules( [ 'mediawiki.special.watchlist' ] );
428  }
429 
430  $out->addSubtitle(
431  $this->msg( 'watchlistfor2', $user->getName() )
432  ->rawParams( SpecialEditWatchlist::buildTools( null ) )
433  );
434 
435  $this->setTopText( $opts );
436 
437  $lang = $this->getLanguage();
438  if ( $opts['days'] > 0 ) {
439  $days = $opts['days'];
440  } else {
441  $days = $this->getConfig()->get( 'RCMaxAge' ) / ( 3600 * 24 );
442  }
444  $wlInfo = $this->msg( 'wlnote' )->numParams( $numRows, round( $days * 24 ) )->params(
445  $lang->userDate( $timestamp, $user ), $lang->userTime( $timestamp, $user )
446  )->parse() . "<br />\n";
447 
448  $nondefaults = $opts->getChangedValues();
449  $cutofflinks = $this->msg( 'wlshowtime' ) . ' ' . $this->cutoffselector( $opts );
450 
451  # Spit out some control panel links
452  $filters = [
453  'hideminor' => 'wlshowhideminor',
454  'hidebots' => 'wlshowhidebots',
455  'hideanons' => 'wlshowhideanons',
456  'hideliu' => 'wlshowhideliu',
457  'hidemyself' => 'wlshowhidemine',
458  'hidepatrolled' => 'wlshowhidepatr'
459  ];
460 
461  if ( $this->getConfig()->get( 'RCWatchCategoryMembership' ) ) {
462  $filters['hidecategorization'] = 'wlshowhidecategorization';
463  }
464 
465  foreach ( $this->getCustomFilters() as $key => $params ) {
466  $filters[$key] = $params['msg'];
467  }
468  // Disable some if needed
469  if ( !$user->useRCPatrol() ) {
470  unset( $filters['hidepatrolled'] );
471  }
472 
473  $links = [];
474  foreach ( $filters as $name => $msg ) {
475  $links[] = $this->showHideCheck( $nondefaults, $msg, $name, $opts[$name] );
476  }
477 
478  $hiddenFields = $nondefaults;
479  $hiddenFields['action'] = 'submit';
480  unset( $hiddenFields['namespace'] );
481  unset( $hiddenFields['invert'] );
482  unset( $hiddenFields['associated'] );
483  unset( $hiddenFields['days'] );
484  foreach ( $filters as $key => $value ) {
485  unset( $hiddenFields[$key] );
486  }
487 
488  # Create output
489  $form = '';
490 
491  # Namespace filter and put the whole form together.
492  $form .= $wlInfo;
493  $form .= $cutofflinks;
494  $form .= $this->msg( 'watchlist-hide' ) .
495  $this->msg( 'colon-separator' )->escaped() .
496  implode( ' ', $links );
497  $form .= "\n<br />\n";
498  $form .= Html::namespaceSelector(
499  [
500  'selected' => $opts['namespace'],
501  'all' => '',
502  'label' => $this->msg( 'namespace' )->text()
503  ], [
504  'name' => 'namespace',
505  'id' => 'namespace',
506  'class' => 'namespaceselector',
507  ]
508  ) . "\n";
509  $form .= '<span class="mw-input-with-label">' . Xml::checkLabel(
510  $this->msg( 'invert' )->text(),
511  'invert',
512  'nsinvert',
513  $opts['invert'],
514  [ 'title' => $this->msg( 'tooltip-invert' )->text() ]
515  ) . "</span>\n";
516  $form .= '<span class="mw-input-with-label">' . Xml::checkLabel(
517  $this->msg( 'namespace_association' )->text(),
518  'associated',
519  'nsassociated',
520  $opts['associated'],
521  [ 'title' => $this->msg( 'tooltip-namespace_association' )->text() ]
522  ) . "</span>\n";
523  $form .= Xml::submitButton( $this->msg( 'watchlist-submit' )->text() ) . "\n";
524  foreach ( $hiddenFields as $key => $value ) {
525  $form .= Html::hidden( $key, $value ) . "\n";
526  }
527  $form .= Xml::closeElement( 'fieldset' ) . "\n";
528  $form .= Xml::closeElement( 'form' ) . "\n";
529  $this->getOutput()->addHTML( $form );
530 
531  $this->setBottomText( $opts );
532  }
533 
534  function cutoffselector( $options ) {
535  // Cast everything to strings immediately, so that we know all of the values have the same
536  // precision, and can be compared with '==='. 2/24 has a few more decimal places than its
537  // default string representation, for example, and would confuse comparisons.
538 
539  // Misleadingly, the 'days' option supports hours too.
540  $days = array_map( 'strval', [ 1/24, 2/24, 6/24, 12/24, 1, 3, 7 ] );
541 
542  $userWatchlistOption = (string)$this->getUser()->getOption( 'watchlistdays' );
543  // add the user preference, if it isn't available already
544  if ( !in_array( $userWatchlistOption, $days ) && $userWatchlistOption !== '0' ) {
545  $days[] = $userWatchlistOption;
546  }
547 
548  $maxDays = (string)( $this->getConfig()->get( 'RCMaxAge' ) / ( 3600 * 24 ) );
549  // add the maximum possible value, if it isn't available already
550  if ( !in_array( $maxDays, $days ) ) {
551  $days[] = $maxDays;
552  }
553 
554  $selected = (string)$options['days'];
555  if ( $selected <= 0 ) {
556  $selected = $maxDays;
557  }
558 
559  // add the currently selected value, if it isn't available already
560  if ( !in_array( $selected, $days ) ) {
561  $days[] = $selected;
562  }
563 
564  $select = new XmlSelect( 'days', 'days', $selected );
565 
566  asort( $days );
567  foreach ( $days as $value ) {
568  if ( $value < 1 ) {
569  $name = $this->msg( 'hours' )->numParams( $value * 24 )->text();
570  } else {
571  $name = $this->msg( 'days' )->numParams( $value )->text();
572  }
573  $select->addOption( $name, $value );
574  }
575 
576  return $select->getHTML() . "\n<br />\n";
577  }
578 
579  function setTopText( FormOptions $opts ) {
580  $nondefaults = $opts->getChangedValues();
581  $form = "";
582  $user = $this->getUser();
583 
584  $numItems = $this->countItems();
585  $showUpdatedMarker = $this->getConfig()->get( 'ShowUpdatedMarker' );
586 
587  // Show watchlist header
588  $form .= "<p>";
589  if ( $numItems == 0 ) {
590  $form .= $this->msg( 'nowatchlist' )->parse() . "\n";
591  } else {
592  $form .= $this->msg( 'watchlist-details' )->numParams( $numItems )->parse() . "\n";
593  if ( $this->getConfig()->get( 'EnotifWatchlist' )
594  && $user->getOption( 'enotifwatchlistpages' )
595  ) {
596  $form .= $this->msg( 'wlheader-enotif' )->parse() . "\n";
597  }
598  if ( $showUpdatedMarker ) {
599  $form .= $this->msg( 'wlheader-showupdated' )->parse() . "\n";
600  }
601  }
602  $form .= "</p>";
603 
604  if ( $numItems > 0 && $showUpdatedMarker ) {
605  $form .= Xml::openElement( 'form', [ 'method' => 'post',
606  'action' => $this->getPageTitle()->getLocalURL(),
607  'id' => 'mw-watchlist-resetbutton' ] ) . "\n" .
608  Xml::submitButton( $this->msg( 'enotif_reset' )->text(), [ 'name' => 'dummy' ] ) . "\n" .
609  Html::hidden( 'reset', 'all' ) . "\n";
610  foreach ( $nondefaults as $key => $value ) {
611  $form .= Html::hidden( $key, $value ) . "\n";
612  }
613  $form .= Xml::closeElement( 'form' ) . "\n";
614  }
615 
616  $form .= Xml::openElement( 'form', [
617  'method' => 'get',
618  'action' => $this->getPageTitle()->getLocalURL(),
619  'id' => 'mw-watchlist-form'
620  ] );
621  $form .= Xml::fieldset(
622  $this->msg( 'watchlist-options' )->text(),
623  false,
624  [ 'id' => 'mw-watchlist-options' ]
625  );
626 
627  $form .= $this->makeLegend();
628 
629  $this->getOutput()->addHTML( $form );
630  }
631 
632  protected function showHideCheck( $options, $message, $name, $value ) {
633  $options[$name] = 1 - (int)$value;
634 
635  return '<span class="mw-input-with-label">' . Xml::checkLabel(
636  $this->msg( $message, '' )->text(),
637  $name,
638  $name,
639  (int)$value
640  ) . '</span>';
641  }
642 
650  protected function countItems() {
651  $store = MediaWikiServices::getInstance()->getWatchedItemStore();
652  $count = $store->countWatchedItems( $this->getUser() );
653  return floor( $count / 2 );
654  }
655 }
static newFromContext(IContextSource $context)
Fetch an appropriate changes list class for the specified context Some users might want to use an enh...
Definition: ChangesList.php:74
Helper class to keep track of options when mixing links and form elements.
Definition: FormOptions.php:35
const RC_CATEGORIZE
Definition: Defines.php:173
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
const FLOAT
Float type, maps guessType() to WebRequest::getFloat()
Definition: FormOptions.php:48
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
Definition: hooks.txt:776
getCustomFilters()
Get custom show/hide filters.
getContext()
Gets the context this SpecialPage is executed in.
showHideCheck($options, $message, $name, $value)
$batch execute()
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
static getTitleFor($name, $subpage=false, $fragment= '')
Get a localised Title object for a specified special page name.
Definition: SpecialPage.php:80
const EDIT_CLEAR
Editing modes.
outputChangesList($rows, $opts)
Build and output the actual changes list.
if(!isset($args[0])) $lang
Similar to FauxRequest, but only fakes URL parameters and method (POST or GET) and use the base reque...
static hidden($name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
Definition: Html.php:749
Class for generating HTML <select> or <datalist> elements.
Definition: XmlSelect.php:26
addFeedLinks($params)
Adds RSS/atom links.
getDB()
Return a IDatabase object for reading.
Represents a page (or page fragment) title within MediaWiki.
Definition: TitleValue.php:36
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
Definition: hooks.txt:177
$value
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 MediaWikiServices
Definition: injection.txt:23
msg()
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
getOptions()
Get the current FormOptions for this request.
static submitButton($value, $attribs=[])
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...
Definition: Xml.php:460
addHelpLink($to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist & $tables
Definition: hooks.txt:981
fetchOptionsFromRequest($opts)
Fetch values for a FormOptions object from the WebRequest associated with this instance.
static fieldset($legend=false, $content=false, $attribs=[])
Shortcut for creating fieldsets.
Definition: Xml.php:578
static closeElement($element)
Shortcut to close an XML element.
Definition: Xml.php:118
wfGetLB($wiki=false)
Get a load balancer object.
if($limit) $timestamp
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 $options
Definition: hooks.txt:1020
doMainQuery($conds, $opts)
Process the query.
countItems()
Count the number of paired items on a user's watchlist.
static openElement($element, $attribs=null)
This opens an XML element.
Definition: Xml.php:109
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
doHeader($opts, $numRows)
Set the text to be displayed above the changes.
$params
const DB_SLAVE
Definition: Defines.php:46
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
Definition: hooks.txt:312
static getMode($request, $par)
Determine whether we are editing the watchlist, and if so, what kind of editing operation.
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:131
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
Definition: design.txt:12
setBottomText(FormOptions $opts)
Send the text to be displayed after the options.
addModules($modules)
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
static selectFields()
Return the list of recentchanges fields that should be selected to create a new recentchanges object...
const DELETED_RESTRICTED
Definition: LogPage.php:36
getSubpagesForPrefixSearch()
Return an array of subpages that this special page will accept.
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
Definition: hooks.txt:242
execute($subpage)
Main execution point.
const LIST_OR
Definition: Defines.php:197
static array static newFromRow($row)
static modifyDisplayQuery(&$tables, &$fields, &$conds, &$join_conds, &$options, $filter_tag=false)
Applies all tags-related changes to a query.
Definition: ChangeTags.php:615
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 & $output
Definition: hooks.txt:1020
$from
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
Definition: injection.txt:35
error also a ContextSource you ll probably need to make sure the header is varied on $request
Definition: hooks.txt:2458
Special page which uses a ChangesList to show query results.
outputFeedLinks()
Output feed links.
runMainQueryHook(&$tables, &$fields, &$conds, &$query_options, &$join_conds, $opts)
requireLogin($reasonMsg= 'exception-nologin-text', $titleMsg= 'exception-nologin')
If the user is not logged in, throws UserNotLoggedIn error.
getUser()
Shortcut to get the User executing this instance.
getConfig()
Shortcut to get main config object.
getLanguage()
Shortcut to get user's language.
static buildTools($unused)
Build a set of links for convenient navigation between watchlist viewing and editing modes...
$count
static checkLabel($label, $name, $id, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox with a label.
Definition: Xml.php:420
getChangedValues()
Return options modified as an array ( name => value )
buildMainQueryConds(FormOptions $opts)
Return an array of conditions depending of options set in $opts.
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
getRequest()
Get the WebRequest being used for this instance.
const DELETED_ACTION
Definition: LogPage.php:33
makeLegend()
Return the legend displayed within the fieldset.
A special page that lists last changes made to the wiki, limited to user-defined list of titles...
getDefaultOptions()
Get a FormOptions object containing the default options.
setTopText(FormOptions $opts)
__construct($page= 'Watchlist', $restriction= 'viewmywatchlist')
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 $page
Definition: hooks.txt:2376
const RC_LOG
Definition: Defines.php:171
getPageTitle($subpage=false)
Get a self-referential title object.
static namespaceSelector(array $params=[], array $selectAttribs=[])
Build a drop-down box for selecting a namespace.
Definition: Html.php:837
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:310