MediaWiki REL1_34
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 public function execute( $par ) {
104 $this->addHelpLink( 'Help:Managing_files' );
105 parent::execute( $par );
106 }
107
108 protected function getGroupName() {
109 return 'media';
110 }
111}
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
executeLBFromResultWrapper(IResultWrapper $res, $ns=null)
Creates a new LinkBatch object, adds all pages from the passed result wrapper (MUST include title and...
Special:ListDuplicatedFiles Lists all files where the current version is a duplicate of the current v...
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
execute( $par)
This is the actual workhorse.
preprocessResults( $db, $res)
Pre-fill the link cache.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
isSyndicated()
Sometime we don't want to build rss / atom feeds.
getQueryInfo()
Get all the duplicates by grouping on sha1s.
__construct( $name='ListDuplicatedFiles')
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,... $params)
Wrapper around wfMessage that sets the current context.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
const NS_FILE
Definition Defines.php:75
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.