Make my last three commits interoperate (display protection expiry on Special:Protect...
[lhc/web/wiklou.git] / includes / SpecialProtectedpages.php
index b66f94e..ceeadce 100644 (file)
@@ -43,8 +43,8 @@ class ProtectedPagesPage extends PageQueryPage {
                $dbr =& wfGetDB( DB_SLAVE );
                list( $page, $page_restrictions ) = $dbr->tableNamesN( 'page', 'page_restrictions' );
                return "SELECT DISTINCT page_id, 'Protectedpages' as type, page_namespace AS namespace, page_title as title, " .
-                       "page_title AS value, pr_level " .
-                       "FROM $page LEFT JOIN $page_restrictions ON page_id = pr_page WHERE pr_level IS NOT NULL ";
+                       "page_title AS value, pr_level, pr_expiry " .
+                       "FROM $page LEFT JOIN $page_restrictions ON page_id = pr_page WHERE pr_level IS NOT NULL AND pr_user IS NULL ";
     }
 
        /**
@@ -59,9 +59,23 @@ class ProtectedPagesPage extends PageQueryPage {
                $title = Title::makeTitleSafe( $result->namespace, $result->title );
                $link = $skin->makeLinkObj( $title );
 
+               $description_items = array ();
+
                $protType = wfMsg( 'restriction-level-' . $result->pr_level );
 
-               return wfSpecialList( $link, $protType );
+               $description_items[] = $protType;
+
+               $expiry_description = '';
+
+               if ( $result->pr_expiry != 'infinity' && strlen($result->pr_expiry) ) {
+                       $expiry = Block::decodeExpiry( $result->pr_expiry );
+       
+                       $expiry_description = wfMsgForContent( 'protect-expiring', $wgLang->timeanddate( $expiry ) );
+
+                       $description_items[] = $expiry_description;
+               }
+
+               return wfSpecialList( $link, implode( $description_items, ', ' ) );
        }
 }