SpecialMostimages.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * @file
  4. * @ingroup SpecialPage
  5. *
  6. * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
  7. * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
  8. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
  9. */
  10. /**
  11. * implements Special:Mostimages
  12. * @ingroup SpecialPage
  13. */
  14. class MostimagesPage extends ImageQueryPage {
  15. function getName() { return 'Mostimages'; }
  16. function isExpensive() { return true; }
  17. function isSyndicated() { return false; }
  18. function getSQL() {
  19. $dbr = wfGetDB( DB_SLAVE );
  20. $imagelinks = $dbr->tableName( 'imagelinks' );
  21. return
  22. "
  23. SELECT
  24. 'Mostimages' as type,
  25. " . NS_FILE . " as namespace,
  26. il_to as title,
  27. COUNT(*) as value
  28. FROM $imagelinks
  29. GROUP BY il_to
  30. HAVING COUNT(*) > 1
  31. ";
  32. }
  33. function getCellHtml( $row ) {
  34. global $wgLang;
  35. return wfMsgExt( 'nlinks', array( 'parsemag', 'escape' ),
  36. $wgLang->formatNum( $row->value ) ) . '<br />';
  37. }
  38. }
  39. /**
  40. * Constructor
  41. */
  42. function wfSpecialMostimages() {
  43. list( $limit, $offset ) = wfCheckLimits();
  44. $wpp = new MostimagesPage();
  45. $wpp->doQuery( $offset, $limit );
  46. }