MediaWiki REL1_34
SpecialListFiles.php
Go to the documentation of this file.
1<?php
25 public function __construct() {
26 parent::__construct( 'Listfiles' );
27 }
28
29 public function execute( $par ) {
30 $this->setHeaders();
31 $this->outputHeader();
32 $this->addHelpLink( 'Help:Managing_files' );
33
34 if ( $this->including() ) {
35 $userName = $par;
36 $search = '';
37 $showAll = false;
38 } else {
39 $userName = $this->getRequest()->getText( 'user', $par );
40 $search = $this->getRequest()->getText( 'ilsearch', '' );
41 $showAll = $this->getRequest()->getBool( 'ilshowall', false );
42 }
43 if ( $userName ) {
44 $pageTitle = $this->msg( 'listfiles_subpage', $userName );
45 } else {
46 $pageTitle = $this->msg( 'listfiles' );
47 }
48
49 $pager = new ImageListPager(
50 $this->getContext(),
51 $userName,
52 $search,
53 $this->including(),
54 $showAll,
55 $this->getLinkRenderer()
56 );
57
58 $out = $this->getOutput();
59 $out->setPageTitle( $pageTitle );
60 $out->addModuleStyles( 'mediawiki.special' );
61 if ( $this->including() ) {
62 $out->addParserOutputContent( $pager->getBodyOutput() );
63 } else {
64 $user = $pager->getRelevantUser();
65 $this->getSkin()->setRelevantUser( $user );
66 $pager->getForm();
67 $out->addParserOutputContent( $pager->getFullOutput() );
68 }
69 }
70
79 public function prefixSearchSubpages( $search, $limit, $offset ) {
80 $user = User::newFromName( $search );
81 if ( !$user ) {
82 // No prefix suggestion for invalid user
83 return [];
84 }
85 // Autocomplete subpage as user list - public to allow caching
86 return UserNamePrefixSearch::search( 'public', $search, $limit, $offset );
87 }
88
89 protected function getGroupName() {
90 return 'media';
91 }
92}
Shortcut to construct an includable special page.
prefixSearchSubpages( $search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
execute( $par)
Default execute method Checks user permissions.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
getSkin()
Shortcut to get the skin being used for this instance.
getContext()
Gets the context this SpecialPage is executed in.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getRequest()
Get the WebRequest being used for this instance.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
including( $x=null)
Whether the special page is being evaluated via transclusion.
static search( $audience, $search, $limit, $offset=0)
Do a prefix search of user names and return a list of matching user names.