2004-02-18 02:15:00 +00:00
|
|
|
<?php
|
2010-06-21 12:59:04 +00:00
|
|
|
/**
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
2010-06-21 13:16:32 +00:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2010-06-21 12:59:04 +00:00
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
2010-08-15 07:16:58 +00:00
|
|
|
*
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
* @file
|
2004-09-02 23:28:24 +00:00
|
|
|
*/
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2023-09-13 16:09:30 +00:00
|
|
|
namespace MediaWiki\Specials;
|
|
|
|
|
|
2022-04-13 15:28:26 +00:00
|
|
|
use MediaWiki\MainConfigNames;
|
2023-09-15 09:32:18 +00:00
|
|
|
use MediaWiki\SpecialPage\ImageQueryPage;
|
2023-04-19 15:35:34 +00:00
|
|
|
use Wikimedia\Rdbms\IConnectionProvider;
|
2020-10-21 19:33:52 +00:00
|
|
|
|
2004-09-02 23:28:24 +00:00
|
|
|
/**
|
2024-05-13 20:18:10 +00:00
|
|
|
* List of unused images
|
2010-08-15 07:16:58 +00:00
|
|
|
*
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
* @ingroup SpecialPage
|
2004-09-02 23:28:24 +00:00
|
|
|
*/
|
2019-04-14 15:14:22 +00:00
|
|
|
class SpecialUnusedImages extends ImageQueryPage {
|
2020-10-21 19:33:52 +00:00
|
|
|
|
|
|
|
|
/**
|
2023-04-19 15:35:34 +00:00
|
|
|
* @param IConnectionProvider $dbProvider
|
2020-10-21 19:33:52 +00:00
|
|
|
*/
|
2023-04-19 15:35:34 +00:00
|
|
|
public function __construct( IConnectionProvider $dbProvider ) {
|
2020-10-21 19:33:52 +00:00
|
|
|
parent::__construct( 'Unusedimages' );
|
2023-04-19 15:35:34 +00:00
|
|
|
$this->setDatabaseProvider( $dbProvider );
|
2004-09-19 21:36:55 +00:00
|
|
|
}
|
2011-03-18 20:37:11 +00:00
|
|
|
|
2020-05-18 00:17:37 +00:00
|
|
|
public function isExpensive() {
|
2010-12-22 14:16:25 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
2011-03-18 20:37:11 +00:00
|
|
|
|
2020-05-18 00:17:37 +00:00
|
|
|
protected function sortDescending() {
|
2004-09-19 21:36:55 +00:00
|
|
|
return false;
|
|
|
|
|
}
|
2011-03-18 20:37:11 +00:00
|
|
|
|
2020-05-18 00:17:37 +00:00
|
|
|
public function isSyndicated() {
|
2010-12-22 14:16:25 +00:00
|
|
|
return false;
|
|
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2020-05-18 00:17:37 +00:00
|
|
|
public function getQueryInfo() {
|
2016-02-17 09:09:32 +00:00
|
|
|
$retval = [
|
|
|
|
|
'tables' => [ 'image', 'imagelinks' ],
|
|
|
|
|
'fields' => [
|
2014-03-22 22:51:18 +00:00
|
|
|
'namespace' => NS_FILE,
|
|
|
|
|
'title' => 'img_name',
|
|
|
|
|
'value' => 'img_timestamp',
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
2023-07-17 20:17:57 +00:00
|
|
|
'conds' => [ 'il_to' => null ],
|
2016-02-17 09:09:32 +00:00
|
|
|
'join_conds' => [ 'imagelinks' => [ 'LEFT JOIN', 'il_to = img_name' ] ]
|
|
|
|
|
];
|
2009-02-21 17:30:59 +00:00
|
|
|
|
2022-04-13 15:28:26 +00:00
|
|
|
if ( $this->getConfig()->get( MainConfigNames::CountCategorizedImagesAsUsed ) ) {
|
2010-12-22 14:16:25 +00:00
|
|
|
// Order is significant
|
2016-02-17 09:09:32 +00:00
|
|
|
$retval['tables'] = [ 'image', 'page', 'categorylinks',
|
|
|
|
|
'imagelinks' ];
|
2010-12-22 14:16:25 +00:00
|
|
|
$retval['conds']['page_namespace'] = NS_FILE;
|
2023-07-17 20:17:57 +00:00
|
|
|
$retval['conds']['cl_from'] = null;
|
2010-12-22 14:16:25 +00:00
|
|
|
$retval['conds'][] = 'img_name = page_title';
|
2016-02-17 09:09:32 +00:00
|
|
|
$retval['join_conds']['categorylinks'] = [
|
|
|
|
|
'LEFT JOIN', 'cl_from = page_id' ];
|
|
|
|
|
$retval['join_conds']['imagelinks'] = [
|
|
|
|
|
'LEFT JOIN', 'il_to = page_title' ];
|
2005-04-15 21:49:21 +00:00
|
|
|
}
|
2014-03-22 22:51:18 +00:00
|
|
|
|
2010-12-22 14:16:25 +00:00
|
|
|
return $retval;
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-18 01:16:17 +00:00
|
|
|
public function usesTimestamps() {
|
2010-12-22 14:16:25 +00:00
|
|
|
return true;
|
2004-09-19 21:36:55 +00:00
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2020-05-18 00:17:37 +00:00
|
|
|
protected function getPageHeader() {
|
2022-04-13 15:28:26 +00:00
|
|
|
if ( $this->getConfig()->get( MainConfigNames::CountCategorizedImagesAsUsed ) ) {
|
2018-12-07 21:00:40 +00:00
|
|
|
return $this->msg(
|
|
|
|
|
'unusedimagestext-categorizedimgisused'
|
|
|
|
|
)->parseAsBlock();
|
|
|
|
|
}
|
2012-02-16 17:12:20 +00:00
|
|
|
return $this->msg( 'unusedimagestext' )->parseAsBlock();
|
2004-09-19 21:36:55 +00:00
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
|
2013-03-07 20:15:54 +00:00
|
|
|
protected function getGroupName() {
|
|
|
|
|
return 'maintenance';
|
|
|
|
|
}
|
2004-09-19 21:36:55 +00:00
|
|
|
}
|
2023-09-13 16:09:30 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Retain the old class name for backwards compatibility.
|
|
|
|
|
* @deprecated since 1.41
|
|
|
|
|
*/
|
|
|
|
|
class_alias( SpecialUnusedImages::class, 'SpecialUnusedImages' );
|