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
25 * Special page for listing the articles with the fewest revisions.
27 * @ingroup SpecialPage
28 * @author Martin Drashkov
30 class FewestrevisionsPage
extends QueryPage
{
32 function __construct( $name = 'Fewestrevisions' ) {
33 parent
::__construct( $name );
36 function isExpensive() {
40 function isSyndicated() {
44 function getQueryInfo() {
46 'tables' => array ( 'revision', 'page' ),
47 'fields' => array ( 'namespace' => 'page_namespace',
48 'title' => 'page_title',
49 'value' => 'COUNT(*)',
50 'redirect' => 'page_is_redirect' ),
51 'conds' => array ( 'page_namespace' => MWNamespace
::getContentNamespaces(),
52 'page_id = rev_page' ),
53 'options' => array ( 'HAVING' => 'COUNT(*) > 1',
54 // ^^^ This was probably here to weed out redirects.
55 // Since we mark them as such now, it might be
56 // useful to remove this. People _do_ create pages
57 // and never revise them, they aren't necessarily
59 'GROUP BY' => array( 'page_namespace', 'page_title', 'page_is_redirect' ) )
64 function sortDescending() {
69 * @param $skin Skin object
70 * @param $result Object: database row
73 function formatResult( $skin, $result ) {
76 $nt = Title
::makeTitleSafe( $result->namespace, $result->title
);
78 return Html
::element( 'span', array( 'class' => 'mw-invalidtitle' ),
79 Linker
::getInvalidTitleDescription( $this->getContext(), $result->namespace, $result->title
) );
82 $text = htmlspecialchars( $wgContLang->convert( $nt->getPrefixedText() ) );
83 $plink = Linker
::linkKnown( $nt, $text );
85 $nl = $this->msg( 'nrevisions' )->numParams( $result->value
)->escaped();
86 $redirect = isset( $result->redirect
) && $result->redirect ?
87 ' - ' . $this->msg( 'isredirect' )->escaped() : '';
88 $nlink = Linker
::linkKnown(
92 array( 'action' => 'history' )
95 return $this->getLanguage()->specialList( $plink, $nlink );