X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialUnusedimages.php;h=fa66555d475f56558f3d8296dadd941115165665;hb=ec0dd5b272c193d4641d9a265fe4937628a61ffd;hp=d71b638fa585a9f7fdf5a8c8d03efa5842d2df8d;hpb=660a5eb7aa6112a5138c7c66721d667d88c2df0f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialUnusedimages.php b/includes/specials/SpecialUnusedimages.php index d71b638fa5..fa66555d47 100644 --- a/includes/specials/SpecialUnusedimages.php +++ b/includes/specials/SpecialUnusedimages.php @@ -22,29 +22,33 @@ class UnusedimagesPage extends ImageQueryPage { function isSyndicated() { return false; } function getSQL() { - global $wgCountCategorizedImagesAsUsed; + global $wgCountCategorizedImagesAsUsed, $wgDBtype; $dbr = wfGetDB( DB_SLAVE ); + $epoch = $wgDBtype == 'mysql' ? + 'UNIX_TIMESTAMP(img_timestamp)' : + 'EXTRACT(epoch FROM img_timestamp)'; + if ( $wgCountCategorizedImagesAsUsed ) { list( $page, $image, $imagelinks, $categorylinks ) = $dbr->tableNamesN( 'page', 'image', 'imagelinks', 'categorylinks' ); - return "SELECT 'Unusedimages' as type, 6 as namespace, img_name as title, img_timestamp as value, + return "SELECT 'Unusedimages' as type, 6 as namespace, img_name as title, $epoch as value, img_user, img_user_text, img_description FROM ((($page AS I LEFT JOIN $categorylinks AS L ON I.page_id = L.cl_from) LEFT JOIN $imagelinks AS P ON I.page_title = P.il_to) INNER JOIN $image AS G ON I.page_title = G.img_name) - WHERE I.page_namespace = ".NS_IMAGE." AND L.cl_from IS NULL AND P.il_to IS NULL"; + WHERE I.page_namespace = ".NS_FILE." AND L.cl_from IS NULL AND P.il_to IS NULL"; } else { list( $image, $imagelinks ) = $dbr->tableNamesN( 'image','imagelinks' ); - return "SELECT 'Unusedimages' as type, 6 as namespace, img_name as title, img_timestamp as value, + return "SELECT 'Unusedimages' as type, 6 as namespace, img_name as title, $epoch as value, img_user, img_user_text, img_description FROM $image LEFT JOIN $imagelinks ON img_name=il_to WHERE il_to IS NULL "; } } function getPageHeader() { - return wfMsgExt( 'unusedimagestext', array( 'parse') ); + return wfMsgExt( 'unusedimagestext', array( 'parse' ) ); } }