5 * @subpackage SpecialPage
10 * @subpackage SpecialPage
12 class UnusedimagesPage
extends QueryPage
{
15 return 'Unusedimages';
18 function sortDescending() {
21 function isSyndicated() { return false; }
24 global $wgCountCategorizedImagesAsUsed;
25 $dbr =& wfGetDB( DB_SLAVE
);
27 if ( $wgCountCategorizedImagesAsUsed ) {
28 extract( $dbr->tableNames( 'page', 'image', 'imagelinks', 'categorylinks' ) );
30 return 'SELECT img_name as title, img_user, img_user_text, img_timestamp as value, img_description
31 FROM ((('.$page.' AS I LEFT JOIN '.$categorylinks.' AS L ON I.page_id = L.cl_from)
32 LEFT JOIN '.$imagelinks.' AS P ON I.page_title = P.il_to)
33 INNER JOIN '.$image.' AS G ON I.page_title = G.img_name)
34 WHERE I.page_namespace = '.NS_IMAGE
.' AND L.cl_from IS NULL AND P.il_to IS NULL';
36 extract( $dbr->tableNames( 'image','imagelinks' ) );
38 return 'SELECT img_name as title, img_user, img_user_text, img_timestamp as value, img_description' .
39 ' FROM '.$image.' LEFT JOIN '.$imagelinks.' ON img_name=il_to WHERE il_to IS NULL ';
43 function formatResult( $skin, $result ) {
44 global $wgLang, $wgContLang;
45 $title = Title
::makeTitle( NS_IMAGE
, $result->title
);
47 $imageUrl = htmlspecialchars( Image
::imageUrl( $result->title
) );
48 $dirmark = $wgContLang->getDirMark(); // To keep text in correct order
51 # The 'desc' linking to the image page
52 '('.$skin->makeKnownLinkObj( $title, wfMsg('imgdesc') ).') ' . $dirmark .
54 # Link to the image itself
55 '<a href="' . $imageUrl . '">' . htmlspecialchars( $title->getText() ) .
56 '</a> . . ' . $dirmark .
59 $wgLang->timeanddate($result->value
) . ' . . ' . $dirmark .
62 $skin->makeLinkObj( Title
::makeTitle( NS_USER
, $result->img_user_text
),
63 $result->img_user_text
) . $dirmark .
65 # If there is a description, show it
66 $skin->commentBlock( $wgContLang->convert( $result->img_description
) );
71 function getPageHeader() {
72 return wfMsg( "unusedimagestext" );
80 function wfSpecialUnusedimages() {
81 list( $limit, $offset ) = wfCheckLimits();
82 $uip = new UnusedimagesPage();
84 return $uip->doQuery( $offset, $limit );