* (bug 46680) "Return to" links are no longer tagged with rel="next".
* BREAKING CHANGE: mw.util.tooltipAccessKeyRegexp: The match group for the
accesskey character is now $6 instead of $5.
+* HipHop compiler (hphpc) support was removed. HipHop VM support (hhvm) was
+ added.
* A new Special:Redirect page was added, providing lookup by revision ID,
user ID, or file name. The old Special:Filepath page was reimplemented
to redirect through Special:Redirect.
}
// Initialise common code.
-if ( isset( $_SERVER['MW_COMPILED'] ) ) {
- require ( 'core/includes/WebStart.php' );
-} else {
- require ( __DIR__ . '/includes/WebStart.php' );
-}
+require ( __DIR__ . '/includes/WebStart.php' );
wfProfileIn( 'api.php' );
$starttime = microtime( true );
*/
define( 'MW_NO_OUTPUT_COMPRESSION', 1 );
-if ( isset( $_SERVER['MW_COMPILED'] ) ) {
- require ( 'core/includes/WebStart.php' );
-} else {
- require ( __DIR__ . '/includes/WebStart.php' );
-}
+require ( __DIR__ . '/includes/WebStart.php' );
wfProfileIn( 'img_auth.php' );
# Set action base paths so that WebRequest::getPathInfo()
/** @} */ # End job queue }
-/************************************************************************//**
- * @name HipHop compilation
- * @{
- */
-
-/**
- * The build directory for HipHop compilation.
- * Defaults to '$IP/maintenance/hiphop/build'.
- */
-$wgHipHopBuildDirectory = false;
-
-/**
- * The HipHop build type. Can be either "Debug" or "Release".
- */
-$wgHipHopBuildType = 'Debug';
-
-/**
- * Number of parallel processes to use during HipHop compilation, or "detect"
- * to guess from system properties.
- */
-$wgHipHopCompilerProcs = 'detect';
-
-/**
- * Filesystem extensions directory. Defaults to $IP/../extensions.
- *
- * To compile extensions with HipHop, set $wgExtensionsDirectory correctly,
- * and use code like:
- * @code
- * require( MWInit::extensionSetupPath( 'Extension/Extension.php' ) );
- * @endcode
- *
- * to include the extension setup file from LocalSettings.php. It is not
- * necessary to set this variable unless you use MWInit::extensionSetupPath().
- */
-$wgExtensionsDirectory = false;
-
-/**
- * A list of files that should be compiled into a HipHop build, in addition to
- * those listed in $wgAutoloadClasses. Add to this array in an extension setup
- * file in order to add files to the build.
- *
- * The files listed here must either be either absolute paths under $IP or
- * under $wgExtensionsDirectory, or paths relative to the virtual source root
- * "$IP/..", i.e. starting with "phase3" for core files, and "extensions" for
- * extension files.
- */
-$wgCompiledFiles = array();
-
-/** @} */ # End of HipHop compilation }
-
/************************************************************************//**
* @name Miscellaneous
* @{
'mediawiki' => 'MediaWikiSite',
);
+/**
+ * Formerly a list of files for HipHop compilation
+ * @deprecated since 1.22
+ */
+$wgCompiledFiles = array();
+
/**
* For really cool vim folding this needs to be at the end:
* vim: foldmarker=@{,@} foldmethod=marker
/**
* Some functions that are useful during startup.
*
+ * This class previously contained some functionality related to a PHP compiler
+ * called hphpc. That compiler has now been discontinued.
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
/**
* Some functions that are useful during startup.
+ *
+ * This class previously contained some functionality related to a PHP compiler
+ * called hphpc. That compiler has now been discontinued. All methods are now
+ * deprecated.
*/
class MWInit {
static $compilerVersion;
/**
- * 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.
+ * @deprecated since 1.22
*/
static function getCompilerVersion() {
- if ( self::$compilerVersion === null ) {
- if ( self::functionExists( 'wfHipHopCompilerVersion' ) ) {
- self::$compilerVersion = wfHipHopCompilerVersion();
- } else {
- self::$compilerVersion = false;
- }
- }
- return self::$compilerVersion;
+ return false;
}
/**
* Returns true if we are running under HipHop, whether in compiled or
* interpreted mode.
*
+ * @deprecated since 1.22
* @return bool
*/
static function isHipHop() {
- return function_exists( 'hphp_thread_set_warmup_enabled' );
+ return defined( 'HPHP_VERSION' );
}
/**
- * 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.
+ * Get a fully-qualified path for a source file relative to $IP.
+ * @deprecated since 1.22
*
* @param $file string
*
}
/**
- * 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.
- *
+ * @deprecated since 1.22
* @param $file string
- *
* @return string
*/
static function compiledPath( $file ) {
global $IP;
-
- if ( defined( 'MW_COMPILED' ) ) {
- return "phase3/$file";
- } else {
- return "$IP/$file";
- }
- }
-
- /**
- * The equivalent of MWInit::interpretedPath() but for files relative to the
- * extensions directory.
- *
- * @param $file string
- * @return string
- */
- static function extInterpretedPath( $file ) {
- return self::getExtensionsDirectory() . '/' . $file;
+ return "$IP/$file";
}
/**
- * 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.
+ * @deprecated since 1.22
* @param $file string
* @return string
*/
static function extCompiledPath( $file ) {
- if ( defined( 'MW_COMPILED' ) ) {
- return "extensions/$file";
- } else {
- return self::getExtensionsDirectory() . '/' . $file;
- }
+ return false;
}
/**
- * 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
+ * Deprecated wrapper for class_exists()
+ * @deprecated since 1.22
*
* @param $class string
*
* @return bool
*/
static function classExists( $class ) {
- try {
- $r = new ReflectionClass( $class );
- } catch ( ReflectionException $r ) {
- $r = false;
- }
- return $r !== false;
+ return class_exists( $class );
}
/**
- * Determine whether 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.
+ * Deprecated wrapper for method_exists()
+ * @deprecated since 1.22
*
* @param $class string
* @param $method string
* @return bool
*/
static function methodExists( $class, $method ) {
- try {
- $r = new ReflectionMethod( $class, $method );
- } catch ( ReflectionException $r ) {
- $r = false;
- }
- return $r !== false;
+ return method_exists( $class, $method );
}
/**
- * Determine whether a function exists, using a method which works under
- * HipHop.
+ * Deprecated wrapper for function_exists()
+ * @deprecated since 1.22
*
* @param $function string
*
* @return bool
*/
static function functionExists( $function ) {
- try {
- $r = new ReflectionFunction( $function );
- } catch ( ReflectionException $r ) {
- $r = false;
- }
- return $r !== false;
+ return function_exists( $function );
}
/**
- * Call a static method of a class with variable arguments without causing
- * it to become volatile.
+ * Deprecated wrapper for call_user_func_array()
+ * @deprecated since 1.22
+ *
* @param $className string
* @param $methodName string
* @param $args array
* @return mixed
*/
static function callStaticMethod( $className, $methodName, $args ) {
- $r = new ReflectionMethod( $className, $methodName );
- return $r->invokeArgs( null, $args );
+ return call_user_func_array( array( $className, $methodName ), $args );
}
}
MWDebug::init();
}
-if ( !defined( 'MW_COMPILED' ) ) {
- if ( !MWInit::classExists( 'AutoLoader' ) ) {
- require_once( "$IP/includes/AutoLoader.php" );
- }
+if ( !class_exists( 'AutoLoader' ) ) {
+ require_once( "$IP/includes/AutoLoader.php" );
+}
- wfProfileIn( $fname . '-exception' );
- MWExceptionHandler::installHandler();
- wfProfileOut( $fname . '-exception' );
+wfProfileIn( $fname . '-exception' );
+MWExceptionHandler::installHandler();
+wfProfileOut( $fname . '-exception' );
- wfProfileIn( $fname . '-includes' );
- require_once( "$IP/includes/normal/UtfNormalUtil.php" );
- require_once( "$IP/includes/GlobalFunctions.php" );
- require_once( "$IP/includes/ProxyTools.php" );
- require_once( "$IP/includes/normal/UtfNormalDefines.php" );
- wfProfileOut( $fname . '-includes' );
-}
+wfProfileIn( $fname . '-includes' );
+require_once( "$IP/includes/normal/UtfNormalUtil.php" );
+require_once( "$IP/includes/GlobalFunctions.php" );
+require_once( "$IP/includes/ProxyTools.php" );
+require_once( "$IP/includes/normal/UtfNormalDefines.php" );
+wfProfileOut( $fname . '-includes' );
if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !== '//' ) {
$wgSecureLogin = false;
$className = "Skin{$skinName}";
# Grab the skin class and initialise it.
- if ( !MWInit::classExists( $className ) ) {
+ if ( !class_exists( $className ) ) {
- if ( !defined( 'MW_COMPILED' ) ) {
- require_once( "{$wgStyleDirectory}/{$skinName}.php" );
- }
+ require_once( "{$wgStyleDirectory}/{$skinName}.php" );
# Check if we got if not fallback to default skin
- if ( !MWInit::classExists( $className ) ) {
+ if ( !class_exists( $className ) ) {
# DO NOT die if the class isn't found. This breaks maintenance
# scripts and can cause a user account to be unrecoverable
# except by SQL manipulation if a previously valid skin name
# is no longer valid.
wfDebug( "Skin class does not exist: $className\n" );
$className = 'SkinVector';
- if ( !defined( 'MW_COMPILED' ) ) {
- require_once( "{$wgStyleDirectory}/Vector.php" );
- }
+ require_once( "{$wgStyleDirectory}/Vector.php" );
}
}
$skin = new $className( $key );
}
}
-if ( isset( $_SERVER['MW_COMPILED'] ) ) {
- define( 'MW_COMPILED', 1 );
-} else {
- # Get MWInit class
- require_once( "$IP/includes/Init.php" );
+# Get MWInit class
+require_once( "$IP/includes/Init.php" );
- # Start the autoloader, so that extensions can derive classes from core files
- require_once( "$IP/includes/AutoLoader.php" );
+# Start the autoloader, so that extensions can derive classes from core files
+require_once( "$IP/includes/AutoLoader.php" );
- # Load the profiler
- require_once( "$IP/includes/profiler/Profiler.php" );
+# Load the profiler
+require_once( "$IP/includes/profiler/Profiler.php" );
- # Load up some global defines.
- require_once( "$IP/includes/Defines.php" );
-}
+# Load up some global defines.
+require_once( "$IP/includes/Defines.php" );
# Start the profiler
$wgProfiler = array();
wfProfileIn( 'WebStart.php-conf' );
# Load default settings
-require_once( MWInit::compiledPath( "includes/DefaultSettings.php" ) );
+require_once( "$IP/includes/DefaultSettings.php" );
if ( defined( 'MW_CONFIG_CALLBACK' ) ) {
# Use a callback function to configure MediaWiki
MWFunction::call( MW_CONFIG_CALLBACK );
} else {
if ( !defined( 'MW_CONFIG_FILE' ) ) {
- define( 'MW_CONFIG_FILE', MWInit::interpretedPath( 'LocalSettings.php' ) );
+ define( 'MW_CONFIG_FILE', "$IP/LocalSettings.php" );
}
# LocalSettings.php is the per site customization file. If it does not exist
}
if ( $wgEnableSelenium ) {
- require_once( MWInit::compiledPath( "includes/SeleniumWebSettings.php" ) );
+ require_once( "$IP/includes/SeleniumWebSettings.php" );
}
wfProfileOut( 'WebStart.php-conf' );
# that would cause us to potentially mix gzip and non-gzip output, creating a
# big mess.
if ( !defined( 'MW_NO_OUTPUT_BUFFER' ) && ob_get_level() == 0 ) {
- if ( !defined( 'MW_COMPILED' ) ) {
- require_once( "$IP/includes/OutputHandler.php" );
- }
+ require_once( "$IP/includes/OutputHandler.php" );
ob_start( 'wfOutputHandler' );
}
wfProfileOut( 'WebStart.php-ob_start' );
if ( !defined( 'MW_NO_SETUP' ) ) {
- require_once( MWInit::compiledPath( "includes/Setup.php" ) );
+ require_once( "$IP/includes/Setup.php" );
}
$class = 'ExternalStore' . ucfirst( $proto );
// Any custom modules should be added to $wgAutoLoadClasses for on-demand loading
- return MWInit::classExists( $class ) ? new $class( $params ) : false;
+ return class_exists( $class ) ? new $class( $params ) : false;
}
/**
*/
public function __construct( array $config ) {
parent::__construct( $config );
- if ( !MWInit::classExists( 'CF_Constants' ) ) {
+ if ( !class_exists( 'CF_Constants' ) ) {
throw new MWException( 'SwiftCloudFiles extension not installed.' );
}
// Required settings
public function newFatal( $message /*, parameters...*/ ) {
$params = func_get_args();
array_unshift( $params, $this );
- return MWInit::callStaticMethod( 'FileRepoStatus', 'newFatal', $params );
+ return call_user_func_array( array( 'FileRepoStatus', 'newFatal' ), $params );
}
/**
*/
final public static function factory( array $params ) {
$class = $params['class'];
- if ( !MWInit::classExists( $class ) ) {
+ if ( !class_exists( $class ) ) {
throw new MWException( "Invalid job queue class '$class'." );
}
$obj = new $class( $params );
self::EXT_LINK_URL_CLASS . '+)\p{Zs}*([^\]\\x00-\\x08\\x0a-\\x1F]*?)\]/Su';
if ( isset( $conf['preprocessorClass'] ) ) {
$this->mPreprocessorClass = $conf['preprocessorClass'];
- } elseif ( defined( 'MW_COMPILED' ) ) {
- # Preprocessor_Hash is much faster than Preprocessor_DOM in compiled mode
+ } elseif ( defined( 'HPHP_VERSION' ) ) {
+ # Preprocessor_Hash is much faster than Preprocessor_DOM under HipHop
$this->mPreprocessorClass = 'Preprocessor_Hash';
} elseif ( extension_loaded( 'domxml' ) ) {
# PECL extension that conflicts with the core DOM extension (bug 13770)
global $wgTidyConf, $wgDebugTidy;
wfProfileIn( __METHOD__ );
- if ( !MWInit::classExists( 'tidy' ) ) {
+ if ( !class_exists( 'tidy' ) ) {
wfWarn( "Unable to load internal tidy class." );
$retval = -1;
* @param string $s to output
*/
function debug( $s ) {
- if ( defined( 'MW_COMPILED' ) || function_exists( 'wfDebug' ) ) {
+ if ( function_exists( 'wfDebug' ) ) {
wfDebug( $s );
}
}
return;
}
- if ( !MWInit::functionExists( 'socket_create' ) ) {
+ if ( !function_exists( 'socket_create' ) ) {
# Sockets are not enabled
return;
}
# Initialise common code. This gives us access to GlobalFunctions, the
# AutoLoader, and the globals $wgRequest, $wgOut, $wgUser, $wgLang and
# $wgContLang, amongst others; it does *not* load $wgTitle
-if ( isset( $_SERVER['MW_COMPILED'] ) ) {
- require ( 'phase3/includes/WebStart.php' );
-} else {
- require ( __DIR__ . '/includes/WebStart.php' );
-}
+require ( __DIR__ . '/includes/WebStart.php' );
$mediaWiki = new MediaWiki();
$mediaWiki->run();
return;
}
- if ( !defined( 'MW_COMPILED' ) ) {
- if ( file_exists( "$IP/languages/classes/$class.php" ) ) {
- include_once( "$IP/languages/classes/$class.php" );
- }
+ if ( file_exists( "$IP/languages/classes/$class.php" ) ) {
+ include_once( "$IP/languages/classes/$class.php" );
}
}
wfPHPVersionError( 'load.php' );
}
-if ( isset( $_SERVER['MW_COMPILED'] ) ) {
- require ( 'phase3/includes/WebStart.php' );
-} else {
- require ( __DIR__ . '/includes/WebStart.php' );
-}
+require ( __DIR__ . '/includes/WebStart.php' );
wfProfileIn( 'load.php' );
$self = $maintenance->getName();
// Detect compiled mode
-if ( isset( $_SERVER['MW_COMPILED'] ) ) {
- define( 'MW_COMPILED', 1 );
-} else {
- # Get the MWInit class
- require_once( "$IP/includes/Init.php" );
- require_once( "$IP/includes/AutoLoader.php" );
- # Stub the profiler
- require_once( "$IP/includes/profiler/Profiler.php" );
-}
+# Get the MWInit class
+require_once( "$IP/includes/Init.php" );
+require_once( "$IP/includes/AutoLoader.php" );
+# Stub the profiler
+require_once( "$IP/includes/profiler/Profiler.php" );
# Start the profiler
$wgProfiler = array();
}
// Some other requires
-if ( !defined( 'MW_COMPILED' ) ) {
- require_once( "$IP/includes/Defines.php" );
-}
+require_once( "$IP/includes/Defines.php" );
require_once( MWInit::compiledPath( 'includes/DefaultSettings.php' ) );
if ( defined( 'MW_CONFIG_CALLBACK' ) ) {
+++ /dev/null
-GenerateSourceInfo = true
-EnableEval = 2
-AllDynamic = true
-EnableHipHopSyntax = true
-EnableHipHopExperimentalSyntax = true
+++ /dev/null
-img_auth.php
-includes/AutoLoader.php
-includes/DefaultSettings.php
-includes/Defines.php
-includes/GlobalFunctions.php
-includes/ImageFunctions.php
-includes/OutputHandler.php
-includes/ProxyTools.php
-includes/SeleniumWebSettings.php
-includes/Setup.php
-includes/StreamFile.php
-includes/WebStart.php
-includes/filerepo/NullRepo.php
-includes/normal/UtfNormalDefines.php
-includes/normal/UtfNormalUtil.php
-index.php
-languages/Names.php
-load.php
-maintenance/Maintenance.php
-maintenance/commandLine.inc
-maintenance/doMaintenance.php
-maintenance/eval.php
-opensearch_desc.php
-profileinfo.php
-redirect.php
-resources/Resources.php
-serialized/serialize.php
-skins/MonoBook.deps.php
-skins/MonoBook.php
-skins/Vector.deps.php
-skins/Vector.php
-thumb.php
-trackback.php
-
+++ /dev/null
-#!/usr/bin/hphpi -f
-<?php
-
-define( 'MW_CONFIG_CALLBACK', 'MakeHipHop::noConfigNeeded' );
-require( __DIR__ . '/../Maintenance.php' );
-
-class MakeHipHop extends Maintenance {
- function noConfigNeeded() {}
-
- function execute() {
- global $wgHipHopBuildDirectory;
-
- $startTime = time();
-
- $thisDir = realpath( __DIR__ );
- $IP = realpath( "$thisDir/../.." );
- if ( strval( $wgHipHopBuildDirectory ) !== '' ) {
- $buildDir = $wgHipHopBuildDirectory;
- } else {
- $buildDir = "$thisDir/build";
- }
- $extensionsDir = realpath( MWInit::getExtensionsDirectory() );
- $outDir = "$buildDir/hiphop-output";
- $persistentDir = "$buildDir/persistent";
-
- if ( !is_dir( $buildDir ) ) {
- mkdir( $buildDir, 0777, true );
- }
- if ( !is_dir( $persistentDir ) ) {
- mkdir( $persistentDir, 0777, true );
- }
-
- if ( realpath( "$IP/../phase3" ) !== $IP
- || realpath( "$IP/../extensions" ) !== $extensionsDir )
- {
- # Set up a fake source directory with the correct layout
- $sourceBase = "$buildDir/source";
- $this->setupFakeSourceBase( $IP, $extensionsDir, $sourceBase );
- } else {
- $sourceBase = realpath( "$IP/.." );
- unlink( "$buildDir/source" );
- }
-
- # With the CentOS RPMs, you just get g++44, no g++, so we have to
- # use the environment
- if ( isset( $_ENV['CXX'] ) ) {
- $cxx = $_ENV['CXX'];
- } else {
- $cxx = 'g++';
- }
-
- # Create a function that provides the HipHop compiler version, and
- # doesn't exist when MediaWiki is invoked in interpreter mode.
- $version = str_replace( PHP_EOL, ' ', trim( `hphp --version` ) );
- file_put_contents(
- "$buildDir/HipHopCompilerVersion.php",
- "<" . "?php\n" .
- "function wfHipHopCompilerVersion() {\n" .
- "return " . var_export( $version, true ) . ";\n" .
- "}\n"
- );
-
- # Generate the file list
- $files = $this->getFileList();
- file_put_contents(
- "$buildDir/file-list",
- implode( "\n", $files ) . "\n" );
-
- # Generate the C++
- passthru(
- 'hphp' .
- ' --target=cpp' .
- ' --format=file' .
- ' --input-dir=' . wfEscapeShellArg( $sourceBase ) .
- ' --input-list=' . wfEscapeShellArg( "$buildDir/file-list" ) .
- ' --inputs=' . wfEscapeShellArg( "$buildDir/HipHopCompilerVersion.php" ) .
- ' -c ' . wfEscapeShellArg( "$thisDir/compiler.conf" ) .
- ' --parse-on-demand=false' .
- ' --program=mediawiki-hphp' .
- ' --output-dir=' . wfEscapeShellArg( $outDir ) .
- ' --log=3', $ret );
-
- if ( $ret ) {
- $this->error( "hphp hit an error. Stopping build.\n" );
- exit( 1 );
- }
-
- # Sanity check, quickly make sure we've got an output directory
- if( !is_dir( $outDir ) ) {
- $this->error( "No output directory", true );
- }
-
- # Warn about volatile classes
- $this->checkVolatileClasses( $outDir );
-
- # Copy the generated C++ files into the source directory for cmake
- $iter = new RecursiveIteratorIterator(
- new RecursiveDirectoryIterator( $outDir ),
- RecursiveIteratorIterator::SELF_FIRST );
- $sourceFiles = array();
- $regenerateMakefile = false;
- $numFiles = 0;
- $numFilesChanged = 0;
- foreach ( $iter as $sourcePath => $file ) {
- $name = substr( $sourcePath, strlen( $outDir ) + 1 );
- $sourceFiles[$name] = true;
- $destPath = "$persistentDir/$name";
- if ( $file->isDir() ) {
- if ( !is_dir( $destPath ) ) {
- mkdir( $destPath );
- }
- continue;
- }
-
- $numFiles++;
- # Remove any files that weren't touched, these may have been removed
- # from file-list, we should not compile them
- if ( $file->getMTime() < $startTime ) {
- if ( file_exists( $destPath ) ) {
- unlink( $destPath );
- # Files removed, regenerate the makefile
- $regenerateMakefile = true;
- }
- unlink( $sourcePath );
- $numFilesChanged++;
- continue;
- }
-
- if ( file_exists( $destPath ) ) {
- $sourceHash = md5( file_get_contents( $sourcePath ) );
- $destHash = md5( file_get_contents( $destPath ) );
- if ( $sourceHash == $destHash ) {
- continue;
- }
- } else {
- # New files added, regenerate the makefile
- $regenerateMakefile = true;
- }
- $numFilesChanged++;
- copy( $sourcePath, $destPath );
- }
-
- echo "MediaWiki: $numFilesChanged files changed out of $numFiles\n";
-
- if ( !file_exists( "$persistentDir/CMakeLists.txt" ) ) {
- # Run cmake for the first time
- $regenerateMakefile = true;
- }
-
- # Do our own version of $HPHP_HOME/bin/run.sh, which isn't so broken.
- # HipHop's RELEASE mode seems to be stuck always on, so symbols get
- # stripped. Also we will try keeping the generated .o files instead of
- # throwing away hours of CPU time every time you make a typo.
-
- chdir( $persistentDir );
-
- if ( $regenerateMakefile ) {
- copy( $_ENV['HPHP_HOME'] . '/bin/CMakeLists.base.txt',
- "$persistentDir/CMakeLists.txt" );
-
- if ( file_exists( "$persistentDir/CMakeCache.txt" ) ) {
- unlink( "$persistentDir/CMakeCache.txt" );
- }
-
- $cmd = 'cmake' .
- " -D CMAKE_BUILD_TYPE:string=" . wfEscapeShellArg( $GLOBALS['wgHipHopBuildType'] ) .
- ' -D PROGRAM_NAME:string=mediawiki-hphp';
-
- if ( file_exists( '/usr/bin/ccache' ) ) {
- $cmd .= ' -D CMAKE_CXX_COMPILER:string=ccache' .
- ' -D CMAKE_CXX_COMPILER_ARG1:string=' . wfEscapeShellArg( $cxx );
- }
-
- $cmd .= ' .';
- echo "$cmd\n";
- passthru( $cmd );
- }
-
- # Determine appropriate make concurrency
- # Compilation can take a lot of memory, let's assume that that is limiting.
- $procs = $this->getNumProcs();
-
- # Run make. This is the slow step.
- passthru( 'make -j' . wfEscapeShellArg( $procs ) );
-
- $elapsed = time() - $startTime;
-
- echo "Completed in ";
- if ( $elapsed >= 3600 ) {
- $hours = floor( $elapsed / 3600 );
- echo $hours . 'h ';
- $elapsed -= $hours * 3600;
- }
- if ( $elapsed >= 60 ) {
- $minutes = floor( $elapsed / 60 );
- echo $minutes . 'm ';
- $elapsed -= $minutes * 60;
- }
- echo $elapsed . "s\n";
- echo "The MediaWiki executable is at $buildDir/persistent/mediawiki-hphp\n";
- }
-
- function checkVolatileClasses( $dir ) {
- $lines = file( "$dir/sys/dynamic_table_class.cpp" );
- $classes = array();
- foreach ( $lines as $line ) {
- if ( preg_match( '/^\s+\(const char \*\)"([^"]*)", \(const char \*\)-1/', $line, $m ) ) {
- $classes[] = $m[1];
- }
- }
- if ( !count( $classes ) ) {
- print "No volatile classes found\n";
- return;
- }
- sort( $classes );
- $classes = array_unique( $classes );
- print "WARNING: The following classes are volatile: " . implode( ', ', $classes ) . "\n";
- }
-
- function getNumProcs() {
- global $wgHipHopCompilerProcs;
- if ( $wgHipHopCompilerProcs !== 'detect' ) {
- return intval( $wgHipHopCompilerProcs );
- }
-
- if ( !file_exists( '/proc/meminfo' ) ) {
- return 1;
- }
- $mem = false;
- foreach ( file( '/proc/meminfo' ) as $line ) {
- if ( preg_match( '/^MemTotal:\s+(\d+)\s+kB/', $line, $m ) ) {
- $mem = intval( $m[1] );
- break;
- }
- }
- if ( $mem ) {
- // At least one process
- return max( 1, floor( $mem / 1000000 ) );
- } else {
- return 1;
- }
- }
-
- function setupFakeSourceBase( $phase3, $extensions, $dest ) {
- if ( !file_exists( $dest ) ) {
- mkdir( $dest, 0777, true );
- }
-
- $this->forceCreateLink( "$dest/phase3", $phase3 );
- $this->forceCreateLink( "$dest/extensions", $extensions );
- }
-
- function forceCreateLink( $target, $link ) {
- if ( file_exists( $target ) ) {
- if ( readlink( $target ) === $link ) {
- return;
- }
- unlink( $target );
- }
- symlink( $target, $link );
- }
-
- function getFileList() {
- global $wgAutoloadClasses, $wgAutoloadLocalClasses, $wgCompiledFiles;
- $inputFiles = array_merge(
- array_values( $wgAutoloadClasses ),
- array_values( $wgAutoloadLocalClasses ),
- $wgCompiledFiles
- );
- $processedFiles = array();
- foreach ( $inputFiles as $file ) {
- if ( substr( $file, 0, 1 ) === '/' ) {
- $processedFiles[] = $this->absoluteToRelative( $file );
- } elseif ( preg_match( '/^extensions/', $file ) ) {
- $processedFiles[] = $file;
- } else {
- $processedFiles[] = "phase3/$file";
- }
- }
-
- $extraCoreFiles = array_map( 'trim', file( __DIR__ . '/extra-files' ) );
- foreach ( $extraCoreFiles as $file ) {
- if ( $file === '' ) {
- continue;
- }
- $processedFiles[] = "phase3/$file";
- }
- return array_unique( $processedFiles );
- }
-
- function absoluteToRelative( $file ) {
- global $IP;
-
- $coreBase = realpath( $IP ) . '/';
- $extBase = realpath( MWInit::getExtensionsDirectory() ) . '/';
- $file = realpath( $file );
-
- if ( substr( $file, 0, strlen( $extBase ) ) === $extBase ) {
- return 'extensions/' . substr( $file, strlen( $extBase ) );
- } elseif ( substr( $file, 0, strlen( $coreBase ) ) === $coreBase ) {
- return 'phase3/' . substr( $file, strlen( $coreBase ) );
- } else {
- $this->error( "The following file is registered for compilation but is not in \$IP or " .
- "\$wgExtensionsDirectory: $file \n" );
- exit( 1 );
- }
- }
-}
-
-$maintClass = 'MakeHipHop';
-require_once( RUN_MAINTENANCE_IF_MAIN );
-#!/usr/bin/hphpi -f
+#!/usr/bin/hhvm -f
<?php
require( __DIR__ . '/../Maintenance.php' );
class RunHipHopServer extends Maintenance {
function __construct() {
parent::__construct();
- $this->addOption( 'interpret', 'Run in interpreted mode' );
}
function execute() {
- if ( $this->hasOption( 'interpret' ) ) {
- $this->runInterpreted();
- } else {
- $this->runCompiled();
- }
- }
-
- function runCompiled() {
- global $wgHipHopBuildDirectory;
- $thisDir = realpath( __DIR__ );
- $IP = realpath( "$thisDir/../.." );
- if ( strval( $wgHipHopBuildDirectory ) !== '' ) {
- $buildDir = $wgHipHopBuildDirectory;
- } else {
- $buildDir = "$thisDir/build";
- }
-
- if ( file_exists( "$buildDir/source" ) ) {
- $sourceBase = "$buildDir/source";
- } else {
- $sourceBase = realpath( "$IP/.." );
- }
-
- passthru(
- 'cd ' . wfEscapeShellArg( $sourceBase ) . " && " .
- 'MW_INSTALL_PATH=' . wfEscapeShellArg( $IP ) . ' ' .
- wfEscapeShellArg(
- "$buildDir/persistent/mediawiki-hphp",
- '-c', "$thisDir/server.conf",
- '-v', "Server.SourceRoot=$sourceBase",
- '-v', "Server.IncludeSearchPaths.0=$sourceBase",
- '-v', 'ServerVariables.MW_COMPILED=1',
- '--mode=server',
- '--port=8080'
- ),
- $ret
- );
- exit( $ret );
- }
-
- function runInterpreted() {
- $thisDir = realpath( __DIR__ );
- $IP = realpath( "$thisDir/../.." );
- $sourceBase = realpath( "$IP/.." );
+ global $IP;
passthru(
- 'cd ' . wfEscapeShellArg( $sourceBase ) . " && " .
- 'MW_INSTALL_PATH=' . wfEscapeShellArg( $IP ) . ' ' .
+ 'cd ' . wfEscapeShellArg( $IP ) . " && " .
wfEscapeShellArg(
- 'hphpi',
- '-c', "$thisDir/server.conf",
- '-v', "Server.SourceRoot=$sourceBase",
- '-v', "Server.IncludeSearchPaths.0=$sourceBase",
+ 'hhvm',
+ '-c', __DIR__."/server.conf",
'--mode=server',
'--port=8080'
),
}
Server {
EnableStaticContentCache = false
- EnableStaticContentFromDisk = false
+ EnableStaticContentFromDisk = true
AlwaysUseRelativePath = true
}
VirtualHost {
RewriteRules {
* {
pattern = ^/wiki/(.*)$
- to = /phase3/index.php?title=$1
+ to = /index.php?title=$1
qsa = true
}
}
define( 'MEDIAWIKI_INSTALL', true );
chdir( dirname( __DIR__ ) );
-if ( isset( $_SERVER['MW_COMPILED'] ) ) {
- require ( 'core/includes/WebStart.php' );
-} else {
- require( dirname( __DIR__ ) . '/includes/WebStart.php' );
-}
+require( dirname( __DIR__ ) . '/includes/WebStart.php' );
wfInstallerMain();
ini_set( 'zlib.output_compression', 'off' );
$wgEnableProfileInfo = $wgProfileToDatabase = false;
-if ( isset( $_SERVER['MW_COMPILED'] ) ) {
- require ( 'core/includes/WebStart.php' );
-} else {
- require ( __DIR__ . '/includes/WebStart.php' );
-}
+require ( __DIR__ . '/includes/WebStart.php' );
header( 'Content-Type: text/html; charset=utf-8' );
*/
define( 'MW_NO_OUTPUT_COMPRESSION', 1 );
-if ( isset( $_SERVER['MW_COMPILED'] ) ) {
- require( 'core/includes/WebStart.php' );
-} else {
- require( __DIR__ . '/includes/WebStart.php' );
-}
+require( __DIR__ . '/includes/WebStart.php' );
// Don't use fancy mime detection, just check the file extension for jpg/gif/png
$wgTrivialMimeDetection = true;