X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialFewestrevisions.php;h=7e4bc9cee307a49f4b1cad15feae541b1e0b91ef;hb=27757a7fdd3c6ffb56c470af7097c4c28cd4632d;hp=9a8d7c8ce934bae933b36784de54590c8c212eef;hpb=f68b7bddb4e7593cfbb2750805ccb33b2b60c163;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialFewestrevisions.php b/includes/specials/SpecialFewestrevisions.php index 9a8d7c8ce9..7e4bc9cee3 100644 --- a/includes/specials/SpecialFewestrevisions.php +++ b/includes/specials/SpecialFewestrevisions.php @@ -1,5 +1,6 @@ tableNamesN( 'revision', 'page' ); - - return "SELECT 'Fewestrevisions' as type, - page_namespace as namespace, - page_title as title, - page_is_redirect as redirect, - COUNT(*) as value - FROM $revision - JOIN $page ON page_id = rev_page - WHERE page_namespace = " . NS_MAIN . " - GROUP BY page_namespace, page_title, page_is_redirect - HAVING COUNT(*) > 1"; + function getQueryInfo() { + return array ( + 'tables' => array ( 'revision', 'page' ), + 'fields' => array ( 'namespace' => 'page_namespace', + 'title' => 'page_title', + 'value' => 'COUNT(*)', + 'redirect' => 'page_is_redirect' ), + 'conds' => array ( 'page_namespace' => MWNamespace::getContentNamespaces(), + 'page_id = rev_page' ), + 'options' => array ( 'HAVING' => 'COUNT(*) > 1', // ^^^ This was probably here to weed out redirects. // Since we mark them as such now, it might be // useful to remove this. People _do_ create pages // and never revise them, they aren't necessarily // redirects. + 'GROUP BY' => array( 'page_namespace', 'page_title', 'page_is_redirect' ) ) + ); } + function sortDescending() { return false; } + /** + * @param $skin Skin object + * @param $result Object: database row + * @return String + */ function formatResult( $skin, $result ) { - global $wgLang, $wgContLang; + global $wgContLang; $nt = Title::makeTitleSafe( $result->namespace, $result->title ); if( !$nt ) { - return ''; + return Html::element( 'span', array( 'class' => 'mw-invalidtitle' ), + Linker::getInvalidTitleDescription( $this->getContext(), $result->namespace, $result->title ) ); } - $text = $wgContLang->convert( $nt->getPrefixedText() ); - - $plink = $skin->linkKnown( - $nt, - $text - ); + $text = htmlspecialchars( $wgContLang->convert( $nt->getPrefixedText() ) ); + $plink = Linker::linkKnown( $nt, $text ); - $nl = wfMsgExt( 'nrevisions', array( 'parsemag', 'escape' ), - $wgLang->formatNum( $result->value ) ); - $redirect = $result->redirect ? ' - ' . wfMsgHtml( 'isredirect' ) : ''; - $nlink = $skin->linkKnown( + $nl = $this->msg( 'nrevisions' )->numParams( $result->value )->escaped(); + $redirect = isset( $result->redirect ) && $result->redirect ? + ' - ' . $this->msg( 'isredirect' )->escaped() : ''; + $nlink = Linker::linkKnown( $nt, $nl, array(), array( 'action' => 'history' ) ) . $redirect; - return wfSpecialList( $plink, $nlink ); + return $this->getLanguage()->specialList( $plink, $nlink ); } } - -function wfSpecialFewestrevisions() { - list( $limit, $offset ) = wfCheckLimits(); - $frp = new FewestrevisionsPage(); - $frp->doQuery( $offset, $limit ); -}