Merge "Special:Contributions: Drop 'newbies' feature"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 27 Aug 2019 19:45:27 +0000 (19:45 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 27 Aug 2019 19:45:27 +0000 (19:45 +0000)
RELEASE-NOTES-1.34
docs/memcached.txt
includes/DefaultSettings.php
includes/ServiceWiring.php
includes/WebStart.php
includes/api/ApiQueryImageInfo.php
includes/cache/MessageCache.php
includes/gallery/ImageGalleryBase.php

index 0f8085b..b9451ee 100644 (file)
@@ -75,6 +75,8 @@ For notes on 1.33.x and older releases, see HISTORY.
 * $wgDebugPrintHttpHeaders - The default of including HTTP headers in the
   debug log channel is no longer configurable. The debug log itself remains
   configurable via $wgDebugLogFile.
+* $wgMsgCacheExpiry - The MessageCache uses 24 hours as the expiry for values
+  stored in WANObjectCache. This is no longer configurable.
 * $wgPasswordSalt – This setting, used for migrating exceptionally old, insecure
   password setups and deprecated since 1.24, is now removed.
 * $wgDBOracleDRCP - If you must use persistent connections, set DBO_PERSISTENT
index ba325fe..d0a6e3d 100644 (file)
@@ -131,13 +131,7 @@ Localisation:
        cleared by: Language::loadLocalisation()
 
 Message Cache:
-       backend: $wgMessageCacheType
-       key: $wgDBname:messages, $wgDBname:messages-hash, $wgDBname:messages-status
-       ex: wikidb:messages, wikidb:messages-hash, wikidb:messages-status
-       stores: an array where the keys are DB keys and the values are messages
-       set in: wfMessage(), Article::editUpdates() and Title::moveTo()
-       expiry: $wgMsgCacheExpiry
-       cleared by: nothing
+       See MessageCache.php.
 
 Newtalk:
        key: $wgDBname:newtalk:ip:$ip
index 7e13fc2..35e8ae5 100644 (file)
@@ -3118,11 +3118,6 @@ $wgTranslateNumerals = true;
  */
 $wgUseDatabaseMessages = true;
 
-/**
- * Expiry time for the message cache key
- */
-$wgMsgCacheExpiry = 86400;
-
 /**
  * Maximum entry size in the message cache, in bytes
  */
index cc68cb6..1acd038 100644 (file)
@@ -354,7 +354,6 @@ return [
                                ? $services->getLocalServerObjectCache()
                                : new EmptyBagOStuff(),
                        $mainConfig->get( 'UseDatabaseMessages' ),
-                       $mainConfig->get( 'MsgCacheExpiry' ),
                        $services->getContentLanguage()
                );
        },
index c83fdea..9573091 100644 (file)
@@ -91,17 +91,20 @@ if ( !defined( 'MW_API' ) &&
        header( 'Cache-Control: no-cache' );
        header( 'Content-Type: text/html; charset=utf-8' );
        HttpStatus::header( 400 );
-       $error = wfMessage( 'nonwrite-api-promise-error' )->escaped();
-       $content = <<<EOT
+       $errorHtml = wfMessage( 'nonwrite-api-promise-error' )
+               ->useDatabase( false )
+               ->inContentLanguage()
+               ->escaped();
+       $content = <<<HTML
 <!DOCTYPE html>
 <html>
 <head><meta charset="UTF-8" /></head>
 <body>
-$error
+$errorHtml
 </body>
 </html>
 
-EOT;
+HTML;
        header( 'Content-Length: ' . strlen( $content ) );
        echo $content;
        die();
index b97ab3c..5e737c3 100644 (file)
@@ -63,7 +63,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
                                $this->dieWithError( [ 'apierror-bad-badfilecontexttitle', $p ], 'invalid-title' );
                        }
                } else {
-                       $badFileContextTitle = false;
+                       $badFileContextTitle = null;
                }
 
                $pageIds = $this->getPageSet()->getGoodAndMissingTitlesByNamespace();
