const MODE_OUTAGE = 1; // fallback cache for DB outages
const MODE_REBUILD = 2; // background cache rebuild mode
- /**
- * Construct an HTMLFileCache object from a Title and an action
- *
- * @deprecated since 1.24, instantiate this class directly
- * @param Title|string $title Title object or prefixed DB key string
- * @param string $action
- * @throws MWException
- * @return HTMLFileCache
- */
- public static function newFromTitle( $title, $action ) {
- return new self( $title, $action );
- }
-
/**
* @param Title|string $title Title object or prefixed DB key string
* @param string $action
/**
* Check if pages can be cached for this request/user
* @param IContextSource $context
- * @param integer $mode One of the HTMLFileCache::MODE_* constants (since 1.28)
+ * @param int $mode One of the HTMLFileCache::MODE_* constants (since 1.28)
* @return bool
*/
public static function useFileCache( IContextSource $context, $mode = self::MODE_NORMAL ) {
$ulang = $context->getLanguage();
// Check that there are no other sources of variation
- if ( $user->getId() || $ulang->getCode() !== $config->get( 'LanguageCode' ) ) {
+ if ( $user->getId() ||
+ !$ulang->equals( MediaWikiServices::getInstance()->getContentLanguage() ) ) {
return false;
}
/**
* Read from cache to context output
* @param IContextSource $context
- * @param integer $mode One of the HTMLFileCache::MODE_* constants
+ * @param int $mode One of the HTMLFileCache::MODE_* constants
* @return void
*/
public function loadFromFileCache( IContextSource $context, $mode = self::MODE_NORMAL ) {
- global $wgContLang;
$config = MediaWikiServices::getInstance()->getMainConfig();
wfDebug( __METHOD__ . "()\n" );
$context->getOutput()->sendCacheControl();
header( "Content-Type: {$config->get( 'MimeType' )}; charset=UTF-8" );
- header( "Content-Language: {$wgContLang->getHtmlCode()}" );
+ header( 'Content-Language: ' .
+ MediaWikiServices::getInstance()->getContentLanguage()->getHtmlCode() );
if ( $this->useGzip() ) {
if ( wfClientAcceptsGzip() ) {
header( 'Content-Encoding: gzip' );