]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - includes/specials/SpecialUnusedimages.php
MediaWiki 1.15.0
[autoinstallsdev/mediawiki.git] / includes / specials / SpecialUnusedimages.php
index 4adf405d3e3b1bcdf515acfa80a1569395b6cb90..fa66555d475f56558f3d8296dadd941115165665 100644 (file)
@@ -22,13 +22,17 @@ 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)
@@ -37,14 +41,14 @@ class UnusedimagesPage extends ImageQueryPage {
                } 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' ) );
        }
 
 }