index 93fdb16..661ab87 100644 (file)
@@ -45,6 +45,12 @@ class MessageCache {
        /** How long memcached locks last */
        const LOCK_TTL = 30;
 
+       /**
+        * Lifetime for cache, for keys stored in $wanCache, in seconds.
+        * @var int
+        */
+       const WAN_TTL = IExpiringStore::TTL_DAY;
+
        /**
         * Process cache of loaded messages that are defined in MediaWiki namespace
         *
@@ -70,12 +76,6 @@ class MessageCache {
         */
        protected $mDisable;
 
-       /**
-        * Lifetime for cache, used by object caching.
-        * Set on construction, see __construct().
-        */
-       protected $mExpiry;
-
        /**
         * Message cache has its own parser which it uses to transform messages
         * @var ParserOptions
@@ -137,7 +137,6 @@ class MessageCache {
         * @param BagOStuff $clusterCache
         * @param BagOStuff $serverCache
         * @param bool $useDB Whether to look for message overrides (e.g. MediaWiki: pages)
-        * @param int $expiry Lifetime for cache. @see $mExpiry.
         * @param Language|null $contLang Content language of site
         */
        public function __construct(
@@ -145,7 +144,6 @@ class MessageCache {
                BagOStuff $clusterCache,
                BagOStuff $serverCache,
                $useDB,
-               $expiry,
                Language $contLang = null
        ) {
                $this->wanCache = $wanCache;
@@ -155,7 +153,6 @@ class MessageCache {
                $this->cache = new MapCacheLRU( 5 ); // limit size for sanity
 
                $this->mDisable = !$useDB;
-               $this->mExpiry = $expiry;
                $this->contLang = $contLang ?? MediaWikiServices::getInstance()->getContentLanguage();
        }
 
@@ -551,7 +548,7 @@ class MessageCache {
                # messages larger than $wgMaxMsgCacheEntrySize, since those are only
                # stored and fetched from memcache.
                $cache['HASH'] = md5( serialize( $cache ) );
-               $cache['EXPIRY'] = wfTimestamp( TS_MW, time() + $this->mExpiry );
+               $cache['EXPIRY'] = wfTimestamp( TS_MW, time() + self::WAN_TTL );
                unset( $cache['EXCESSIVE'] ); // only needed for hash
 
                return $cache;
@@ -666,7 +663,7 @@ class MessageCache {
                        $this->wanCache->set(
                                $this->bigMessageCacheKey( $cache['HASH'], $title ),
                                ' ' . $newTextByTitle[$title],
-                               $this->mExpiry
+                               self::WAN_TTL
                        );
                }
                // Mark this cache as definitely being "latest" (non-volatile) so
@@ -1090,11 +1087,11 @@ class MessageCache {
                $fname = __METHOD__;
                return $this->srvCache->getWithSetCallback(
                        $this->srvCache->makeKey( 'messages-big', $hash, $dbKey ),
-                       IExpiringStore::TTL_MINUTE,
+                       BagOStuff::TTL_MINUTE,
                        function () use ( $code, $dbKey, $hash, $fname ) {
                                return $this->wanCache->getWithSetCallback(
                                        $this->bigMessageCacheKey( $hash, $dbKey ),
-                                       $this->mExpiry,
+                                       self::WAN_TTL,
                                        function ( $oldValue, &$ttl, &$setOpts ) use ( $dbKey, $code, $fname ) {
                                                // Try loading the message from the database
                                                $dbr = wfGetDB( DB_REPLICA );
index 06e1271..991ef79 100644 (file)
@@ -80,10 +80,10 @@ abstract class ImageGalleryBase extends ContextSource {
        public $mParser;
 
        /**
-        * @var Title Contextual title, used when images are being screened against
+        * @var Title|null Contextual title, used when images are being screened against
         *   the bad image list
         */
-       protected $contextTitle = false;
+       protected $contextTitle = null;
 
        /** @var array */
        protected $mAttribs = [];
@@ -363,7 +363,7 @@ abstract class ImageGalleryBase extends ContextSource {
        /**
         * Set the contextual title
         *
-        * @param Title $title Contextual title
+        * @param Title|null $title Contextual title
         */
        public function setContextTitle( $title ) {
                $this->contextTitle = $title;
@@ -372,12 +372,10 @@ abstract class ImageGalleryBase extends ContextSource {
        /**
         * Get the contextual title, if applicable
         *
-        * @return Title|bool Title or false
+        * @return Title|null
         */
        public function getContextTitle() {
-               return is_object( $this->contextTitle ) && $this->contextTitle instanceof Title
-                       ? $this->contextTitle
-                       : false;
+               return $this->contextTitle;
        }
 
        /**