SpecialMostrevisions.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * A special page to show pages in the
  4. *
  5. * @ingroup SpecialPage
  6. *
  7. * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
  8. * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
  9. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
  10. */
  11. /**
  12. * @ingroup SpecialPage
  13. */
  14. class MostrevisionsPage extends QueryPage {
  15. function getName() { return 'Mostrevisions'; }
  16. function isExpensive() { return true; }
  17. function isSyndicated() { return false; }
  18. function getSQL() {
  19. $dbr = wfGetDB( DB_SLAVE );
  20. list( $revision, $page ) = $dbr->tableNamesN( 'revision', 'page' );
  21. return
  22. "
  23. SELECT
  24. 'Mostrevisions' as type,
  25. page_namespace as namespace,
  26. page_title as title,
  27. COUNT(*) as value
  28. FROM $revision
  29. JOIN $page ON page_id = rev_page
  30. WHERE page_namespace = " . NS_MAIN . "
  31. GROUP BY page_namespace, page_title
  32. HAVING COUNT(*) > 1
  33. ";
  34. }
  35. function formatResult( $skin, $result ) {
  36. global $wgLang, $wgContLang;
  37. $nt = Title::makeTitle( $result->namespace, $result->title );
  38. $text = $wgContLang->convert( $nt->getPrefixedText() );
  39. $plink = $skin->makeKnownLinkObj( $nt, $text );
  40. $nl = wfMsgExt( 'nrevisions', array( 'parsemag', 'escape'),
  41. $wgLang->formatNum( $result->value ) );
  42. $nlink = $skin->makeKnownLinkObj( $nt, $nl, 'action=history' );
  43. return wfSpecialList($plink, $nlink);
  44. }
  45. }
  46. /**
  47. * constructor
  48. */
  49. function wfSpecialMostrevisions() {
  50. list( $limit, $offset ) = wfCheckLimits();
  51. $wpp = new MostrevisionsPage();
  52. $wpp->doQuery( $offset, $limit );
  53. }