Change User::isAnon to !User::isRegistered in PageEditStash
Also use another variable for the full user object to make clear which parts needs it and which part is fine with an UserIdentity Change-Id: I8422159a462cc54b54006a44e7b46079919691ad
This commit is contained in:
parent
2ae3e55f64
commit
5018000e35
1 changed files with 7 additions and 7 deletions
|
|
@ -213,18 +213,18 @@ class PageEditStash {
|
|||
*
|
||||
* @param PageIdentity $page
|
||||
* @param Content $content
|
||||
* @param UserIdentity $useridentity to get parser options from
|
||||
* @return stdClass|bool Returns edit stash object or false on cache miss
|
||||
* @param UserIdentity $user to get parser options from
|
||||
* @return stdClass|false Returns edit stash object or false on cache miss
|
||||
*/
|
||||
public function checkCache( PageIdentity $page, Content $content, UserIdentity $useridentity ) {
|
||||
$user = $this->userFactory->newFromUserIdentity( $useridentity );
|
||||
public function checkCache( PageIdentity $page, Content $content, UserIdentity $user ) {
|
||||
$legacyUser = $this->userFactory->newFromUserIdentity( $user );
|
||||
if (
|
||||
// The context is not an HTTP POST request
|
||||
!$user->getRequest()->wasPosted() ||
|
||||
!$legacyUser->getRequest()->wasPosted() ||
|
||||
// The context is a CLI script or a job runner HTTP POST request
|
||||
$this->initiator !== self::INITIATOR_USER ||
|
||||
// The editor account is a known bot
|
||||
$user->isBot()
|
||||
$legacyUser->isBot()
|
||||
) {
|
||||
// Avoid wasted queries and statsd pollution
|
||||
return false;
|
||||
|
|
@ -259,7 +259,7 @@ class PageEditStash {
|
|||
// Assume nothing changed in this time
|
||||
$this->incrStatsByContent( 'cache_hits.presumed_fresh', $content );
|
||||
$logger->debug( "Timestamp-based cache hit for key '{key}'.", $logContext );
|
||||
} elseif ( $user->isAnon() ) {
|
||||
} elseif ( !$user->isRegistered() ) {
|
||||
$lastEdit = $this->lastEditTime( $user );
|
||||
$cacheTime = $editInfo->output->getCacheTime();
|
||||
if ( $lastEdit < $cacheTime ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue