9a8d7c8ce934bae933b36784de54590c8c212eef
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 * http://www.gnu.org/copyleft/gpl.html
21 * Special page for listing the articles with the fewest revisions.
24 * @ingroup SpecialPage
25 * @author Martin Drashkov
27 class FewestrevisionsPage
extends QueryPage
{
30 return 'Fewestrevisions';
33 function isExpensive() {
37 function isSyndicated() {
42 $dbr = wfGetDB( DB_SLAVE
);
43 list( $revision, $page ) = $dbr->tableNamesN( 'revision', 'page' );
45 return "SELECT 'Fewestrevisions' as type,
46 page_namespace as namespace,
48 page_is_redirect as redirect,
51 JOIN $page ON page_id = rev_page
52 WHERE page_namespace = " . NS_MAIN
. "
53 GROUP BY page_namespace, page_title, page_is_redirect
55 // ^^^ This was probably here to weed out redirects.
56 // Since we mark them as such now, it might be
57 // useful to remove this. People _do_ create pages
58 // and never revise them, they aren't necessarily
62 function sortDescending() {
66 function formatResult( $skin, $result ) {
67 global $wgLang, $wgContLang;
69 $nt = Title
::makeTitleSafe( $result->namespace, $result->title
);
71 return '<!-- bad title -->';
74 $text = $wgContLang->convert( $nt->getPrefixedText() );
76 $plink = $skin->linkKnown(
81 $nl = wfMsgExt( 'nrevisions', array( 'parsemag', 'escape' ),
82 $wgLang->formatNum( $result->value
) );
83 $redirect = $result->redirect ?
' - ' . wfMsgHtml( 'isredirect' ) : '';
84 $nlink = $skin->linkKnown(
88 array( 'action' => 'history' )
91 return wfSpecialList( $plink, $nlink );
95 function wfSpecialFewestrevisions() {
96 list( $limit, $offset ) = wfCheckLimits();
97 $frp = new FewestrevisionsPage();
98 $frp->doQuery( $offset, $limit );