MediaWiki REL1_31
SpecialListDuplicatedFiles.php
Go to the documentation of this file.
1<?php
29
36 function __construct( $name = 'ListDuplicatedFiles' ) {
37 parent::__construct( $name );
38 }
39
40 public function isExpensive() {
41 return true;
42 }
43
44 function isSyndicated() {
45 return false;
46 }
47
59 public function getQueryInfo() {
60 return [
61 'tables' => [ 'image' ],
62 'fields' => [
63 'namespace' => NS_FILE,
64 'title' => 'MIN(img_name)',
65 'value' => 'count(*)'
66 ],
67 'options' => [
68 'GROUP BY' => 'img_sha1',
69 'HAVING' => 'count(*) > 1',
70 ],
71 ];
72 }
73
80 function preprocessResults( $db, $res ) {
82 }
83
89 function formatResult( $skin, $result ) {
90 // Future version might include a list of the first 5 duplicates
91 // perhaps separated by an "↔".
92 $image1 = Title::makeTitle( $result->namespace, $result->title );
93 $dupeSearch = SpecialPage::getTitleFor( 'FileDuplicateSearch', $image1->getDBkey() );
94
95 $msg = $this->msg( 'listduplicatedfiles-entry' )
96 ->params( $image1->getText() )
97 ->numParams( $result->value - 1 )
98 ->params( $dupeSearch->getPrefixedDBkey() );
99
100 return $msg->parse();
101 }
102
103 protected function getGroupName() {
104 return 'media';
105 }
106}
Special:ListDuplicatedFiles Lists all files where the current version is a duplicate of the current v...
__construct( $name='ListDuplicatedFiles')
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
isSyndicated()
Sometime we don't want to build rss / atom feeds.
getQueryInfo()
Get all the duplicates by grouping on sha1s.
preprocessResults( $db, $res)
Pre-fill the link cache.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
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:34
executeLBFromResultWrapper(IResultWrapper $res, $ns=null)
Creates a new LinkBatch object, adds all pages from the passed ResultWrapper (MUST include title and ...
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
msg( $key)
Wrapper around wfMessage that sets the current context.
$res
Definition database.txt:21
const NS_FILE
Definition Defines.php:80
Basic database interface for live and lazy-loaded relation database handles.
Definition IDatabase.php:38
Result wrapper for grabbing data queried from an IDatabase object.