MediaWiki  1.23.2
SpecialEditWatchlist.php
Go to the documentation of this file.
1 <?php
42  const EDIT_CLEAR = 1;
43  const EDIT_RAW = 2;
44  const EDIT_NORMAL = 3;
45 
46  protected $successMessage;
47 
48  protected $toc;
49 
50  private $badItems = array();
51 
52  public function __construct() {
53  parent::__construct( 'EditWatchlist', 'editmywatchlist' );
54  }
55 
61  public function execute( $mode ) {
62  $this->setHeaders();
63 
64  # Anons don't get a watchlist
65  $this->requireLogin( 'watchlistanontext' );
66 
67  $out = $this->getOutput();
68 
69  $this->checkPermissions();
70  $this->checkReadOnly();
71 
72  $this->outputHeader();
73 
74  $out->addSubtitle( $this->msg( 'watchlistfor2', $this->getUser()->getName() )
75  ->rawParams( SpecialEditWatchlist::buildTools( null ) ) );
76 
77  # B/C: $mode used to be waaay down the parameter list, and the first parameter
78  # was $wgUser
79  if ( $mode instanceof User ) {
80  $args = func_get_args();
81  if ( count( $args ) >= 4 ) {
82  $mode = $args[3];
83  }
84  }
85  $mode = self::getMode( $this->getRequest(), $mode );
86 
87  switch ( $mode ) {
88  case self::EDIT_RAW:
89  $out->setPageTitle( $this->msg( 'watchlistedit-raw-title' ) );
90  $form = $this->getRawForm();
91  if ( $form->show() ) {
92  $out->addHTML( $this->successMessage );
93  $out->addReturnTo( SpecialPage::getTitleFor( 'Watchlist' ) );
94  }
95  break;
96  case self::EDIT_CLEAR:
97  $out->setPageTitle( $this->msg( 'watchlistedit-clear-title' ) );
98  $form = $this->getClearForm();
99  if ( $form->show() ) {
100  $out->addHTML( $this->successMessage );
101  $out->addReturnTo( SpecialPage::getTitleFor( 'Watchlist' ) );
102  }
103  break;
104 
105  case self::EDIT_NORMAL:
106  default:
107  $out->setPageTitle( $this->msg( 'watchlistedit-normal-title' ) );
108  $form = $this->getNormalForm();
109  if ( $form->show() ) {
110  $out->addHTML( $this->successMessage );
111  $out->addReturnTo( SpecialPage::getTitleFor( 'Watchlist' ) );
112  } elseif ( $this->toc !== false ) {
113  $out->prependHTML( $this->toc );
114  }
115  break;
116  }
117  }
118 
126  private function extractTitles( $list ) {
127  $list = explode( "\n", trim( $list ) );
128  if ( !is_array( $list ) ) {
129  return array();
130  }
131 
132  $titles = array();
133 
134  foreach ( $list as $text ) {
135  $text = trim( $text );
136  if ( strlen( $text ) > 0 ) {
137  $title = Title::newFromText( $text );
138  if ( $title instanceof Title && $title->isWatchable() ) {
139  $titles[] = $title;
140  }
141  }
142  }
143 
144  GenderCache::singleton()->doTitlesArray( $titles );
145 
146  $list = array();
148  foreach ( $titles as $title ) {
149  $list[] = $title->getPrefixedText();
150  }
151 
152  return array_unique( $list );
153  }
154 
155  public function submitRaw( $data ) {
156  $wanted = $this->extractTitles( $data['Titles'] );
157  $current = $this->getWatchlist();
158 
159  if ( count( $wanted ) > 0 ) {
160  $toWatch = array_diff( $wanted, $current );
161  $toUnwatch = array_diff( $current, $wanted );
162  $this->watchTitles( $toWatch );
163  $this->unwatchTitles( $toUnwatch );
164  $this->getUser()->invalidateCache();
165 
166  if ( count( $toWatch ) > 0 || count( $toUnwatch ) > 0 ) {
167  $this->successMessage = $this->msg( 'watchlistedit-raw-done' )->parse();
168  } else {
169  return false;
170  }
171 
172  if ( count( $toWatch ) > 0 ) {
173  $this->successMessage .= ' ' . $this->msg( 'watchlistedit-raw-added' )
174  ->numParams( count( $toWatch ) )->parse();
175  $this->showTitles( $toWatch, $this->successMessage );
176  }
177 
178  if ( count( $toUnwatch ) > 0 ) {
179  $this->successMessage .= ' ' . $this->msg( 'watchlistedit-raw-removed' )
180  ->numParams( count( $toUnwatch ) )->parse();
181  $this->showTitles( $toUnwatch, $this->successMessage );
182  }
183  } else {
184  $this->clearWatchlist();
185  $this->getUser()->invalidateCache();
186 
187  if ( count( $current ) > 0 ) {
188  $this->successMessage = $this->msg( 'watchlistedit-raw-done' )->parse();
189  } else {
190  return false;
191  }
192 
193  $this->successMessage .= ' ' . $this->msg( 'watchlistedit-raw-removed' )
194  ->numParams( count( $current ) )->parse();
195  $this->showTitles( $current, $this->successMessage );
196  }
197 
198  return true;
199  }
200 
201  public function submitClear( $data ) {
202  $current = $this->getWatchlist();
203  $this->clearWatchlist();
204  $this->getUser()->invalidateCache();
205  $this->successMessage = $this->msg( 'watchlistedit-clear-done' )->parse();
206  $this->successMessage .= ' ' . $this->msg( 'watchlistedit-clear-removed' )
207  ->numParams( count( $current ) )->parse();
208  $this->showTitles( $current, $this->successMessage );
209 
210  return true;
211 }
212 
222  private function showTitles( $titles, &$output ) {
223  $talk = $this->msg( 'talkpagelinktext' )->escaped();
224  // Do a batch existence check
225  $batch = new LinkBatch();
226  if (count($titles) >= 100) {
227  $output = wfMessage( 'watchlistedit-too-many' )->parse();
228  return;
229  }
230  foreach ( $titles as $title ) {
231  if ( !$title instanceof Title ) {
233  }
234 
235  if ( $title instanceof Title ) {
236  $batch->addObj( $title );
237  $batch->addObj( $title->getTalkPage() );
238  }
239  }
240 
241  $batch->execute();
242 
243  // Print out the list
244  $output .= "<ul>\n";
245 
246  foreach ( $titles as $title ) {
247  if ( !$title instanceof Title ) {
249  }
250 
251  if ( $title instanceof Title ) {
252  $output .= "<li>"
253  . Linker::link( $title )
254  . ' (' . Linker::link( $title->getTalkPage(), $talk )
255  . ")</li>\n";
256  }
257  }
258 
259  $output .= "</ul>\n";
260  }
261 
268  private function getWatchlist() {
269  $list = array();
270  $dbr = wfGetDB( DB_MASTER );
271 
272  $res = $dbr->select(
273  'watchlist',
274  array(
275  'wl_namespace', 'wl_title'
276  ), array(
277  'wl_user' => $this->getUser()->getId(),
278  ),
279  __METHOD__
280  );
281 
282  if ( $res->numRows() > 0 ) {
283  $titles = array();
284  foreach ( $res as $row ) {
285  $title = Title::makeTitleSafe( $row->wl_namespace, $row->wl_title );
286 
287  if ( $this->checkTitle( $title, $row->wl_namespace, $row->wl_title )
288  && !$title->isTalkPage()
289  ) {
290  $titles[] = $title;
291  }
292  }
293  $res->free();
294 
295  GenderCache::singleton()->doTitlesArray( $titles );
296 
297  foreach ( $titles as $title ) {
298  $list[] = $title->getPrefixedText();
299  }
300  }
301 
302  $this->cleanupWatchlist();
303 
304  return $list;
305  }
306 
313  private function getWatchlistInfo() {
314  $titles = array();
315  $dbr = wfGetDB( DB_MASTER );
316 
317  $res = $dbr->select(
318  array( 'watchlist' ),
319  array( 'wl_namespace', 'wl_title' ),
320  array( 'wl_user' => $this->getUser()->getId() ),
321  __METHOD__,
322  array( 'ORDER BY' => array( 'wl_namespace', 'wl_title' ) )
323  );
324 
325  $lb = new LinkBatch();
326 
327  foreach ( $res as $row ) {
328  $lb->add( $row->wl_namespace, $row->wl_title );
329  if ( !MWNamespace::isTalk( $row->wl_namespace ) ) {
330  $titles[$row->wl_namespace][$row->wl_title] = 1;
331  }
332  }
333 
334  $lb->execute();
335 
336  return $titles;
337  }
338 
347  private function checkTitle( $title, $namespace, $dbKey ) {
348  if ( $title
349  && ( $title->isExternal()
350  || $title->getNamespace() < 0
351  )
352  ) {
353  $title = false; // unrecoverable
354  }
355 
356  if ( !$title
357  || $title->getNamespace() != $namespace
358  || $title->getDBkey() != $dbKey
359  ) {
360  $this->badItems[] = array( $title, $namespace, $dbKey );
361  }
362 
363  return (bool)$title;
364  }
365 
369  private function cleanupWatchlist() {
370  if ( !count( $this->badItems ) ) {
371  return; //nothing to do
372  }
373 
374  $dbw = wfGetDB( DB_MASTER );
375  $user = $this->getUser();
376 
377  foreach ( $this->badItems as $row ) {
378  list( $title, $namespace, $dbKey ) = $row;
379  $action = $title ? 'cleaning up' : 'deleting';
380  wfDebug( "User {$user->getName()} has broken watchlist item ns($namespace):$dbKey, $action.\n" );
381 
382  $dbw->delete( 'watchlist',
383  array(
384  'wl_user' => $user->getId(),
385  'wl_namespace' => $namespace,
386  'wl_title' => $dbKey,
387  ),
388  __METHOD__
389  );
390 
391  // Can't just do an UPDATE instead of DELETE/INSERT due to unique index
392  if ( $title ) {
393  $user->addWatch( $title );
394  }
395  }
396  }
397 
401  private function clearWatchlist() {
402  $dbw = wfGetDB( DB_MASTER );
403  $dbw->delete(
404  'watchlist',
405  array( 'wl_user' => $this->getUser()->getId() ),
406  __METHOD__
407  );
408  }
409 
418  private function watchTitles( $titles ) {
419  $dbw = wfGetDB( DB_MASTER );
420  $rows = array();
421 
422  foreach ( $titles as $title ) {
423  if ( !$title instanceof Title ) {
425  }
426 
427  if ( $title instanceof Title ) {
428  $rows[] = array(
429  'wl_user' => $this->getUser()->getId(),
430  'wl_namespace' => MWNamespace::getSubject( $title->getNamespace() ),
431  'wl_title' => $title->getDBkey(),
432  'wl_notificationtimestamp' => null,
433  );
434  $rows[] = array(
435  'wl_user' => $this->getUser()->getId(),
436  'wl_namespace' => MWNamespace::getTalk( $title->getNamespace() ),
437  'wl_title' => $title->getDBkey(),
438  'wl_notificationtimestamp' => null,
439  );
440  }
441  }
442 
443  $dbw->insert( 'watchlist', $rows, __METHOD__, 'IGNORE' );
444  }
445 
454  private function unwatchTitles( $titles ) {
455  $dbw = wfGetDB( DB_MASTER );
456 
457  foreach ( $titles as $title ) {
458  if ( !$title instanceof Title ) {
460  }
461 
462  if ( $title instanceof Title ) {
463  $dbw->delete(
464  'watchlist',
465  array(
466  'wl_user' => $this->getUser()->getId(),
467  'wl_namespace' => MWNamespace::getSubject( $title->getNamespace() ),
468  'wl_title' => $title->getDBkey(),
469  ),
470  __METHOD__
471  );
472 
473  $dbw->delete(
474  'watchlist',
475  array(
476  'wl_user' => $this->getUser()->getId(),
477  'wl_namespace' => MWNamespace::getTalk( $title->getNamespace() ),
478  'wl_title' => $title->getDBkey(),
479  ),
480  __METHOD__
481  );
482 
483  $page = WikiPage::factory( $title );
484  wfRunHooks( 'UnwatchArticleComplete', array( $this->getUser(), &$page ) );
485  }
486  }
487  }
488 
489  public function submitNormal( $data ) {
490  $removed = array();
491 
492  foreach ( $data as $titles ) {
493  $this->unwatchTitles( $titles );
494  $removed = array_merge( $removed, $titles );
495  }
496 
497  if ( count( $removed ) > 0 ) {
498  $this->successMessage = $this->msg( 'watchlistedit-normal-done'
499  )->numParams( count( $removed ) )->parse();
500  $this->showTitles( $removed, $this->successMessage );
501 
502  return true;
503  } else {
504  return false;
505  }
506  }
507 
513  protected function getNormalForm() {
515 
516  $fields = array();
517  $count = 0;
518 
519  foreach ( $this->getWatchlistInfo() as $namespace => $pages ) {
520  if ( $namespace >= 0 ) {
521  $fields['TitlesNs' . $namespace] = array(
522  'class' => 'EditWatchlistCheckboxSeriesField',
523  'options' => array(),
524  'section' => "ns$namespace",
525  );
526  }
527 
528  foreach ( array_keys( $pages ) as $dbkey ) {
529  $title = Title::makeTitleSafe( $namespace, $dbkey );
530 
531  if ( $this->checkTitle( $title, $namespace, $dbkey ) ) {
532  $text = $this->buildRemoveLine( $title );
533  $fields['TitlesNs' . $namespace]['options'][$text] = $title->getPrefixedText();
534  $count++;
535  }
536  }
537  }
538  $this->cleanupWatchlist();
539 
540  if ( count( $fields ) > 1 && $count > 30 ) {
541  $this->toc = Linker::tocIndent();
542  $tocLength = 0;
543 
544  foreach ( $fields as $data ) {
545  # strip out the 'ns' prefix from the section name:
546  $ns = substr( $data['section'], 2 );
547 
548  $nsText = ( $ns == NS_MAIN )
549  ? $this->msg( 'blanknamespace' )->escaped()
550  : htmlspecialchars( $wgContLang->getFormattedNsText( $ns ) );
551  $this->toc .= Linker::tocLine( "editwatchlist-{$data['section']}", $nsText,
552  $this->getLanguage()->formatNum( ++$tocLength ), 1 ) . Linker::tocLineEnd();
553  }
554 
555  $this->toc = Linker::tocList( $this->toc );
556  } else {
557  $this->toc = false;
558  }
559 
560  $context = new DerivativeContext( $this->getContext() );
561  $context->setTitle( $this->getPageTitle() ); // Remove subpage
562  $form = new EditWatchlistNormalHTMLForm( $fields, $context );
563  $form->setSubmitTextMsg( 'watchlistedit-normal-submit' );
564  # Used message keys: 'accesskey-watchlistedit-normal-submit', 'tooltip-watchlistedit-normal-submit'
565  $form->setSubmitTooltip( 'watchlistedit-normal-submit' );
566  $form->setWrapperLegendMsg( 'watchlistedit-normal-legend' );
567  $form->addHeaderText( $this->msg( 'watchlistedit-normal-explain' )->parse() );
568  $form->setSubmitCallback( array( $this, 'submitNormal' ) );
569 
570  return $form;
571  }
572 
579  private function buildRemoveLine( $title ) {
581 
582  if ( $title->isRedirect() ) {
583  // Linker already makes class mw-redirect, so this is redundant
584  $link = '<span class="watchlistredir">' . $link . '</span>';
585  }
586 
587  $tools[] = Linker::link( $title->getTalkPage(), $this->msg( 'talkpagelinktext' )->escaped() );
588 
589  if ( $title->exists() ) {
591  $title,
592  $this->msg( 'history_short' )->escaped(),
593  array(),
594  array( 'action' => 'history' )
595  );
596  }
597 
598  if ( $title->getNamespace() == NS_USER && !$title->isSubpage() ) {
600  SpecialPage::getTitleFor( 'Contributions', $title->getText() ),
601  $this->msg( 'contributions' )->escaped()
602  );
603  }
604 
605  wfRunHooks( 'WatchlistEditorBuildRemoveLine', array( &$tools, $title, $title->isRedirect(), $this->getSkin() ) );
606 
607  return $link . " (" . $this->getLanguage()->pipeList( $tools ) . ")";
608  }
609 
615  protected function getRawForm() {
616  $titles = implode( $this->getWatchlist(), "\n" );
617  $fields = array(
618  'Titles' => array(
619  'type' => 'textarea',
620  'label-message' => 'watchlistedit-raw-titles',
621  'default' => $titles,
622  ),
623  );
624  $context = new DerivativeContext( $this->getContext() );
625  $context->setTitle( $this->getPageTitle( 'raw' ) ); // Reset subpage
626  $form = new HTMLForm( $fields, $context );
627  $form->setSubmitTextMsg( 'watchlistedit-raw-submit' );
628  # Used message keys: 'accesskey-watchlistedit-raw-submit', 'tooltip-watchlistedit-raw-submit'
629  $form->setSubmitTooltip( 'watchlistedit-raw-submit' );
630  $form->setWrapperLegendMsg( 'watchlistedit-raw-legend' );
631  $form->addHeaderText( $this->msg( 'watchlistedit-raw-explain' )->parse() );
632  $form->setSubmitCallback( array( $this, 'submitRaw' ) );
633 
634  return $form;
635  }
636 
642  protected function getClearForm() {
643  $context = new DerivativeContext( $this->getContext() );
644  $context->setTitle( $this->getPageTitle( 'clear' ) ); // Reset subpage
645  $form = new HTMLForm( array(), $context );
646  $form->setSubmitTextMsg( 'watchlistedit-clear-submit' );
647  # Used message keys: 'accesskey-watchlistedit-clear-submit', 'tooltip-watchlistedit-clear-submit'
648  $form->setSubmitTooltip( 'watchlistedit-clear-submit' );
649  $form->setWrapperLegendMsg( 'watchlistedit-clear-legend' );
650  $form->addHeaderText( $this->msg( 'watchlistedit-clear-explain' )->parse() );
651  $form->setSubmitCallback( array( $this, 'submitClear' ) );
652 
653  return $form;
654  }
655 
664  public static function getMode( $request, $par ) {
665  $mode = strtolower( $request->getVal( 'action', $par ) );
666 
667  switch ( $mode ) {
668  case 'clear':
669  case self::EDIT_CLEAR:
670  return self::EDIT_CLEAR;
671  case 'raw':
672  case self::EDIT_RAW:
673  return self::EDIT_RAW;
674  case 'edit':
675  case self::EDIT_NORMAL:
676  return self::EDIT_NORMAL;
677  default:
678  return false;
679  }
680  }
681 
689  public static function buildTools( $unused ) {
690  global $wgLang;
691 
692  $tools = array();
693  $modes = array(
694  'view' => array( 'Watchlist', false ),
695  'edit' => array( 'EditWatchlist', false ),
696  'raw' => array( 'EditWatchlist', 'raw' ),
697  'clear' => array( 'EditWatchlist', 'clear' ),
698  );
699 
700  foreach ( $modes as $mode => $arr ) {
701  // can use messages 'watchlisttools-view', 'watchlisttools-edit', 'watchlisttools-raw'
703  SpecialPage::getTitleFor( $arr[0], $arr[1] ),
704  wfMessage( "watchlisttools-{$mode}" )->escaped()
705  );
706  }
707 
708  return Html::rawElement(
709  'span',
710  array( 'class' => 'mw-watchlist-toollinks' ),
711  wfMessage( 'parentheses', $wgLang->pipeList( $tools ) )->text()
712  );
713  }
714 }
715 
716 # B/C since 1.18
718 }
719 
724  public function getLegend( $namespace ) {
725  $namespace = substr( $namespace, 2 );
726 
727  return $namespace == NS_MAIN
728  ? $this->msg( 'blanknamespace' )->escaped()
729  : htmlspecialchars( $this->getContext()->getLanguage()->getFormattedNsText( $namespace ) );
730  }
731 
732  public function getBody() {
733  return $this->displaySection( $this->mFieldTree, '', 'editwatchlist-' );
734  }
735 }
736 
749  function validate( $value, $alldata ) {
750  // Need to call into grandparent to be a good citizen. :)
751  return HTMLFormField::validate( $value, $alldata );
752  }
753 }
GenderCache\singleton
static singleton()
Definition: GenderCache.php:39
SpecialPage\getPageTitle
getPageTitle( $subpage=false)
Get a self-referential title object.
Definition: SpecialPage.php:488
SpecialEditWatchlist\submitNormal
submitNormal( $data)
Definition: SpecialEditWatchlist.php:489
SpecialEditWatchlist\EDIT_CLEAR
const EDIT_CLEAR
Editing modes.
Definition: SpecialEditWatchlist.php:42
SpecialEditWatchlist\getWatchlist
getWatchlist()
Prepare a list of titles on a user's watchlist (excluding talk pages) and return an array of (prefixe...
Definition: SpecialEditWatchlist.php:268
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:189
EditWatchlistNormalHTMLForm\getLegend
getLegend( $namespace)
Get a string to go in the "<legend>" of a section fieldset.
Definition: SpecialEditWatchlist.php:724
ContextSource\getContext
getContext()
Get the RequestContext object.
Definition: ContextSource.php:40
DB_MASTER
const DB_MASTER
Definition: Defines.php:56
SpecialEditWatchlist\unwatchTitles
unwatchTitles( $titles)
Remove a list of titles from a user's watchlist.
Definition: SpecialEditWatchlist.php:454
SpecialEditWatchlist\EDIT_RAW
const EDIT_RAW
Definition: SpecialEditWatchlist.php:43
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
SpecialEditWatchlist\checkTitle
checkTitle( $title, $namespace, $dbKey)
Validates watchlist entry.
Definition: SpecialEditWatchlist.php:347
MWNamespace\isTalk
static isTalk( $index)
Is the given namespace a talk namespace?
Definition: Namespace.php:107
ContextSource\msg
msg()
Get a Message object with context set Parameters are the same as wfMessage()
Definition: ContextSource.php:175
LinkBatch
Class representing a list of titles The execute() method checks them all for existence and adds them ...
Definition: LinkBatch.php:30
SpecialPage\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition: SpecialPage.php:535
UnlistedSpecialPage
Shortcut to construct a special page which is unlisted by default.
Definition: UnlistedSpecialPage.php:29
Linker\tocIndent
static tocIndent()
Add another level to the Table of Contents.
Definition: Linker.php:1615
wfGetDB
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:3650
text
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
$form
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead $form
Definition: hooks.txt:2573
SpecialEditWatchlist\__construct
__construct()
Definition: SpecialEditWatchlist.php:52
SpecialEditWatchlist\submitRaw
submitRaw( $data)
Definition: SpecialEditWatchlist.php:155
HTMLFormField\validate
validate( $value, $alldata)
Override this function to add specific validation checks on the field input.
Definition: HTMLFormField.php:73
SpecialPage\checkPermissions
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
Definition: SpecialPage.php:287
SpecialEditWatchlist\buildRemoveLine
buildRemoveLine( $title)
Build the label for a checkbox, with a link to the title, and various additional bits.
Definition: SpecialEditWatchlist.php:579
SpecialEditWatchlist\buildTools
static buildTools( $unused)
Build a set of links for convenient navigation between watchlist viewing and editing modes.
Definition: SpecialEditWatchlist.php:689
SpecialPage\getTitleFor
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name.
Definition: SpecialPage.php:74
SpecialPage\getSkin
getSkin()
Shortcut to get the skin being used for this instance.
Definition: SpecialPage.php:555
$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
SpecialPage\getLanguage
getLanguage()
Shortcut to get user's language.
Definition: SpecialPage.php:578
SpecialPage\getName
getName()
Get the name of this Special Page.
Definition: SpecialPage.php:139
$link
set to $title object and return false for a match for latest after cache objects are set use the ContentHandler facility to handle CSS and JavaScript for highlighting & $link
Definition: hooks.txt:2149
SpecialPage\requireLogin
requireLogin( $reasonMsg=null, $titleMsg=null)
If the user is not logged in, throws UserNotLoggedIn error.
Definition: SpecialPage.php:321
Linker\tocLine
static tocLine( $anchor, $tocline, $tocnumber, $level, $sectionIndex=false)
parameter level defines if we are on an indentation level
Definition: Linker.php:1633
SpecialEditWatchlist\$badItems
$badItems
Definition: SpecialEditWatchlist.php:50
Linker\linkKnown
static linkKnown( $target, $html=null, $customAttribs=array(), $query=array(), $options=array( 'known', 'noclasses'))
Identical to link(), except $options defaults to 'known'.
Definition: Linker.php:264
$dbr
$dbr
Definition: testCompression.php:48
Linker\link
static link( $target, $html=null, $customAttribs=array(), $query=array(), $options=array())
This function returns an HTML link to the given target.
Definition: Linker.php:192
ContextSource\getLanguage
getLanguage()
Get the Language object.
Definition: ContextSource.php:154
SpecialEditWatchlist\execute
execute( $mode)
Main execution point.
Definition: SpecialEditWatchlist.php:61
NS_MAIN
const NS_MAIN
Definition: Defines.php:79
EditWatchlistNormalHTMLForm
Extend HTMLForm purely so we can have a more sane way of getting the section headers.
Definition: SpecialEditWatchlist.php:723
DerivativeContext
An IContextSource implementation which will inherit context from another source but allow individual ...
Definition: DerivativeContext.php:32
$lb
if( $wgAPIRequestLog) $lb
Definition: api.php:126
SpecialEditWatchlist\EDIT_NORMAL
const EDIT_NORMAL
Definition: SpecialEditWatchlist.php:44
$out
$out
Definition: UtfNormalGenerate.php:167
WikiPage\factory
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
Definition: WikiPage.php:103
$titles
linkcache txt The LinkCache class maintains a list of article titles and the information about whether or not the article exists in the database This is used to mark up links when displaying a page If the same link appears more than once on any page then it only has to be looked up once In most cases link lookups are done in batches with the LinkBatch class or the equivalent in so the link cache is mostly useful for short snippets of parsed and for links in the navigation areas of the skin The link cache was formerly used to track links used in a document for the purposes of updating the link tables This application is now deprecated To create a you can use the following $titles
Definition: linkcache.txt:17
SpecialEditWatchlist\getRawForm
getRawForm()
Get a form for editing the watchlist in "raw" mode.
Definition: SpecialEditWatchlist.php:615
SpecialEditWatchlist\clearWatchlist
clearWatchlist()
Remove all titles from a user's watchlist.
Definition: SpecialEditWatchlist.php:401
EditWatchlistCheckboxSeriesField\validate
validate( $value, $alldata)
HTMLMultiSelectField throws validation errors if we get input data that doesn't match the data set in...
Definition: SpecialEditWatchlist.php:749
Linker\tocList
static tocList( $toc, $lang=false)
Wraps the TOC in a table and provides the hide/collapse javascript.
Definition: Linker.php:1661
SpecialEditWatchlist\extractTitles
extractTitles( $list)
Extract a list of titles from a blob of text, returning (prefixed) strings; unwatchable titles are ig...
Definition: SpecialEditWatchlist.php:126
wfMessage
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 set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "&lt
Linker\tocLineEnd
static tocLineEnd()
End a Table Of Contents line.
Definition: Linker.php:1650
wfRunHooks
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
Definition: GlobalFunctions.php:4001
SpecialEditWatchlist
Provides the UI through which users can perform editing operations on their watchlist.
Definition: SpecialEditWatchlist.php:37
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
SpecialPage\setHeaders
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
Definition: SpecialPage.php:352
SpecialPage\getUser
getUser()
Shortcut to get the User executing this instance.
Definition: SpecialPage.php:545
SpecialEditWatchlist\showTitles
showTitles( $titles, &$output)
Print out a list of linked titles.
Definition: SpecialEditWatchlist.php:222
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
list
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition: deferred.txt:11
SpecialPage\getContext
getContext()
Gets the context this SpecialPage is executed in.
Definition: SpecialPage.php:508
wfDebug
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Definition: GlobalFunctions.php:933
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:422
$title
presenting them properly to the user as errors is done by the caller $title
Definition: hooks.txt:1324
SpecialEditWatchlist\getMode
static getMode( $request, $par)
Determine whether we are editing the watchlist, and if so, what kind of editing operation.
Definition: SpecialEditWatchlist.php:664
$value
$value
Definition: styleTest.css.php:45
SpecialPage\msg
msg()
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:609
$tools
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title after the basic globals have been set but before ordinary actions take place change it to the message you want to define which works for all SkinTemplate type skins $tools
Definition: hooks.txt:1679
EditWatchlistCheckboxSeriesField
Definition: SpecialEditWatchlist.php:737
SpecialPage\getRequest
getRequest()
Get the WebRequest being used for this instance.
Definition: SpecialPage.php:525
SpecialEditWatchlist\cleanupWatchlist
cleanupWatchlist()
Attempts to clean up broken items.
Definition: SpecialEditWatchlist.php:369
HTMLForm\displaySection
displaySection( $fields, $sectionName='', $fieldsetIDPrefix='', &$hasUserVisibleFields=false)
Definition: HTMLForm.php:1169
$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
$count
$count
Definition: UtfNormalTest2.php:96
SpecialEditWatchlist\$toc
$toc
Definition: SpecialEditWatchlist.php:48
$args
if( $line===false) $args
Definition: cdb.php:62
EditWatchlistNormalHTMLForm\getBody
getBody()
Get the whole body of the form.
Definition: SpecialEditWatchlist.php:732
Title
Represents a title within MediaWiki.
Definition: Title.php:35
$wgLang
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 $wgLang
Definition: design.txt:56
SpecialEditWatchlist\getClearForm
getClearForm()
Get a form for clearing the watchlist.
Definition: SpecialEditWatchlist.php:642
HTMLMultiSelectField
Multi-select field.
Definition: HTMLMultiSelectField.php:6
$output
& $output
Definition: hooks.txt:375
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
NS_USER
const NS_USER
Definition: Defines.php:81
$batch
$batch
Definition: linkcache.txt:23
SpecialEditWatchlist\getNormalForm
getNormalForm()
Get the standard watchlist editing form.
Definition: SpecialEditWatchlist.php:513
SpecialPage\checkReadOnly
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
Definition: SpecialPage.php:300
Html\rawElement
static rawElement( $element, $attribs=array(), $contents='')
Returns an HTML element in a string.
Definition: Html.php:124
SpecialEditWatchlist\getWatchlistInfo
getWatchlistInfo()
Get a list of titles on a user's watchlist, excluding talk pages, and return as a two-dimensional arr...
Definition: SpecialEditWatchlist.php:313
MWNamespace\getTalk
static getTalk( $index)
Get the talk namespace index for a given namespace.
Definition: Namespace.php:118
MWNamespace\getSubject
static getSubject( $index)
Get the subject namespace index for a given namespace Special namespaces (NS_MEDIA,...
Definition: Namespace.php:132
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:59
$res
$res
Definition: database.txt:21
SpecialEditWatchlist\submitClear
submitClear( $data)
Definition: SpecialEditWatchlist.php:201
SpecialPage\outputHeader
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
Definition: SpecialPage.php:443
SpecialEditWatchlist\$successMessage
$successMessage
Definition: SpecialEditWatchlist.php:46
WatchlistEditor
Definition: SpecialEditWatchlist.php:717
HTMLForm
Object handling generic submission, CSRF protection, layout and other logic for UI forms.
Definition: HTMLForm.php:100
SpecialEditWatchlist\watchTitles
watchTitles( $titles)
Add a list of titles to a user's watchlist.
Definition: SpecialEditWatchlist.php:418