Go to the documentation of this file.
37 if ( !isset( $instance ) ) {
53 throw new MWException(
"Tried to create a ParserCache with an invalid memcached" );
55 $this->mMemc = $memCached;
68 $renderkey = (int)( $wgRequest->getVal(
'action' ) ==
'render' );
70 $key =
wfMemcKey(
'pcache',
'idhash',
"{$pageid}-{$renderkey}!{$hash}" );
80 return wfMemcKey(
'pcache',
'idoptions',
"{$pageid}" );
100 "--" .
$article->getTouched() .
'"';
136 if ( $popts instanceof
User ) {
137 wfWarn(
"Use of outdated prototype ParserCache::getKey( &\$article, &\$user )\n" );
143 if ( $optionsKey !=
false ) {
144 if ( !$useOutdated && $optionsKey->expired(
$article->getTouched() ) ) {
146 $cacheTime = $optionsKey->getCacheTime();
147 wfDebug(
"Parser options key expired, touched " .
$article->getTouched() .
", epoch $wgCacheEpoch, cached $cacheTime\n" );
149 } elseif ( $optionsKey->isDifferentRevision(
$article->getLatest() ) ) {
152 $cachedRevId = $optionsKey->getCacheRevisionId();
153 wfDebug(
"ParserOutput key is for an old revision, latest $revId, cached $cachedRevId\n" );
158 $usedOptions = $optionsKey->mUsedOptions;
159 wfDebug(
"Parser cache options found.\n" );
161 if ( !$useOutdated ) {
184 $canCache =
$article->checkTouched();
193 $parserOutputKey = $this->
getKey(
$article, $popts, $useOutdated );
194 if ( $parserOutputKey ===
false ) {
200 $value = $this->mMemc->get( $parserOutputKey );
202 wfDebug(
"ParserOutput cache miss.\n" );
208 wfDebug(
"ParserOutput cache found.\n" );
213 $value->setEditSectionTokens( $popts->getEditSection() );
215 if ( !$useOutdated &&
$value->expired( $touched ) ) {
217 $cacheTime =
$value->getCacheTime();
218 wfDebug(
"ParserOutput key expired, touched $touched, epoch $wgCacheEpoch, cached $cacheTime\n" );
220 } elseif (
$value->isDifferentRevision(
$article->getLatest() ) ) {
223 $cachedRevId =
$value->getCacheRevisionId();
224 wfDebug(
"ParserOutput key is for an old revision, latest $revId, cached $cachedRevId\n" );
241 public function save( $parserOutput, $page, $popts, $cacheTime =
null, $revId =
null ) {
242 $expire = $parserOutput->getCacheExpiry();
246 $revision = $page->getRevision();
247 $revId = $revision ? $revision->getId() :
null;
251 $optionsKey->mUsedOptions = $parserOutput->getUsedOptions();
254 $optionsKey->setCacheTime( $cacheTime );
255 $parserOutput->setCacheTime( $cacheTime );
256 $optionsKey->setCacheRevisionId( $revId );
257 $parserOutput->setCacheRevisionId( $revId );
259 $optionsKey->setContainsOldMagic( $parserOutput->containsOldMagic() );
262 $popts->optionsHash( $optionsKey->mUsedOptions, $page->getTitle() ) );
265 $parserOutput->setTimestamp( $page->getTimestamp() );
267 $msg =
"Saved in parser cache with key $parserOutputKey" .
268 " and timestamp $cacheTime" .
269 " and revision id $revId" .
272 $parserOutput->mText .=
"\n<!-- $msg -->\n";
276 $this->mMemc->set( $parserOutputKey, $parserOutput, $expire );
279 $this->mMemc->set( $this->
getOptionsKey( $page ), $optionsKey, $expire );
281 wfDebug(
"Parser output was marked as uncacheable and has not been saved.\n" );
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Parser cache specific expiry check.
getKey( $article, $popts, $useOutdated=true)
Generates a key for caching the given article considering the given parser options.
__construct( $memCached)
Setup a cache pathway with a given back-end storage mechanism.
getETag( $article, $popts)
Provides an E-Tag suitable for the whole page.
wfProfileIn( $functionname)
Begin profiling of a function.
controlled by $wgMainCacheType * $parserMemc
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
save( $parserOutput, $page, $popts, $cacheTime=null, $revId=null)
wfMemcKey()
Get a cache key.
wfIncrStats( $key, $count=1)
Increment a statistics counter.
getDirty( $article, $popts)
Retrieve the ParserOutput from ParserCache, even if it's outdated.
wfProfileOut( $functionname='missing')
Stop profiling of a function.
when a variable name is used in a it is silently declared as a new masking the global
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
processing should stop and the error should be shown to the user * false
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
static singleton()
Get an instance of this object.
return false to override stock group addition can be modified try getUserPermissionsErrors userCan checks are continued by internal code can override on output return false to not delete it return false to override the default password checks & $hash
getParserOutputKey( $article, $hash)
static legacyOptions()
Returns the full array of options that would have been used by in 1.16.
updateCacheExpiry( $seconds)
Sets the number of seconds after which this object should expire.
wfWarn( $msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Using a hook running we can avoid having all this option specific stuff in our mainline code Using the function array $article
static newFromUser( $user)
Get a ParserOptions object from a given user.