X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialUnusedimages.php;h=6407de443e18b814562c254ebd6f9df875e0ee4c;hb=7533fc9b2093a9d12a32a578f00a6fe40c05a02a;hp=7827387e87fac59dbfbb82e940c3dbf6f75ed10a;hpb=f68b7bddb4e7593cfbb2750805ccb33b2b60c163;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialUnusedimages.php b/includes/specials/SpecialUnusedimages.php index 7827387e87..6407de443e 100644 --- a/includes/specials/SpecialUnusedimages.php +++ b/includes/specials/SpecialUnusedimages.php @@ -1,5 +1,6 @@ array ( 'image', 'imagelinks' ), + 'fields' => array ( "'" . NS_FILE . "' AS namespace", + 'img_name AS title', + 'img_timestamp AS value', + 'img_user', 'img_user_text', + 'img_description' ), + 'conds' => array ( 'il_to IS NULL' ), + 'join_conds' => array ( 'imagelinks' => array ( + 'LEFT JOIN', 'il_to = img_name' ) ) + ); 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, $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_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, $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 "; + // Order is significant + $retval['tables'] = array ( 'image', 'page', 'categorylinks', + 'imagelinks' ); + $retval['conds']['page_namespace'] = NS_FILE; + $retval['conds'][] = 'cl_from IS NULL'; + $retval['conds'][] = 'img_name = page_title'; + $retval['join_conds']['categorylinks'] = array ( + 'LEFT JOIN', 'cl_from = page_id' ); + $retval['join_conds']['imagelinks'] = array ( + 'LEFT JOIN', 'il_to = page_title' ); } + return $retval; + } + + function usesTimestamps() { + return true; } function getPageHeader() { @@ -80,13 +81,3 @@ class UnusedimagesPage extends ImageQueryPage { } } - -/** - * Entry point - */ -function wfSpecialUnusedimages() { - list( $limit, $offset ) = wfCheckLimits(); - $uip = new UnusedimagesPage(); - - return $uip->doQuery( $offset, $limit ); -}