From: Umherirrender Date: Sun, 30 Sep 2018 15:06:53 +0000 (+0200) Subject: Fix logged method in MessageCache::replace/loadCachedMessagePageEntry X-Git-Tag: 1.34.0-rc.0~3947 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/membres//%22%7B%24url%7D?a=commitdiff_plain;h=173df1768be5cbc8205208511282d6a6926b9856;p=lhc%2Fweb%2Fwiklou.git Fix logged method in MessageCache::replace/loadCachedMessagePageEntry Seeing {closure} in the logs as caller is not helpful Change-Id: Iddfb6042bba2a59a9f21f533b748c96478a87b97 --- diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index 7a1b988643..aa929bcbbc 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -582,10 +582,11 @@ class MessageCache { // Ignore $wgMaxMsgCacheEntrySize so the process cache is up to date $this->cache->setField( $code, $title, ' ' . $text ); } + $fname = __METHOD__; // (b) Update the shared caches in a deferred update with a fresh DB snapshot DeferredUpdates::addCallableUpdate( - function () use ( $title, $msg, $code ) { + function () use ( $title, $msg, $code, $fname ) { global $wgMaxMsgCacheEntrySize; // Allow one caller at a time to avoid race conditions $scopedLock = $this->getReentrantScopedLock( @@ -593,7 +594,7 @@ class MessageCache { ); if ( !$scopedLock ) { LoggerFactory::getInstance( 'MessageCache' )->error( - __METHOD__ . ': could not acquire lock to update {title} ({code})', + $fname . ': could not acquire lock to update {title} ({code})', [ 'title' => $title, 'code' => $code ] ); return; } @@ -1029,14 +1030,15 @@ class MessageCache { * @return string Either " " or "!NONEXISTANT" */ private function loadCachedMessagePageEntry( $dbKey, $code, $hash ) { + $fname = __METHOD__; return $this->srvCache->getWithSetCallback( $this->srvCache->makeKey( 'messages-big', $hash, $dbKey ), IExpiringStore::TTL_MINUTE, - function () use ( $code, $dbKey, $hash ) { + function () use ( $code, $dbKey, $hash, $fname ) { return $this->wanCache->getWithSetCallback( $this->bigMessageCacheKey( $hash, $dbKey ), $this->mExpiry, - function ( $oldValue, &$ttl, &$setOpts ) use ( $dbKey, $code ) { + function ( $oldValue, &$ttl, &$setOpts ) use ( $dbKey, $code, $fname ) { // Try loading the message from the database $dbr = wfGetDB( DB_REPLICA ); $setOpts += Database::getCacheSetOptions( $dbr ); @@ -1053,7 +1055,7 @@ class MessageCache { $message = $this->getMessageTextFromContent( $content ); } else { LoggerFactory::getInstance( 'MessageCache' )->warning( - __METHOD__ . ': failed to load page text for \'{titleKey}\'', + $fname . ': failed to load page text for \'{titleKey}\'', [ 'titleKey' => $dbKey, 'code' => $code ] ); $message = null;