page: Avoid deprecated wfMemcKey()
authorKunal Mehta <legoktm@member.fsf.org>
Thu, 25 May 2017 07:47:27 +0000 (00:47 -0700)
committerKunal Mehta <legoktm@member.fsf.org>
Thu, 25 May 2017 18:20:23 +0000 (11:20 -0700)
And the deprecated ObjectCache::getMainWANInstance(),
getMainStashInstance() while we're at it.

Change-Id: I951c356f1c394a9658216dea54c92824dca83cbc

includes/page/Article.php
includes/page/WikiPage.php

index 3c767f5..dd54232 100644 (file)
@@ -980,8 +980,8 @@ class Article implements Page {
                }
 
                // Check for cached results
-               $key = wfMemcKey( 'unpatrollable-page', $title->getArticleID() );
-               $cache = ObjectCache::getMainWANInstance();
+               $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
+               $key = $cache->makeKey( 'unpatrollable-page', $title->getArticleID() );
                if ( $cache->get( $key ) ) {
                        return false;
                }
@@ -1121,8 +1121,8 @@ class Article implements Page {
         * @since 1.27
         */
        public static function purgePatrolFooterCache( $articleID ) {
-               $cache = ObjectCache::getMainWANInstance();
-               $cache->delete( wfMemcKey( 'unpatrollable-page', $articleID ) );
+               $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
+               $cache->delete( $cache->makeKey( 'unpatrollable-page', $articleID ) );
        }
 
        /**
@@ -1177,8 +1177,8 @@ class Article implements Page {
                # Show delete and move logs if there were any such events.
                # The logging query can DOS the site when bots/crawlers cause 404 floods,
                # so be careful showing this. 404 pages must be cheap as they are hard to cache.
-               $cache = ObjectCache::getMainStashInstance();
-               $key = wfMemcKey( 'page-recent-delete', md5( $title->getPrefixedText() ) );
+               $cache = MediaWikiServices::getInstance()->getMainObjectStash();
+               $key = $cache->makeKey( 'page-recent-delete', md5( $title->getPrefixedText() ) );
                $loggedIn = $this->getContext()->getUser()->isLoggedIn();
                if ( $loggedIn || $cache->get( $key ) ) {
                        $logTypes = [ 'delete', 'move' ];
index a687900..e535617 100644 (file)
@@ -2901,8 +2901,8 @@ class WikiPage implements Page, IDBAccessObject {
                $status->value = $logid;
 
                // Show log excerpt on 404 pages rather than just a link
-               $cache = ObjectCache::getMainStashInstance();
-               $key = wfMemcKey( 'page-recent-delete', md5( $logTitle->getPrefixedText() ) );
+               $cache = MediaWikiServices::getInstance()->getMainObjectStash();
+               $key = $cache->makeKey( 'page-recent-delete', md5( $logTitle->getPrefixedText() ) );
                $cache->set( $key, 1, $cache::TTL_DAY );
 
                return $status;