MediaWiki  1.34.0
SpecialFewestRevisions.php
Go to the documentation of this file.
1 <?php
25 
33  function __construct( $name = 'Fewestrevisions' ) {
34  parent::__construct( $name );
35  }
36 
37  public function isExpensive() {
38  return true;
39  }
40 
41  function isSyndicated() {
42  return false;
43  }
44 
45  public function getQueryInfo() {
46  return [
47  'tables' => [ 'revision', 'page' ],
48  'fields' => [
49  'namespace' => 'page_namespace',
50  'title' => 'page_title',
51  'value' => 'COUNT(*)',
52  ],
53  'conds' => [
54  'page_namespace' => MediaWikiServices::getInstance()->getNamespaceInfo()->
55  getContentNamespaces(),
56  'page_id = rev_page',
57  'page_is_redirect = 0',
58  ],
59  'options' => [
60  'GROUP BY' => [ 'page_namespace', 'page_title' ]
61  ]
62  ];
63  }
64 
65  function sortDescending() {
66  return false;
67  }
68 
74  function formatResult( $skin, $result ) {
75  $nt = Title::makeTitleSafe( $result->namespace, $result->title );
76  if ( !$nt ) {
77  return Html::element(
78  'span',
79  [ 'class' => 'mw-invalidtitle' ],
81  $this->getContext(),
82  $result->namespace,
83  $result->title
84  )
85  );
86  }
87  $linkRenderer = $this->getLinkRenderer();
88  $text = MediaWikiServices::getInstance()->getContentLanguage()->
89  convert( htmlspecialchars( $nt->getPrefixedText() ) );
90  $plink = $linkRenderer->makeLink( $nt, new HtmlArmor( $text ) );
91 
92  $nl = $this->msg( 'nrevisions' )->numParams( $result->value )->text();
93  $redirect = isset( $result->redirect ) && $result->redirect ?
94  ' - ' . $this->msg( 'isredirect' )->escaped() : '';
95  $nlink = $linkRenderer->makeKnownLink(
96  $nt,
97  $nl,
98  [],
99  [ 'action' => 'history' ]
100  ) . $redirect;
101 
102  return $this->getLanguage()->specialList( $plink, $nlink );
103  }
104 
105  protected function getGroupName() {
106  return 'maintenance';
107  }
108 }
SpecialPage\msg
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:792
HtmlArmor
Marks HTML that shouldn't be escaped.
Definition: HtmlArmor.php:28
SpecialFewestRevisions\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialFewestRevisions.php:105
SpecialFewestRevisions\formatResult
formatResult( $skin, $result)
Definition: SpecialFewestRevisions.php:74
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:117
SpecialPage\getLanguage
getLanguage()
Shortcut to get user's language.
Definition: SpecialPage.php:749
Linker\getInvalidTitleDescription
static getInvalidTitleDescription(IContextSource $context, $namespace, $title)
Get a message saying that an invalid title was encountered.
Definition: Linker.php:187
QueryPage
This is a class for doing query pages; since they're almost all the same, we factor out some of the f...
Definition: QueryPage.php:36
SpecialFewestRevisions\__construct
__construct( $name='Fewestrevisions')
Definition: SpecialFewestRevisions.php:33
SpecialPage\getContext
getContext()
Gets the context this SpecialPage is executed in.
Definition: SpecialPage.php:692
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:613
SpecialFewestRevisions
Special page for listing the articles with the fewest revisions.
Definition: SpecialFewestRevisions.php:32
SpecialFewestRevisions\sortDescending
sortDescending()
Override to sort by increasing values.
Definition: SpecialFewestRevisions.php:65
SpecialPage\getLinkRenderer
getLinkRenderer()
Definition: SpecialPage.php:904
SpecialFewestRevisions\isExpensive
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
Definition: SpecialFewestRevisions.php:37
SpecialFewestRevisions\isSyndicated
isSyndicated()
Sometime we don't want to build rss / atom feeds.
Definition: SpecialFewestRevisions.php:41
SpecialPage\$linkRenderer
MediaWiki Linker LinkRenderer null $linkRenderer
Definition: SpecialPage.php:67
SpecialFewestRevisions\getQueryInfo
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
Definition: SpecialFewestRevisions.php:45