SpecialLonelypages.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * @file
  4. * @ingroup SpecialPage
  5. */
  6. /**
  7. * A special page looking for articles with no article linking to them,
  8. * thus being lonely.
  9. * @ingroup SpecialPage
  10. */
  11. class LonelyPagesPage extends PageQueryPage {
  12. function getName() {
  13. return "Lonelypages";
  14. }
  15. function getPageHeader() {
  16. return wfMsgExt( 'lonelypagestext', array( 'parse' ) );
  17. }
  18. function sortDescending() {
  19. return false;
  20. }
  21. function isExpensive() {
  22. return true;
  23. }
  24. function isSyndicated() { return false; }
  25. function getSQL() {
  26. $dbr = wfGetDB( DB_SLAVE );
  27. list( $page, $pagelinks, $templatelinks ) = $dbr->tableNamesN( 'page', 'pagelinks', 'templatelinks' );
  28. return
  29. "SELECT 'Lonelypages' AS type,
  30. page_namespace AS namespace,
  31. page_title AS title,
  32. page_title AS value
  33. FROM $page
  34. LEFT JOIN $pagelinks
  35. ON page_namespace=pl_namespace AND page_title=pl_title
  36. LEFT JOIN $templatelinks
  37. ON page_namespace=tl_namespace AND page_title=tl_title
  38. WHERE pl_namespace IS NULL
  39. AND page_namespace=".NS_MAIN."
  40. AND page_is_redirect=0
  41. AND tl_namespace IS NULL";
  42. }
  43. }
  44. /**
  45. * Constructor
  46. */
  47. function wfSpecialLonelypages() {
  48. list( $limit, $offset ) = wfCheckLimits();
  49. $lpp = new LonelyPagesPage();
  50. return $lpp->doQuery( $offset, $limit );
  51. }