MediaWiki  1.27.2
SpecialTags.php
Go to the documentation of this file.
1 <?php
29 class SpecialTags extends SpecialPage {
30 
35 
40 
45 
46  function __construct() {
47  parent::__construct( 'Tags' );
48  }
49 
50  function execute( $par ) {
51  $this->setHeaders();
52  $this->outputHeader();
53 
54  $request = $this->getRequest();
55  switch ( $par ) {
56  case 'delete':
57  $this->showDeleteTagForm( $request->getVal( 'tag' ) );
58  break;
59  case 'activate':
60  $this->showActivateDeactivateForm( $request->getVal( 'tag' ), true );
61  break;
62  case 'deactivate':
63  $this->showActivateDeactivateForm( $request->getVal( 'tag' ), false );
64  break;
65  case 'create':
66  // fall through, thanks to HTMLForm's logic
67  default:
68  $this->showTagList();
69  break;
70  }
71  }
72 
73  function showTagList() {
74  $out = $this->getOutput();
75  $out->setPageTitle( $this->msg( 'tags-title' ) );
76  $out->wrapWikiMsg( "<div class='mw-tags-intro'>\n$1\n</div>", 'tags-intro' );
77 
78  $user = $this->getUser();
79  $userCanManage = $user->isAllowed( 'managechangetags' );
80  $userCanEditInterface = $user->isAllowed( 'editinterface' );
81 
82  // Show form to create a tag
83  if ( $userCanManage ) {
84  $fields = [
85  'Tag' => [
86  'type' => 'text',
87  'label' => $this->msg( 'tags-create-tag-name' )->plain(),
88  'required' => true,
89  ],
90  'Reason' => [
91  'type' => 'text',
92  'label' => $this->msg( 'tags-create-reason' )->plain(),
93  'size' => 50,
94  ],
95  'IgnoreWarnings' => [
96  'type' => 'hidden',
97  ],
98  ];
99 
100  $form = new HTMLForm( $fields, $this->getContext() );
101  $form->setAction( $this->getPageTitle( 'create' )->getLocalURL() );
102  $form->setWrapperLegendMsg( 'tags-create-heading' );
103  $form->setHeaderText( $this->msg( 'tags-create-explanation' )->parseAsBlock() );
104  $form->setSubmitCallback( [ $this, 'processCreateTagForm' ] );
105  $form->setSubmitTextMsg( 'tags-create-submit' );
106  $form->show();
107 
108  // If processCreateTagForm generated a redirect, there's no point
109  // continuing with this, as the user is just going to end up getting sent
110  // somewhere else. Additionally, if we keep going here, we end up
111  // populating the memcache of tag data (see ChangeTags::listDefinedTags)
112  // with out-of-date data from the slave, because the slave hasn't caught
113  // up to the fact that a new tag has been created as part of an implicit,
114  // as yet uncommitted transaction on master.
115  if ( $out->getRedirect() !== '' ) {
116  return;
117  }
118  }
119 
120  // Used to get hitcounts for #doTagRow()
121  $tagStats = ChangeTags::tagUsageStatistics();
122 
123  // Used in #doTagRow()
124  $this->explicitlyDefinedTags = array_fill_keys(
126  $this->extensionDefinedTags = array_fill_keys(
128 
129  // List all defined tags, even if they were never applied
130  $definedTags = array_keys( array_merge(
131  $this->explicitlyDefinedTags, $this->extensionDefinedTags ) );
132 
133  // Show header only if there exists atleast one tag
134  if ( !$tagStats && !$definedTags ) {
135  return;
136  }
137 
138  // Write the headers
139  $html = Xml::tags( 'tr', null, Xml::tags( 'th', null, $this->msg( 'tags-tag' )->parse() ) .
140  Xml::tags( 'th', null, $this->msg( 'tags-display-header' )->parse() ) .
141  Xml::tags( 'th', null, $this->msg( 'tags-description-header' )->parse() ) .
142  Xml::tags( 'th', null, $this->msg( 'tags-source-header' )->parse() ) .
143  Xml::tags( 'th', null, $this->msg( 'tags-active-header' )->parse() ) .
144  Xml::tags( 'th', null, $this->msg( 'tags-hitcount-header' )->parse() ) .
145  ( $userCanManage ?
146  Xml::tags( 'th', [ 'class' => 'unsortable' ],
147  $this->msg( 'tags-actions-header' )->parse() ) :
148  '' )
149  );
150 
151  // Used in #doTagRow()
152  $this->extensionActivatedTags = array_fill_keys(
154 
155  // Insert tags that have been applied at least once
156  foreach ( $tagStats as $tag => $hitcount ) {
157  $html .= $this->doTagRow( $tag, $hitcount, $userCanManage, $userCanEditInterface );
158  }
159  // Insert tags defined somewhere but never applied
160  foreach ( $definedTags as $tag ) {
161  if ( !isset( $tagStats[$tag] ) ) {
162  $html .= $this->doTagRow( $tag, 0, $userCanManage, $userCanEditInterface );
163  }
164  }
165 
166  $out->addHTML( Xml::tags(
167  'table',
168  [ 'class' => 'mw-datatable sortable mw-tags-table' ],
169  $html
170  ) );
171  }
172 
173  function doTagRow( $tag, $hitcount, $showActions, $showEditLinks ) {
174  $newRow = '';
175  $newRow .= Xml::tags( 'td', null, Xml::element( 'code', null, $tag ) );
176 
177  $disp = ChangeTags::tagDescription( $tag );
178  if ( $showEditLinks ) {
179  $disp .= ' ';
180  $editLink = Linker::link(
181  $this->msg( "tag-$tag" )->inContentLanguage()->getTitle(),
182  $this->msg( 'tags-edit' )->escaped()
183  );
184  $disp .= $this->msg( 'parentheses' )->rawParams( $editLink )->escaped();
185  }
186  $newRow .= Xml::tags( 'td', null, $disp );
187 
188  $msg = $this->msg( "tag-$tag-description" );
189  $desc = !$msg->exists() ? '' : $msg->parse();
190  if ( $showEditLinks ) {
191  $desc .= ' ';
192  $editDescLink = Linker::link(
193  $this->msg( "tag-$tag-description" )->inContentLanguage()->getTitle(),
194  $this->msg( 'tags-edit' )->escaped()
195  );
196  $desc .= $this->msg( 'parentheses' )->rawParams( $editDescLink )->escaped();
197  }
198  $newRow .= Xml::tags( 'td', null, $desc );
199 
200  $sourceMsgs = [];
201  $isExtension = isset( $this->extensionDefinedTags[$tag] );
202  $isExplicit = isset( $this->explicitlyDefinedTags[$tag] );
203  if ( $isExtension ) {
204  $sourceMsgs[] = $this->msg( 'tags-source-extension' )->escaped();
205  }
206  if ( $isExplicit ) {
207  $sourceMsgs[] = $this->msg( 'tags-source-manual' )->escaped();
208  }
209  if ( !$sourceMsgs ) {
210  $sourceMsgs[] = $this->msg( 'tags-source-none' )->escaped();
211  }
212  $newRow .= Xml::tags( 'td', null, implode( Xml::element( 'br' ), $sourceMsgs ) );
213 
214  $isActive = $isExplicit || isset( $this->extensionActivatedTags[$tag] );
215  $activeMsg = ( $isActive ? 'tags-active-yes' : 'tags-active-no' );
216  $newRow .= Xml::tags( 'td', null, $this->msg( $activeMsg )->escaped() );
217 
218  $hitcountLabel = $this->msg( 'tags-hitcount' )->numParams( $hitcount )->escaped();
219  if ( $this->getConfig()->get( 'UseTagFilter' ) ) {
220  $hitcountLabel = Linker::link(
221  SpecialPage::getTitleFor( 'Recentchanges' ),
222  $hitcountLabel,
223  [],
224  [ 'tagfilter' => $tag ]
225  );
226  }
227 
228  // add raw $hitcount for sorting, because tags-hitcount contains numbers and letters
229  $newRow .= Xml::tags( 'td', [ 'data-sort-value' => $hitcount ], $hitcountLabel );
230 
231  // actions
232  if ( $showActions ) { // we've already checked that the user had the requisite userright
233  $actionLinks = [];
234 
235  // delete
236  if ( ChangeTags::canDeleteTag( $tag )->isOK() ) {
237  $actionLinks[] = Linker::linkKnown( $this->getPageTitle( 'delete' ),
238  $this->msg( 'tags-delete' )->escaped(),
239  [],
240  [ 'tag' => $tag ] );
241  }
242 
243  // activate
244  if ( ChangeTags::canActivateTag( $tag )->isOK() ) {
245  $actionLinks[] = Linker::linkKnown( $this->getPageTitle( 'activate' ),
246  $this->msg( 'tags-activate' )->escaped(),
247  [],
248  [ 'tag' => $tag ] );
249  }
250 
251  // deactivate
252  if ( ChangeTags::canDeactivateTag( $tag )->isOK() ) {
253  $actionLinks[] = Linker::linkKnown( $this->getPageTitle( 'deactivate' ),
254  $this->msg( 'tags-deactivate' )->escaped(),
255  [],
256  [ 'tag' => $tag ] );
257  }
258 
259  $newRow .= Xml::tags( 'td', null, $this->getLanguage()->pipeList( $actionLinks ) );
260  }
261 
262  return Xml::tags( 'tr', null, $newRow ) . "\n";
263  }
264 
265  public function processCreateTagForm( array $data, HTMLForm $form ) {
266  $context = $form->getContext();
267  $out = $context->getOutput();
268 
269  $tag = trim( strval( $data['Tag'] ) );
270  $ignoreWarnings = isset( $data['IgnoreWarnings'] ) && $data['IgnoreWarnings'] === '1';
271  $status = ChangeTags::createTagWithChecks( $tag, $data['Reason'],
272  $context->getUser(), $ignoreWarnings );
273 
274  if ( $status->isGood() ) {
275  $out->redirect( $this->getPageTitle()->getLocalURL() );
276  return true;
277  } elseif ( $status->isOK() ) {
278  // we have some warnings, so we show a confirmation form
279  $fields = [
280  'Tag' => [
281  'type' => 'hidden',
282  'default' => $data['Tag'],
283  ],
284  'Reason' => [
285  'type' => 'hidden',
286  'default' => $data['Reason'],
287  ],
288  'IgnoreWarnings' => [
289  'type' => 'hidden',
290  'default' => '1',
291  ],
292  ];
293 
294  // fool HTMLForm into thinking the form hasn't been submitted yet. Otherwise
295  // we get into an infinite loop!
296  $context->getRequest()->unsetVal( 'wpEditToken' );
297 
298  $headerText = $this->msg( 'tags-create-warnings-above', $tag,
299  count( $status->getWarningsArray() ) )->parseAsBlock() .
300  $out->parse( $status->getWikiText() ) .
301  $this->msg( 'tags-create-warnings-below' )->parseAsBlock();
302 
303  $subform = new HTMLForm( $fields, $this->getContext() );
304  $subform->setAction( $this->getPageTitle( 'create' )->getLocalURL() );
305  $subform->setWrapperLegendMsg( 'tags-create-heading' );
306  $subform->setHeaderText( $headerText );
307  $subform->setSubmitCallback( [ $this, 'processCreateTagForm' ] );
308  $subform->setSubmitTextMsg( 'htmlform-yes' );
309  $subform->show();
310 
311  $out->addBacklinkSubtitle( $this->getPageTitle() );
312  return true;
313  } else {
314  $out->addWikiText( "<div class=\"error\">\n" . $status->getWikiText() .
315  "\n</div>" );
316  return false;
317  }
318  }
319 
320  protected function showDeleteTagForm( $tag ) {
321  $user = $this->getUser();
322  if ( !$user->isAllowed( 'managechangetags' ) ) {
323  throw new PermissionsError( 'managechangetags' );
324  }
325 
326  $out = $this->getOutput();
327  $out->setPageTitle( $this->msg( 'tags-delete-title' ) );
328  $out->addBacklinkSubtitle( $this->getPageTitle() );
329 
330  // is the tag actually able to be deleted?
331  $canDeleteResult = ChangeTags::canDeleteTag( $tag, $user );
332  if ( !$canDeleteResult->isGood() ) {
333  $out->addWikiText( "<div class=\"error\">\n" . $canDeleteResult->getWikiText() .
334  "\n</div>" );
335  if ( !$canDeleteResult->isOK() ) {
336  return;
337  }
338  }
339 
340  $preText = $this->msg( 'tags-delete-explanation-initial', $tag )->parseAsBlock();
341  $tagUsage = ChangeTags::tagUsageStatistics();
342  if ( isset( $tagUsage[$tag] ) && $tagUsage[$tag] > 0 ) {
343  $preText .= $this->msg( 'tags-delete-explanation-in-use', $tag,
344  $tagUsage[$tag] )->parseAsBlock();
345  }
346  $preText .= $this->msg( 'tags-delete-explanation-warning', $tag )->parseAsBlock();
347 
348  // see if the tag is in use
349  $this->extensionActivatedTags = array_fill_keys(
351  if ( isset( $this->extensionActivatedTags[$tag] ) ) {
352  $preText .= $this->msg( 'tags-delete-explanation-active', $tag )->parseAsBlock();
353  }
354 
355  $fields = [];
356  $fields['Reason'] = [
357  'type' => 'text',
358  'label' => $this->msg( 'tags-delete-reason' )->plain(),
359  'size' => 50,
360  ];
361  $fields['HiddenTag'] = [
362  'type' => 'hidden',
363  'name' => 'tag',
364  'default' => $tag,
365  'required' => true,
366  ];
367 
368  $form = new HTMLForm( $fields, $this->getContext() );
369  $form->setAction( $this->getPageTitle( 'delete' )->getLocalURL() );
370  $form->tagAction = 'delete'; // custom property on HTMLForm object
371  $form->setSubmitCallback( [ $this, 'processTagForm' ] );
372  $form->setSubmitTextMsg( 'tags-delete-submit' );
373  $form->setSubmitDestructive(); // nasty!
374  $form->addPreText( $preText );
375  $form->show();
376  }
377 
378  protected function showActivateDeactivateForm( $tag, $activate ) {
379  $actionStr = $activate ? 'activate' : 'deactivate';
380 
381  $user = $this->getUser();
382  if ( !$user->isAllowed( 'managechangetags' ) ) {
383  throw new PermissionsError( 'managechangetags' );
384  }
385 
386  $out = $this->getOutput();
387  // tags-activate-title, tags-deactivate-title
388  $out->setPageTitle( $this->msg( "tags-$actionStr-title" ) );
389  $out->addBacklinkSubtitle( $this->getPageTitle() );
390 
391  // is it possible to do this?
392  $func = $activate ? 'canActivateTag' : 'canDeactivateTag';
393  $result = ChangeTags::$func( $tag, $user );
394  if ( !$result->isGood() ) {
395  $out->addWikiText( "<div class=\"error\">\n" . $result->getWikiText() .
396  "\n</div>" );
397  if ( !$result->isOK() ) {
398  return;
399  }
400  }
401 
402  // tags-activate-question, tags-deactivate-question
403  $preText = $this->msg( "tags-$actionStr-question", $tag )->parseAsBlock();
404 
405  $fields = [];
406  // tags-activate-reason, tags-deactivate-reason
407  $fields['Reason'] = [
408  'type' => 'text',
409  'label' => $this->msg( "tags-$actionStr-reason" )->plain(),
410  'size' => 50,
411  ];
412  $fields['HiddenTag'] = [
413  'type' => 'hidden',
414  'name' => 'tag',
415  'default' => $tag,
416  'required' => true,
417  ];
418 
419  $form = new HTMLForm( $fields, $this->getContext() );
420  $form->setAction( $this->getPageTitle( $actionStr )->getLocalURL() );
421  $form->tagAction = $actionStr;
422  $form->setSubmitCallback( [ $this, 'processTagForm' ] );
423  // tags-activate-submit, tags-deactivate-submit
424  $form->setSubmitTextMsg( "tags-$actionStr-submit" );
425  $form->addPreText( $preText );
426  $form->show();
427  }
428 
429  public function processTagForm( array $data, HTMLForm $form ) {
430  $context = $form->getContext();
431  $out = $context->getOutput();
432 
433  $tag = $data['HiddenTag'];
434  $status = call_user_func( [ 'ChangeTags', "{$form->tagAction}TagWithChecks" ],
435  $tag, $data['Reason'], $context->getUser(), true );
436 
437  if ( $status->isGood() ) {
438  $out->redirect( $this->getPageTitle()->getLocalURL() );
439  return true;
440  } elseif ( $status->isOK() && $form->tagAction === 'delete' ) {
441  // deletion succeeded, but hooks raised a warning
442  $out->addWikiText( $this->msg( 'tags-delete-warnings-after-delete', $tag,
443  count( $status->getWarningsArray() ) )->text() . "\n" .
444  $status->getWikitext() );
445  $out->addReturnTo( $this->getPageTitle() );
446  return true;
447  } else {
448  $out->addWikiText( "<div class=\"error\">\n" . $status->getWikitext() .
449  "\n</div>" );
450  return false;
451  }
452  }
453 
459  public function getSubpagesForPrefixSearch() {
460  // The subpages does not have an own form, so not listing it at the moment
461  return [
462  // 'delete',
463  // 'activate',
464  // 'deactivate',
465  // 'create',
466  ];
467  }
468 
469  protected function getGroupName() {
470  return 'changes';
471  }
472 }
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 & $html
Definition: hooks.txt:1798
static canActivateTag($tag, User $user=null)
Is it OK to allow the user to activate this tag?
Definition: ChangeTags.php:796
showDeleteTagForm($tag)
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:762
the array() calling protocol came about after MediaWiki 1.4rc1.
array $extensionActivatedTags
List of extension activated tags.
Definition: SpecialTags.php:44
static linkKnown($target, $html=null, $customAttribs=[], $query=[], $options=[ 'known', 'noclasses'])
Identical to link(), except $options defaults to 'known'.
Definition: Linker.php:264
$context
Definition: load.php:44
getContext()
Gets the context this SpecialPage is executed in.
static element($element, $attribs=null, $contents= '', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
Definition: Xml.php:39
static getTitleFor($name, $subpage=false, $fragment= '')
Get a localised Title object for a specified special page name.
Definition: SpecialPage.php:75
static createTagWithChecks($tag, $reason, User $user, $ignoreWarnings=false)
Creates a tag by adding a row to the valid_tag table.
Definition: ChangeTags.php:975
processing should stop and the error should be shown to the user * false
Definition: hooks.txt:189
msg()
Wrapper around wfMessage that sets the current context.
static listExplicitlyDefinedTags()
Lists tags explicitly defined in the valid_tag table of the database.
getOutput()
Get the OutputPage being used for this instance.
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message.Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item.Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page.Return false to stop further processing of the tag $reader:XMLReader object &$pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision.Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag.Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload.Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports.&$fullInterwikiPrefix:Interwiki prefix, may contain colons.&$pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable.Can be used to lazy-load the import sources list.&$importSources:The value of $wgImportSources.Modify as necessary.See the comment in DefaultSettings.php for the detail of how to structure this array. 'InfoAction':When building information to display on the action=info page.$context:IContextSource object &$pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect.&$title:Title object for the current page &$request:WebRequest &$ignoreRedirect:boolean to skip redirect check &$target:Title/string of redirect target &$article:Article object 'InternalParseBeforeLinks':during Parser's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings.&$parser:Parser object &$text:string containing partially parsed text &$stripState:Parser's internal StripState object 'InternalParseBeforeSanitize':during Parser's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings.Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments.&$parser:Parser object &$text:string containing partially parsed text &$stripState:Parser's internal StripState object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not.Return true without providing an interwiki to continue interwiki search.$prefix:interwiki prefix we are looking for.&$iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InvalidateEmailComplete':Called after a user's email has been invalidated successfully.$user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification.Callee may modify $url and $query, URL will be constructed as $url.$query &$url:URL to index.php &$query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) &$article:article(object) being checked 'IsTrustedProxy':Override the result of IP::isTrustedProxy() &$ip:IP being check &$result:Change this value to override the result of IP::isTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from &$allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of Sanitizer::validateEmail(), for instance to return false if the domain name doesn't match your organization.$addr:The e-mail address entered by the user &$result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user &$result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we're looking for a messages file for &$file:The messages file path, you can override this to change the location. 'LanguageGetMagic':DEPRECATED!Use $magicWords in a file listed in $wgExtensionMessagesFiles instead.Use this to define synonyms of magic words depending of the language &$magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces.Do not use this hook to add namespaces.Use CanonicalNamespaces for that.&$namespaces:Array of namespaces indexed by their numbers 'LanguageGetSpecialPageAliases':DEPRECATED!Use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead.Use to define aliases of special pages names depending of the language &$specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names.&$names:array of language code=> language name $code:language of the preferred translations 'LanguageLinks':Manipulate a page's language links.This is called in various places to allow extensions to define the effective language links for a page.$title:The page's Title.&$links:Associative array mapping language codes to prefixed links of the form"language:title".&$linkFlags:Associative array mapping prefixed links to arrays of flags.Currently unused, but planned to provide support for marking individual language links in the UI, e.g.for featured articles. 'LanguageSelector':Hook to change the language selector available on a page.$out:The output page.$cssClassName:CSS class name of the language selector. 'LinkBegin':Used when generating internal and interwiki links in Linker::link(), before processing starts.Return false to skip default processing and return $ret.See documentation for Linker::link() for details on the expected meanings of parameters.$skin:the Skin object $target:the Title that the link is pointing to &$html:the contents that the< a > tag should have(raw HTML) $result
Definition: hooks.txt:1796
outputHeader($summaryMessageKey= '')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
static tagDescription($tag)
Get a short description for a tag.
Definition: ChangeTags.php:99
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 true
Definition: hooks.txt:1798
Parent class for all special pages.
Definition: SpecialPage.php:36
doTagRow($tag, $hitcount, $showActions, $showEditLinks)
static canDeactivateTag($tag, User $user=null)
Is it OK to allow the user to deactivate this tag?
Definition: ChangeTags.php:864
getContext()
Get the base IContextSource object.
getTitle($subpage=false)
Get a self-referential title object.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes! ...
static canDeleteTag($tag, User $user=null)
Is it OK to allow the user to delete this tag?
Object handling generic submission, CSRF protection, layout and other logic for UI forms...
Definition: HTMLForm.php:123
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 $tag
Definition: hooks.txt:965
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
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
static link($target, $html=null, $customAttribs=[], $query=[], $options=[])
This function returns an HTML link to the given target.
Definition: Linker.php:195
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
static tags($element, $attribs=null, $contents)
Same as Xml::element(), but does not escape contents.
Definition: Xml.php:131
error also a ContextSource you ll probably need to make sure the header is varied on $request
Definition: hooks.txt:2418
array $explicitlyDefinedTags
List of explicitly defined tags.
Definition: SpecialTags.php:34
getUser()
Shortcut to get the User executing this instance.
getConfig()
Shortcut to get main config object.
Show an error when a user tries to do something they do not have the necessary permissions for...
getLanguage()
Shortcut to get user's language.
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 $status
Definition: hooks.txt:1004
static listExtensionDefinedTags()
Lists tags defined by extensions using the ListDefinedTags hook.
getRequest()
Get the WebRequest being used for this instance.
A special page that lists tags for edits.
Definition: SpecialTags.php:29
showActivateDeactivateForm($tag, $activate)
array $extensionDefinedTags
List of extension defined tags.
Definition: SpecialTags.php:39
processTagForm(array $data, HTMLForm $form)
static listExtensionActivatedTags()
Lists those tags which extensions report as being "active".
getPageTitle($subpage=false)
Get a self-referential title object.
getSubpagesForPrefixSearch()
Return an array of subpages that this special page will accept.
processCreateTagForm(array $data, HTMLForm $form)
static tagUsageStatistics()
Returns a map of any tags used on the wiki to number of edits tagged with them, ordered descending by...
execute($par)
Definition: SpecialTags.php:50