resourceloader: Unbreak ResourceLoaderImageModule's rasterization
[lhc/web/wiklou.git] / includes / actions / InfoAction.php
index 338d939..203c687 100644 (file)
@@ -64,12 +64,12 @@ class InfoAction extends FormlessAction {
         * @param Title $title Title to clear cache for
         */
        public static function invalidateCache( Title $title ) {
-               global $wgMemc;
-               // Clear page info.
-               $revision = WikiPage::factory( $title )->getRevision();
+               $cache = ObjectCache::getMainWANInstance();
+
+               $revision = Revision::newFromTitle( $title, 0, Revision::READ_LATEST );
                if ( $revision !== null ) {
                        $key = wfMemcKey( 'infoaction', sha1( $title->getPrefixedText() ), $revision->getId() );
-                       $wgMemc->delete( $key );
+                       $cache->delete( $key );
                }
        }
 
@@ -193,7 +193,7 @@ class InfoAction extends FormlessAction {
         * @return array
         */
        protected function pageInfo() {
-               global $wgContLang, $wgMemc;
+               global $wgContLang;
 
                $user = $this->getUser();
                $lang = $this->getLanguage();
@@ -201,16 +201,17 @@ class InfoAction extends FormlessAction {
                $id = $title->getArticleID();
                $config = $this->context->getConfig();
 
+               $cache = ObjectCache::getMainWANInstance();
                $memcKey = wfMemcKey( 'infoaction',
                        sha1( $title->getPrefixedText() ), $this->page->getLatest() );
-               $pageCounts = $wgMemc->get( $memcKey );
+               $pageCounts = $cache->get( $memcKey );
                $version = isset( $pageCounts['cacheversion'] ) ? $pageCounts['cacheversion'] : false;
                if ( $pageCounts === false || $version !== self::CACHE_VERSION ) {
                        // Get page information that would be too "expensive" to retrieve by normal means
                        $pageCounts = $this->pageCounts( $title );
                        $pageCounts['cacheversion'] = self::CACHE_VERSION;
 
-                       $wgMemc->set( $memcKey, $pageCounts );
+                       $cache->set( $memcKey, $pageCounts );
                }
 
                // Get page properties
@@ -373,18 +374,30 @@ class InfoAction extends FormlessAction {
 
                if ( $title->inNamespace( NS_CATEGORY ) ) {
                        $category = Category::newFromTitle( $title );
+
+                       // $allCount is the total number of cat members,
+                       // not the count of how many members are normal pages.
+                       $allCount = (int)$category->getPageCount();
+                       $subcatCount = (int)$category->getSubcatCount();
+                       $fileCount = (int)$category->getFileCount();
+                       $pagesCount = $allCount - $subcatCount - $fileCount;
+
                        $pageInfo['category-info'] = array(
+                               array(
+                                       $this->msg( 'pageinfo-category-total' ),
+                                       $lang->formatNum( $allCount )
+                               ),
                                array(
                                        $this->msg( 'pageinfo-category-pages' ),
-                                       $lang->formatNum( $category->getPageCount() )
+                                       $lang->formatNum( $pagesCount )
                                ),
                                array(
                                        $this->msg( 'pageinfo-category-subcats' ),
-                                       $lang->formatNum( $category->getSubcatCount() )
+                                       $lang->formatNum( $subcatCount )
                                ),
                                array(
                                        $this->msg( 'pageinfo-category-files' ),
-                                       $lang->formatNum( $category->getFileCount() )
+                                       $lang->formatNum( $fileCount )
                                )
                        );
                }
@@ -434,6 +447,9 @@ class InfoAction extends FormlessAction {
                                        $message = $message->escaped();
                                }
                        }
+                       $expiry = $title->getRestrictionExpiry( $restrictionType );
+                       $formattedexpiry = $this->msg( 'parentheses', $this->getLanguage()->formatExpiry( $expiry ) )->escaped();
+                       $message .= $this->msg( 'word-separator' )->escaped() . $formattedexpiry;
 
                        // Messages: restriction-edit, restriction-move, restriction-create,
                        // restriction-upload