repoGroup = $repoGroup; $this->dbProvider = $dbProvider; $this->commentStore = $commentStore; $this->userNameUtils = $userNameUtils; $this->userNamePrefixSearch = $userNamePrefixSearch; $this->commentFormatter = $commentFormatter; $this->linkBatchFactory = $linkBatchFactory; } public function execute( $par ) { $this->setHeaders(); $this->outputHeader(); $this->addHelpLink( 'Help:Managing_files' ); if ( $this->including() ) { $userName = (string)$par; $search = ''; $showAll = false; } else { $userName = $this->getRequest()->getText( 'user', $par ?? '' ); $search = $this->getRequest()->getText( 'ilsearch', '' ); $showAll = $this->getRequest()->getBool( 'ilshowall', false ); } // Sanitize usernames to avoid symbols in the title of page. $sanitizedUserName = $this->userNameUtils->getCanonical( $userName, UserRigorOptions::RIGOR_NONE ); if ( $sanitizedUserName !== false ) { $userName = $sanitizedUserName; } if ( $userName !== '' ) { $pageTitle = $this->msg( 'listfiles_subpage' )->plaintextParams( $userName ); } else { $pageTitle = $this->msg( 'listfiles' ); } $pager = new ImageListPager( $this->getContext(), $this->commentStore, $this->getLinkRenderer(), $this->dbProvider, $this->repoGroup, $this->userNameUtils, $this->commentFormatter, $this->linkBatchFactory, $userName, $search, $this->including(), $showAll ); $out = $this->getOutput(); $out->setPageTitleMsg( $pageTitle ); $out->addModuleStyles( 'mediawiki.special' ); if ( $this->including() ) { $out->addParserOutputContent( $pager->getBodyOutput() ); } else { $user = $pager->getRelevantUser(); if ( $user ) { $this->getSkin()->setRelevantUser( $user ); } $pager->getForm(); $out->addParserOutputContent( $pager->getFullOutput() ); } } /** * Return an array of subpages beginning with $search that this special page will accept. * * @param string $search Prefix to search for * @param int $limit Maximum number of results to return (usually 10) * @param int $offset Number of results to skip (usually 0) * @return string[] Matching subpages */ public function prefixSearchSubpages( $search, $limit, $offset ) { $search = $this->userNameUtils->getCanonical( $search ); if ( !$search ) { // No prefix suggestion for invalid user return []; } // Autocomplete subpage as user list - public to allow caching return $this->userNamePrefixSearch ->search( UserNamePrefixSearch::AUDIENCE_PUBLIC, $search, $limit, $offset ); } protected function getGroupName() { return 'media'; } } /** @deprecated class alias since 1.41 */ class_alias( SpecialListFiles::class, 'SpecialListFiles' );