- * 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' ) );
- *
- * @param string $extRel The path relative to the extensions directory, as defined by
- * $wgExtensionsDirectory.
- *
- * @return string
- */
- static function extSetupPath( $extRel ) {
- $baseRel = "extensions/$extRel";
- if ( defined( 'MW_COMPILED' ) ) {
- return $baseRel;
- } else {
- global $wgCompiledFiles;
- $wgCompiledFiles[] = $baseRel;
- return self::getExtensionsDirectory() . '/' . $extRel;
- }
- }
-
- /**
- * @return bool|string
- */
- static function getExtensionsDirectory() {
- global $wgExtensionsDirectory, $IP;
- if ( $wgExtensionsDirectory === false ) {
- $wgExtensionsDirectory = "$IP/../extensions";
- }
- return $wgExtensionsDirectory;
- }
-
- /**
- * 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