- # Output may contain user-specific data;
- # vary generated content for open sessions on private wikis
- $privateCache = !User::isEveryoneAllowed( 'read' ) && ( $smaxage == 0 || session_id() != '' );
- // Bug 53032 - make this private if user is logged in,
- // so we don't accidentally cache cookies
- $privateCache = $privateCache ?: $this->getUser()->isLoggedIn();
- # allow the client to cache this for 24 hours
+ // Output may contain user-specific data;
+ // vary generated content for open sessions on private wikis
+ $privateCache = !User::isEveryoneAllowed( 'read' ) &&
+ ( $smaxage == 0 || MediaWiki\Session\SessionManager::getGlobalSession()->isPersistent() );
+ // Don't accidentally cache cookies if user is logged in (T55032)
+ $privateCache = $privateCache || $this->getUser()->isLoggedIn();