3 * Implements Special:Fewestrevisions
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
21 * @ingroup SpecialPage
24 use MediaWiki\MediaWikiServices
;
27 * Special page for listing the articles with the fewest revisions.
29 * @ingroup SpecialPage
30 * @author Martin Drashkov
32 class FewestrevisionsPage
extends QueryPage
{
33 function __construct( $name = 'Fewestrevisions' ) {
34 parent
::__construct( $name );
37 public function isExpensive() {
41 function isSyndicated() {
45 public function getQueryInfo() {
47 'tables' => [ 'revision', 'page' ],
49 'namespace' => 'page_namespace',
50 'title' => 'page_title',
51 'value' => 'COUNT(*)',
52 'redirect' => 'page_is_redirect'
55 'page_namespace' => MediaWikiServices
::getInstance()->getNamespaceInfo()->
56 getContentNamespaces(),
57 'page_id = rev_page' ],
59 'GROUP BY' => [ 'page_namespace', 'page_title', 'page_is_redirect' ]
64 function sortDescending() {
70 * @param object $result Database row
73 function formatResult( $skin, $result ) {
74 $nt = Title
::makeTitleSafe( $result->namespace, $result->title
);
78 [ 'class' => 'mw-invalidtitle' ],
79 Linker
::getInvalidTitleDescription(
86 $linkRenderer = $this->getLinkRenderer();
87 $text = MediaWikiServices
::getInstance()->getContentLanguage()->
88 convert( htmlspecialchars( $nt->getPrefixedText() ) );
89 $plink = $linkRenderer->makeLink( $nt, new HtmlArmor( $text ) );
91 $nl = $this->msg( 'nrevisions' )->numParams( $result->value
)->text();
92 $redirect = isset( $result->redirect
) && $result->redirect ?
93 ' - ' . $this->msg( 'isredirect' )->escaped() : '';
94 $nlink = $linkRenderer->makeKnownLink(
98 [ 'action' => 'history' ]
101 return $this->getLanguage()->specialList( $plink, $nlink );
104 protected function getGroupName() {
105 return 'maintenance';