Expose $wgMaxArticleSize in siteinfo query api
[mediawiki.git] / includes / specials / SpecialListfiles.php
blobe6e1048cd6a9277ff426a674e1f4f8ce4dcc0d4f
1 <?php
2 /**
3 * Implements Special:Listfiles
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
20 * @file
21 * @ingroup SpecialPage
24 class SpecialListFiles extends IncludableSpecialPage {
25 public function __construct() {
26 parent::__construct( 'Listfiles' );
29 public function execute( $par ) {
30 $this->setHeaders();
31 $this->outputHeader();
33 if ( $this->including() ) {
34 $userName = $par;
35 $search = '';
36 $showAll = false;
37 } else {
38 $userName = $this->getRequest()->getText( 'user', $par );
39 $search = $this->getRequest()->getText( 'ilsearch', '' );
40 $showAll = $this->getRequest()->getBool( 'ilshowall', false );
43 $pager = new ImageListPager(
44 $this->getContext(),
45 $userName,
46 $search,
47 $this->including(),
48 $showAll
51 $out = $this->getOutput();
52 if ( $this->including() ) {
53 $out->addParserOutputContent( $pager->getBodyOutput() );
54 } else {
55 $user = $pager->getRelevantUser();
56 $this->getSkin()->setRelevantUser( $user );
57 $pager->getForm();
58 $out->addParserOutputContent( $pager->getFullOutput() );
62 /**
63 * Return an array of subpages beginning with $search that this special page will accept.
65 * @param string $search Prefix to search for
66 * @param int $limit Maximum number of results to return (usually 10)
67 * @param int $offset Number of results to skip (usually 0)
68 * @return string[] Matching subpages
70 public function prefixSearchSubpages( $search, $limit, $offset ) {
71 $user = User::newFromName( $search );
72 if ( !$user ) {
73 // No prefix suggestion for invalid user
74 return [];
76 // Autocomplete subpage as user list - public to allow caching
77 return UserNamePrefixSearch::search( 'public', $search, $limit, $offset );
80 protected function getGroupName() {
81 return 'media';