MediaWiki  REL1_23
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         global $wgCountCategorizedImagesAsUsed;
00048         $retval = array(
00049             'tables' => array( 'image', 'imagelinks' ),
00050             'fields' => array(
00051                 'namespace' => NS_FILE,
00052                 'title' => 'img_name',
00053                 'value' => 'img_timestamp',
00054                 'img_user', 'img_user_text',
00055                 'img_description'
00056             ),
00057             'conds' => array( 'il_to IS NULL' ),
00058             'join_conds' => array( 'imagelinks' => array( 'LEFT JOIN', 'il_to = img_name' ) )
00059         );
00060 
00061         if ( $wgCountCategorizedImagesAsUsed ) {
00062             // Order is significant
00063             $retval['tables'] = array( 'image', 'page', 'categorylinks',
00064                 'imagelinks' );
00065             $retval['conds']['page_namespace'] = NS_FILE;
00066             $retval['conds'][] = 'cl_from IS NULL';
00067             $retval['conds'][] = 'img_name = page_title';
00068             $retval['join_conds']['categorylinks'] = array(
00069                 'LEFT JOIN', 'cl_from = page_id' );
00070             $retval['join_conds']['imagelinks'] = array(
00071                 'LEFT JOIN', 'il_to = page_title' );
00072         }
00073 
00074         return $retval;
00075     }
00076 
00077     function usesTimestamps() {
00078         return true;
00079     }
00080 
00081     function getPageHeader() {
00082         return $this->msg( 'unusedimagestext' )->parseAsBlock();
00083     }
00084 
00085     protected function getGroupName() {
00086         return 'maintenance';
00087     }
00088 }