MediaWiki  REL1_19
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 ( "'" . NS_FILE . "' AS namespace",
00051                                         'img_name AS title',
00052                                         'img_timestamp AS value',
00053                                         'img_user', 'img_user_text',
00054                                         'img_description' ),
00055                         'conds' => array ( 'il_to IS NULL' ),
00056                         'join_conds' => array ( 'imagelinks' => array (
00057                                         'LEFT JOIN', 'il_to = img_name' ) )
00058                 );
00059 
00060                 if ( $wgCountCategorizedImagesAsUsed ) {
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                 return $retval;
00073         }
00074 
00075         function usesTimestamps() {
00076                 return true;
00077         }
00078 
00079         function getPageHeader() {
00080                 return wfMsgExt( 'unusedimagestext', array( 'parse' ) );
00081         }
00082 
00083 }