Go to the documentation of this file.
45 $this->mUseGzip = (bool)$wgUseGzip;
53 global $wgFileCacheDirectory;
55 return $wgFileCacheDirectory;
69 if ( $this->mFilePath !==
null ) {
74 # Build directories (methods include the trailing "/")
76 # Avoid extension confusion
77 $key = str_replace(
'.',
'%2E', urlencode( $this->mKey ) );
78 # Build the full file path
79 $this->mFilePath =
"{$dir}/{$subDirs}{$key}.{$this->mExt}";
81 $this->mFilePath .=
'.gz';
92 if ( $this->mCached ===
null ) {
93 $this->mCached = file_exists( $this->
cachePath() );
125 $good = (
$timestamp <= $cachetime && $wgCacheEpoch <= $cachetime );
127 ": cachetime $cachetime, touched '{$timestamp}' epoch {$wgCacheEpoch}, good $good\n" );
146 $fh = gzopen( $this->
cachePath(),
'rb' );
148 return stream_get_contents( $fh );
150 return file_get_contents( $this->
cachePath() );
162 if ( !$wgUseFileCache ) {
167 $text = gzencode( $text );
171 if ( !file_put_contents( $this->
cachePath(), $text, LOCK_EX ) ) {
173 $this->mCached =
null;
178 $this->mCached =
true;
191 $this->mCached =
false;
210 return $this->mType .
'/';
222 if ( $wgFileCacheDepth > 0 ) {
223 $hash = md5( $this->mKey );
224 for ( $i = 1; $i <= $wgFileCacheDepth; $i++ ) {
225 $subdir .= substr(
$hash, 0, $i ) .
'/';
239 if ( mt_rand( 0, self::MISS_FACTOR - 1 ) == 0 ) {
240 # Get a large IP range that should include the user even if that
241 # person's IP address changes
242 $ip = $request->
getIP();
250 # Bail out if a request already came from this range...
251 $key =
wfMemcKey( get_class( $this ),
'attempt', $this->mType, $this->mKey, $ip );
255 $wgMemc->set( $key, 1, self::MISS_TTL_SEC );
257 # Increment the number of cache misses...
259 if ( $wgMemc->get( $key ) ===
false ) {
260 $wgMemc->set( $key, 1, self::MISS_TTL_SEC );
281 return wfMemcKey( get_class( $this ),
'misses', $this->mType, $this->mKey );
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
saveText( $text)
Save and compress text to the cache.
isCacheGood( $timestamp='')
Check if up to date cache file exists.
wfMkdirParents( $dir, $mode=null, $caller=null)
Make directory, and make all parent directories if they don't exist.
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php For a description of the see design txt $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest to get request data $wgMemc
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
wfSuppressWarnings( $end=false)
Reference-counted warning suppression.
static isIPv6( $ip)
Given a string, determine if it as valid IP in IPv6 only.
hashSubdirectory()
Return relative multi-level hash subdirectory (with trailing slash) or the empty string if not $wgFil...
wfMemcKey()
Get a cache key.
wfRestoreWarnings()
Restore error level to previous value.
useGzip()
Check if the cache is gzipped.
baseCacheDirectory()
Get the base file cache directory.
when a variable name is used in a it is silently declared as a new masking the global
fetchText()
Get the uncompressed text from the cache.
typeSubdirectory()
Get the cache type subdirectory (with trailing slash) An extending class could use that method to alt...
processing should stop and the error should be shown to the user * false
const TS_MW
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
isCached()
Check if the cache file exists.
cacheDirectory()
Get the base cache directory (not specific to this file)
clearCache()
Clear the cache for this page.
static isValid( $ip)
Validate an IP address.
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form,...
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
getIP()
Work out the IP address based on various globals For trusted proxies, use the XFF client IP (first of...
getMissesRecent()
Roughly gets the cache misses in the last hour by unique visitors.
if(count( $args)==0) $dir
cachePath()
Get the path to the cache file.
incrMissesRecent(WebRequest $request)
Roughly increments the cache misses in the last hour by unique visitors.
static sanitizeRange( $range)
Gets rid of unneeded numbers in quad-dotted/octet IP strings For example, 127.111....
cacheTimestamp()
Get the last-modified timestamp of the cache file.
checkCacheDirs()
Create parent directors of $this->cachePath()
Base class for data storage in the file system.