* Appllied patch for bug 1686, image metadata cache by Andrius Ramanauskas.
[mediawiki.git] / includes / SpecialUnusedimages.php
blob6d6cb2fcbdf541ba0afecfee129547e48e7a53b8
1 <?php
2 /**
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
8 /** */
9 require_once("QueryPage.php");
11 /**
12 * @package MediaWiki
13 * @subpackage SpecialPage
15 class UnusedimagesPage extends QueryPage {
17 function getName() {
18 return 'Unusedimages';
21 function sortDescending() {
22 return false;
24 function isSyndicated() { return false; }
26 function getSQL() {
27 $dbr =& wfGetDB( DB_SLAVE );
28 extract( $dbr->tableNames( 'image','imagelinks' ) );
30 return 'SELECT img_name as title, img_user, img_user_text, img_timestamp as value, img_description' .
31 ' FROM '.$image.' LEFT JOIN '.$imagelinks.' ON img_name=il_to WHERE il_to IS NULL ';
34 function formatResult( $skin, $result ) {
35 global $wgLang, $wgContLang;
36 $title = Title::makeTitle( NS_IMAGE, $result->title );
38 $imageUrl = htmlspecialchars( Image::wfImageUrl( $result->title ) );
39 $return =
40 # The 'desc' linking to the image page
41 '('.$skin->makeKnownLinkObj( $title, wfMsg('imgdesc') ).') '
42 # Link to the image itself
43 . '<a href="' . $imageUrl . '">' . htmlspecialchars( $title->getText() ) . '</a>'
44 # Last modified date
45 . ' . . '.$wgLang->timeanddate($result->value)
46 # Link to username
47 . ' . . '.$skin->makeLinkObj( Title::makeTitle( NS_USER, $result->img_user_text ), $result->img_user_text)
48 # If there is a description, show it
49 . $skin->commentBlock( $result->img_description );
51 return $return;
54 function getPageHeader() {
55 return wfMsg( "unusedimagestext" );
60 /**
61 * Entry point
63 function wfSpecialUnusedimages() {
64 list( $limit, $offset ) = wfCheckLimits();
65 $uip = new UnusedimagesPage();
67 return $uip->doQuery( $offset, $limit );