MediaWiki  REL1_24
SpecialUnusedimages.php
Go to the documentation of this file.
00001 <?php
00029 class UnusedimagesPage extends ImageQueryPage {
00030     function __construct( $name = 'Unusedimages' ) {
00031         parent::__construct( $name );
00032     }
00033 
00034     function isExpensive() {
00035         return true;
00036     }
00037 
00038     function sortDescending() {
00039         return false;
00040     }
00041 
00042     function isSyndicated() {
00043         return false;
00044     }
00045 
00046     function getQueryInfo() {
00047         $retval = array(
00048             'tables' => array( 'image', 'imagelinks' ),
00049             'fields' => array(
00050                 'namespace' => NS_FILE,
00051                 'title' => 'img_name',
00052                 'value' => 'img_timestamp',
00053                 'img_user', 'img_user_text',
00054                 'img_description'
00055             ),
00056             'conds' => array( 'il_to IS NULL' ),
00057             'join_conds' => array( 'imagelinks' => array( 'LEFT JOIN', 'il_to = img_name' ) )
00058         );
00059 
00060         if ( $this->getConfig()->get( 'CountCategorizedImagesAsUsed' ) ) {
00061             // Order is significant
00062             $retval['tables'] = array( 'image', 'page', 'categorylinks',
00063                 'imagelinks' );
00064             $retval['conds']['page_namespace'] = NS_FILE;
00065             $retval['conds'][] = 'cl_from IS NULL';
00066             $retval['conds'][] = 'img_name = page_title';
00067             $retval['join_conds']['categorylinks'] = array(
00068                 'LEFT JOIN', 'cl_from = page_id' );
00069             $retval['join_conds']['imagelinks'] = array(
00070                 'LEFT JOIN', 'il_to = page_title' );
00071         }
00072 
00073         return $retval;
00074     }
00075 
00076     function usesTimestamps() {
00077         return true;
00078     }
00079 
00080     function getPageHeader() {
00081         return $this->msg( 'unusedimagestext' )->parseAsBlock();
00082     }
00083 
00084     protected function getGroupName() {
00085         return 'maintenance';
00086     }
00087 }