Go to the documentation of this file.
53 parent::__construct(
'EditWatchlist',
'editmywatchlist' );
64 # Anons don't get a watchlist
77 # B/C: $mode used to be waaay down the parameter list, and the first parameter
79 if ( $mode instanceof
User ) {
80 $args = func_get_args();
81 if ( count(
$args ) >= 4 ) {
89 $out->setPageTitle( $this->
msg(
'watchlistedit-raw-title' ) );
91 if (
$form->show() ) {
92 $out->addHTML( $this->successMessage );
97 $out->setPageTitle( $this->
msg(
'watchlistedit-clear-title' ) );
99 if (
$form->show() ) {
100 $out->addHTML( $this->successMessage );
107 $out->setPageTitle( $this->
msg(
'watchlistedit-normal-title' ) );
109 if (
$form->show() ) {
110 $out->addHTML( $this->successMessage );
112 } elseif ( $this->toc !==
false ) {
113 $out->prependHTML( $this->toc );
127 $list = explode(
"\n", trim( $list ) );
128 if ( !is_array( $list ) ) {
134 foreach ( $list
as $text ) {
135 $text = trim( $text );
136 if ( strlen( $text ) > 0 ) {
149 $list[] =
$title->getPrefixedText();
152 return array_unique( $list );
159 if ( count( $wanted ) > 0 ) {
160 $toWatch = array_diff( $wanted, $current );
161 $toUnwatch = array_diff( $current, $wanted );
164 $this->
getUser()->invalidateCache();
166 if ( count( $toWatch ) > 0 || count( $toUnwatch ) > 0 ) {
167 $this->successMessage = $this->
msg(
'watchlistedit-raw-done' )->parse();
172 if ( count( $toWatch ) > 0 ) {
173 $this->successMessage .=
' ' . $this->
msg(
'watchlistedit-raw-added' )
174 ->numParams( count( $toWatch ) )->parse();
175 $this->
showTitles( $toWatch, $this->successMessage );
178 if ( count( $toUnwatch ) > 0 ) {
179 $this->successMessage .=
' ' . $this->
msg(
'watchlistedit-raw-removed' )
180 ->numParams( count( $toUnwatch ) )->parse();
181 $this->
showTitles( $toUnwatch, $this->successMessage );
185 $this->
getUser()->invalidateCache();
187 if ( count( $current ) > 0 ) {
188 $this->successMessage = $this->
msg(
'watchlistedit-raw-done' )->parse();
193 $this->successMessage .=
' ' . $this->
msg(
'watchlistedit-raw-removed' )
194 ->numParams( count( $current ) )->parse();
195 $this->
showTitles( $current, $this->successMessage );
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 );
223 $talk = $this->
msg(
'talkpagelinktext' )->escaped();
275 'wl_namespace',
'wl_title'
277 'wl_user' => $this->
getUser()->getId(),
282 if (
$res->numRows() > 0 ) {
284 foreach (
$res as $row ) {
298 $list[] =
$title->getPrefixedText();
318 array(
'watchlist' ),
319 array(
'wl_namespace',
'wl_title' ),
322 array(
'ORDER BY' =>
array(
'wl_namespace',
'wl_title' ) )
327 foreach (
$res as $row ) {
328 $lb->add( $row->wl_namespace, $row->wl_title );
330 $titles[$row->wl_namespace][$row->wl_title] = 1;
350 ||
$title->getNamespace() < 0
357 ||
$title->getNamespace() != $namespace
358 ||
$title->getDBkey() != $dbKey
360 $this->badItems[] =
array(
$title, $namespace, $dbKey );
370 if ( !count( $this->badItems ) ) {
377 foreach ( $this->badItems
as $row ) {
379 $action =
$title ?
'cleaning up' :
'deleting';
380 wfDebug(
"User {$user->getName()} has broken watchlist item ns($namespace):$dbKey, $action.\n" );
382 $dbw->delete(
'watchlist',
384 'wl_user' =>
$user->getId(),
385 'wl_namespace' => $namespace,
386 'wl_title' => $dbKey,
429 'wl_user' => $this->
getUser()->getId(),
431 'wl_title' =>
$title->getDBkey(),
432 'wl_notificationtimestamp' =>
null,
435 'wl_user' => $this->
getUser()->getId(),
437 'wl_title' =>
$title->getDBkey(),
438 'wl_notificationtimestamp' =>
null,
443 $dbw->insert(
'watchlist', $rows, __METHOD__,
'IGNORE' );
466 'wl_user' => $this->
getUser()->getId(),
468 'wl_title' =>
$title->getDBkey(),
476 'wl_user' => $this->
getUser()->getId(),
478 'wl_title' =>
$title->getDBkey(),
494 $removed = array_merge( $removed,
$titles );
497 if ( count( $removed ) > 0 ) {
498 $this->successMessage = $this->
msg(
'watchlistedit-normal-done'
499 )->numParams( count( $removed ) )->parse();
500 $this->
showTitles( $removed, $this->successMessage );
520 if ( $namespace >= 0 ) {
521 $fields[
'TitlesNs' . $namespace] =
array(
522 'class' =>
'EditWatchlistCheckboxSeriesField',
523 'options' =>
array(),
524 'section' =>
"ns$namespace",
528 foreach ( array_keys( $pages )
as $dbkey ) {
533 $fields[
'TitlesNs' . $namespace][
'options'][$text] =
$title->getPrefixedText();
540 if ( count( $fields ) > 1 &&
$count > 30 ) {
544 foreach ( $fields
as $data ) {
545 # strip out the 'ns' prefix from the section name:
546 $ns = substr( $data[
'section'], 2 );
549 ? $this->
msg(
'blanknamespace' )->escaped()
550 : htmlspecialchars(
$wgContLang->getFormattedNsText( $ns ) );
551 $this->toc .=
Linker::tocLine(
"editwatchlist-{$data['section']}", $nsText,
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' ) );
582 if (
$title->isRedirect() ) {
584 $link =
'<span class="watchlistredir">' .
$link .
'</span>';
592 $this->
msg(
'history_short' )->escaped(),
594 array(
'action' =>
'history' )
601 $this->
msg(
'contributions' )->escaped()
619 'type' =>
'textarea',
620 'label-message' =>
'watchlistedit-raw-titles',
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' ) );
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' ) );
664 public static function getMode( $request, $par ) {
665 $mode = strtolower( $request->getVal(
'action', $par ) );
694 'view' =>
array(
'Watchlist',
false ),
695 'edit' =>
array(
'EditWatchlist',
false ),
696 'raw' =>
array(
'EditWatchlist',
'raw' ),
697 'clear' =>
array(
'EditWatchlist',
'clear' ),
700 foreach ( $modes
as $mode => $arr ) {
704 wfMessage(
"watchlisttools-{$mode}" )->escaped()
710 array(
'class' =>
'mw-watchlist-toollinks' ),
725 $namespace = substr( $namespace, 2 );
728 ? $this->
msg(
'blanknamespace' )->escaped()
733 return $this->
displaySection( $this->mFieldTree,
'',
'editwatchlist-' );
getPageTitle( $subpage=false)
Get a self-referential title object.
const EDIT_CLEAR
Editing modes.
getWatchlist()
Prepare a list of titles on a user's watchlist (excluding talk pages) and return an array of (prefixe...
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
getContext()
Get the RequestContext object.
unwatchTitles( $titles)
Remove a list of titles from a user's watchlist.
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
checkTitle( $title, $namespace, $dbKey)
Validates watchlist entry.
static isTalk( $index)
Is the given namespace a talk namespace?
msg()
Get a Message object with context set Parameters are the same as wfMessage()
Class representing a list of titles The execute() method checks them all for existence and adds them ...
getOutput()
Get the OutputPage being used for this instance.
Shortcut to construct a special page which is unlisted by default.
static tocIndent()
Add another level to the Table of Contents.
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
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
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
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.
buildRemoveLine( $title)
Build the label for a checkbox, with a link to the title, and various additional bits.
static buildTools( $unused)
Build a set of links for convenient navigation between watchlist viewing and editing modes.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name.
getSkin()
Shortcut to get the skin being used for this instance.
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
getLanguage()
Shortcut to get user's language.
getName()
Get the name of this Special Page.
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
requireLogin( $reasonMsg=null, $titleMsg=null)
If the user is not logged in, throws UserNotLoggedIn error.
static tocLine( $anchor, $tocline, $tocnumber, $level, $sectionIndex=false)
parameter level defines if we are on an indentation level
static linkKnown( $target, $html=null, $customAttribs=array(), $query=array(), $options=array( 'known', 'noclasses'))
Identical to link(), except $options defaults to 'known'.
static link( $target, $html=null, $customAttribs=array(), $query=array(), $options=array())
This function returns an HTML link to the given target.
getLanguage()
Get the Language object.
execute( $mode)
Main execution point.
An IContextSource implementation which will inherit context from another source but allow individual ...
if( $wgAPIRequestLog) $lb
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
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
getRawForm()
Get a form for editing the watchlist in "raw" mode.
clearWatchlist()
Remove all titles from a user's watchlist.
validate( $value, $alldata)
HTMLMultiSelectField throws validation errors if we get input data that doesn't match the data set in...
static tocList( $toc, $lang=false)
Wraps the TOC in a table and provides the hide/collapse javascript.
extractTitles( $list)
Extract a list of titles from a blob of text, returning (prefixed) strings; unwatchable titles are ig...
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 "<
static tocLineEnd()
End a Table Of Contents line.
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
Provides the UI through which users can perform editing operations on their watchlist.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getUser()
Shortcut to get the User executing this instance.
showTitles( $titles, &$output)
Print out a list of linked titles.
when a variable name is used in a it is silently declared as a new masking the global
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
getContext()
Gets the context this SpecialPage is executed in.
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
presenting them properly to the user as errors is done by the caller $title
static getMode( $request, $par)
Determine whether we are editing the watchlist, and if so, what kind of editing operation.
msg()
Wrapper around wfMessage that sets the current context.
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
getRequest()
Get the WebRequest being used for this instance.
cleanupWatchlist()
Attempts to clean up broken items.
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
Represents a title within MediaWiki.
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
getClearForm()
Get a form for clearing the watchlist.
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
getNormalForm()
Get the standard watchlist editing form.
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
static rawElement( $element, $attribs=array(), $contents='')
Returns an HTML element in a string.
getWatchlistInfo()
Get a list of titles on a user's watchlist, excluding talk pages, and return as a two-dimensional arr...
static getTalk( $index)
Get the talk namespace index for a given namespace.
static getSubject( $index)
Get the subject namespace index for a given namespace Special namespaces (NS_MEDIA,...
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
watchTitles( $titles)
Add a list of titles to a user's watchlist.