MediaWiki  REL1_19
MWInit Class Reference

Some functions that are useful during startup. More...

List of all members.

Static Public Member Functions

static callStaticMethod ($className, $methodName, $args)
 Call a static method of a class with variable arguments without causing it to become volatile.
static classExists ($class)
 Determine whether a class exists, using a method which works under HipHop.
static compiledPath ($file)
 If we are running code compiled by HipHop, this will pass through the input path, assumed to be relative to $IP.
static extCompiledPath ($file)
 The equivalent of MWInit::compiledPath() but for files relative to the extensions directory.
static extInterpretedPath ($file)
 The equivalent of MWInit::interpretedPath() but for files relative to the extensions directory.
static extSetupPath ($extRel)
 Register an extension setup file and return its path for compiled inclusion.
static functionExists ($function)
 Determine whether a function exists, using a method which works under HipHop.
static getCompilerVersion ()
 Get the version of HipHop used to compile, or false if MediaWiki was not compiled.
static getExtensionsDirectory ()
static interpretedPath ($file)
 Get a fully-qualified path for a source file relative to $IP.
static isHipHop ()
 Returns true if we are running under HipHop, whether in compiled or interpreted mode.
static methodExists ($class, $method)
 Determine wether a method exists within a class, using a method which works under HipHop.

Static Public Attributes

static $compilerVersion

Detailed Description

Some functions that are useful during startup.

Definition at line 6 of file Init.php.


Member Function Documentation

static MWInit::callStaticMethod ( className,
methodName,
args 
) [static]

Call a static method of a class with variable arguments without causing it to become volatile.

Parameters:
$classNamestring
$methodNamestring
$argsarray

Definition at line 201 of file Init.php.

Referenced by FileRepo\newFatal().

Here is the caller graph for this function:

static MWInit::classExists ( class) [static]

Determine whether a class exists, using a method which works under HipHop.

Note that it's not possible to implement this with any variant of class_exists(), because class_exists() returns false for classes which are compiled in.

Calling class_exists() on a literal string causes the class to be made "volatile", which means (as of March 2011) that the class is broken and can't be used at all. So don't do that. See https://github.com/facebook/hiphop-php/issues/314

Parameters:
$classstring
Returns:
bool

Definition at line 146 of file Init.php.

Referenced by FSFileBackendFileList\__construct(), MWTidy\execInternalTidy(), ExternalStore\getStoreObject(), Language\newFromCode(), Skin\newFromKey(), UserDupes\newSchema(), and Maintenance\runChild().

Here is the caller graph for this function:

static MWInit::compiledPath ( file) [static]

If we are running code compiled by HipHop, this will pass through the input path, assumed to be relative to $IP.

If the code is interpreted, it will converted to a fully qualified path. It is necessary to use a path which is relative to $IP in order to make HipHop use its compiled code.

Parameters:
$filestring
Returns:
string

Definition at line 60 of file Init.php.

References $IP.

static MWInit::extCompiledPath ( file) [static]

The equivalent of MWInit::compiledPath() but for files relative to the extensions directory.

Any files referenced in this way must be registered for compilation by including them in $wgCompiledFiles.

Parameters:
$filestring
Returns:
string

Definition at line 88 of file Init.php.

References $file, and getExtensionsDirectory().

Here is the call graph for this function:

static MWInit::extInterpretedPath ( file) [static]

The equivalent of MWInit::interpretedPath() but for files relative to the extensions directory.

Parameters:
$filestring
Returns:
string

Definition at line 77 of file Init.php.

References $file, and getExtensionsDirectory().

Here is the call graph for this function:

static MWInit::extSetupPath ( extRel) [static]

Register an extension setup file and return its path for compiled inclusion.

Use this function in LocalSettings.php to add extensions to the build. For example:

require( MWInit::extSetupPath( 'ParserFunctions/ParserFunctions.php' ) );

Parameters:
$extRelstring The path relative to the extensions directory, as defined by $wgExtensionsDirectory.
Returns:
string

Definition at line 108 of file Init.php.

References $wgCompiledFiles, and getExtensionsDirectory().

Here is the call graph for this function:

static MWInit::functionExists ( function) [static]

Determine whether a function exists, using a method which works under HipHop.

Parameters:
$functionstring
Returns:
bool

Definition at line 184 of file Init.php.

Referenced by ProfilerSimpleUDP\logData(), and Maintenance\posix_isatty().

Here is the caller graph for this function:

static MWInit::getCompilerVersion ( ) [static]

Get the version of HipHop used to compile, or false if MediaWiki was not compiled.

This works by having our build script insert a special function into the compiled code.

Definition at line 14 of file Init.php.

References $compilerVersion.

static MWInit::getExtensionsDirectory ( ) [static]
Returns:
bool|string

Definition at line 122 of file Init.php.

References $IP, and $wgExtensionsDirectory.

Referenced by extCompiledPath(), extInterpretedPath(), and extSetupPath().

Here is the caller graph for this function:

static MWInit::interpretedPath ( file) [static]

Get a fully-qualified path for a source file relative to $IP.

Including such a path under HipHop will force the file to be interpreted. This is useful for configuration files.

Parameters:
$filestring
Returns:
string

Definition at line 44 of file Init.php.

References $IP.

static MWInit::isHipHop ( ) [static]

Returns true if we are running under HipHop, whether in compiled or interpreted mode.

Returns:
bool

Definition at line 31 of file Init.php.

static MWInit::methodExists ( class,
method 
) [static]

Determine wether a method exists within a class, using a method which works under HipHop.

Note that under HipHop when method_exists is given a string for it's class such as to test for a static method has the same issues as class_exists does.

Parameters:
$classstring
$methodstring
Returns:
bool

Definition at line 167 of file Init.php.


Member Data Documentation

MWInit::$compilerVersion [static]

Definition at line 7 of file Init.php.

Referenced by getCompilerVersion().


The documentation for this class was generated from the following file: