From: jenkins-bot Date: Wed, 8 May 2013 22:43:32 +0000 (+0000) Subject: Merge "Remove hphpc support and deprecate related functions" X-Git-Tag: 1.31.0-rc.0~19729 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22suivi_revisions%22%29%20.%20%22?a=commitdiff_plain;h=8ffa0bab7c8e036d1253224f931a044328d6309d;hp=24b529353cd56a76dee0a85e2da0a0c88d05b0c1;p=lhc%2Fweb%2Fwiklou.git Merge "Remove hphpc support and deprecate related functions" --- diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22 index 00ed6054e3..50444a7a13 100644 --- a/RELEASE-NOTES-1.22 +++ b/RELEASE-NOTES-1.22 @@ -141,6 +141,8 @@ changes to languages because of Bugzilla reports. * (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. diff --git a/api.php b/api.php index bc9022979e..b9efe2c252 100644 --- a/api.php +++ b/api.php @@ -41,11 +41,7 @@ if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5. } // 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 ); diff --git a/img_auth.php b/img_auth.php index ccaa8af0fc..667a40a5a8 100644 --- a/img_auth.php +++ b/img_auth.php @@ -40,11 +40,7 @@ */ 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() diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 053e3a8cf0..407ac8f839 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -6181,56 +6181,6 @@ $wgMaxBacklinksInvalidate = false; /** @} */ # 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 * @{ @@ -6381,6 +6331,12 @@ $wgSiteTypes = array( '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 diff --git a/includes/Init.php b/includes/Init.php index 835ffdb92c..64431f09a8 100644 --- a/includes/Init.php +++ b/includes/Init.php @@ -2,6 +2,9 @@ /** * 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 @@ -22,40 +25,35 @@ /** * 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 * @@ -67,117 +65,39 @@ class MWInit { } /** - * 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 @@ -185,34 +105,25 @@ class MWInit { * @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 @@ -220,7 +131,6 @@ class MWInit { * @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 ); } } diff --git a/includes/Setup.php b/includes/Setup.php index 1ceee498eb..565ca49ed0 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -391,22 +391,20 @@ if ( $wgDebugToolbar && !$wgCommandLineMode ) { 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; diff --git a/includes/Skin.php b/includes/Skin.php index 1aa1f05c08..ca7a91b833 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -162,23 +162,19 @@ abstract class Skin extends ContextSource { $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 ); diff --git a/includes/WebStart.php b/includes/WebStart.php index 3b7d701be5..bfa3c7118c 100644 --- a/includes/WebStart.php +++ b/includes/WebStart.php @@ -91,21 +91,17 @@ if ( $IP === false ) { } } -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(); @@ -116,14 +112,14 @@ if ( file_exists( "$IP/StartProfiler.php" ) ) { 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 @@ -139,7 +135,7 @@ if ( defined( 'MW_CONFIG_CALLBACK' ) ) { } if ( $wgEnableSelenium ) { - require_once( MWInit::compiledPath( "includes/SeleniumWebSettings.php" ) ); + require_once( "$IP/includes/SeleniumWebSettings.php" ); } wfProfileOut( 'WebStart.php-conf' ); @@ -150,13 +146,11 @@ wfProfileIn( 'WebStart.php-ob_start' ); # 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" ); } diff --git a/includes/externalstore/ExternalStore.php b/includes/externalstore/ExternalStore.php index 4ca193d40d..f5119d5ea7 100644 --- a/includes/externalstore/ExternalStore.php +++ b/includes/externalstore/ExternalStore.php @@ -60,7 +60,7 @@ class ExternalStore { $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; } /** diff --git a/includes/filebackend/SwiftFileBackend.php b/includes/filebackend/SwiftFileBackend.php index f0b289e13b..1527cfedf8 100644 --- a/includes/filebackend/SwiftFileBackend.php +++ b/includes/filebackend/SwiftFileBackend.php @@ -104,7 +104,7 @@ class SwiftFileBackend extends FileBackendStore { */ 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 diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index aa41135fa1..b82a0b8fb1 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -1564,7 +1564,7 @@ class FileRepo { 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 ); } /** diff --git a/includes/job/JobQueue.php b/includes/job/JobQueue.php index 6bf6f82f0f..08d4f3927c 100644 --- a/includes/job/JobQueue.php +++ b/includes/job/JobQueue.php @@ -96,7 +96,7 @@ abstract class JobQueue { */ 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 ); diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 957aa6a790..b2bcd619d8 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -219,8 +219,8 @@ class Parser { 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) diff --git a/includes/parser/Tidy.php b/includes/parser/Tidy.php index e3ea40b0a9..06251402dd 100644 --- a/includes/parser/Tidy.php +++ b/includes/parser/Tidy.php @@ -244,7 +244,7 @@ class MWTidy { global $wgTidyConf, $wgDebugTidy; wfProfileIn( __METHOD__ ); - if ( !MWInit::classExists( 'tidy' ) ) { + if ( !class_exists( 'tidy' ) ) { wfWarn( "Unable to load internal tidy class." ); $retval = -1; diff --git a/includes/profiler/Profiler.php b/includes/profiler/Profiler.php index c77fef5c69..6f112aeb3d 100644 --- a/includes/profiler/Profiler.php +++ b/includes/profiler/Profiler.php @@ -623,7 +623,7 @@ class Profiler { * @param string $s to output */ function debug( $s ) { - if ( defined( 'MW_COMPILED' ) || function_exists( 'wfDebug' ) ) { + if ( function_exists( 'wfDebug' ) ) { wfDebug( $s ); } } diff --git a/includes/profiler/ProfilerSimpleUDP.php b/includes/profiler/ProfilerSimpleUDP.php index 2b9a322fb6..9204763c0a 100644 --- a/includes/profiler/ProfilerSimpleUDP.php +++ b/includes/profiler/ProfilerSimpleUDP.php @@ -41,7 +41,7 @@ class ProfilerSimpleUDP extends ProfilerSimple { return; } - if ( !MWInit::functionExists( 'socket_create' ) ) { + if ( !function_exists( 'socket_create' ) ) { # Sockets are not enabled return; } diff --git a/index.php b/index.php index 0e9676da29..6039769496 100644 --- a/index.php +++ b/index.php @@ -49,11 +49,7 @@ if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5. # 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(); diff --git a/languages/Language.php b/languages/Language.php index 2fd4bb75d0..137b9a97cc 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -414,10 +414,8 @@ class Language { 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" ); } } diff --git a/load.php b/load.php index f363c3fa51..d3e980fe83 100644 --- a/load.php +++ b/load.php @@ -29,11 +29,7 @@ if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5. 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' ); diff --git a/maintenance/doMaintenance.php b/maintenance/doMaintenance.php index 2e138e0f8f..8576b8acde 100644 --- a/maintenance/doMaintenance.php +++ b/maintenance/doMaintenance.php @@ -54,15 +54,11 @@ $maintenance->setup(); $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(); @@ -71,9 +67,7 @@ if ( file_exists( "$IP/StartProfiler.php" ) ) { } // 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' ) ) { diff --git a/maintenance/hiphop/compiler.conf b/maintenance/hiphop/compiler.conf deleted file mode 100644 index 3e01640db0..0000000000 --- a/maintenance/hiphop/compiler.conf +++ /dev/null @@ -1,5 +0,0 @@ -GenerateSourceInfo = true -EnableEval = 2 -AllDynamic = true -EnableHipHopSyntax = true -EnableHipHopExperimentalSyntax = true diff --git a/maintenance/hiphop/extra-files b/maintenance/hiphop/extra-files deleted file mode 100644 index f07f7c7c68..0000000000 --- a/maintenance/hiphop/extra-files +++ /dev/null @@ -1,34 +0,0 @@ -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 - diff --git a/maintenance/hiphop/make b/maintenance/hiphop/make deleted file mode 100644 index 13e3163ac8..0000000000 --- a/maintenance/hiphop/make +++ /dev/null @@ -1,311 +0,0 @@ -#!/usr/bin/hphpi -f -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 ); diff --git a/maintenance/hiphop/run-server b/maintenance/hiphop/run-server old mode 100644 new mode 100755 index 1adfe29f1b..cae878891d --- a/maintenance/hiphop/run-server +++ b/maintenance/hiphop/run-server @@ -1,4 +1,4 @@ -#!/usr/bin/hphpi -f +#!/usr/bin/hhvm -f 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' ), diff --git a/maintenance/hiphop/server.conf b/maintenance/hiphop/server.conf index 16af0f2f17..558bdad8ce 100644 --- a/maintenance/hiphop/server.conf +++ b/maintenance/hiphop/server.conf @@ -12,7 +12,7 @@ Debug { } Server { EnableStaticContentCache = false - EnableStaticContentFromDisk = false + EnableStaticContentFromDisk = true AlwaysUseRelativePath = true } VirtualHost { @@ -22,7 +22,7 @@ VirtualHost { RewriteRules { * { pattern = ^/wiki/(.*)$ - to = /phase3/index.php?title=$1 + to = /index.php?title=$1 qsa = true } } diff --git a/mw-config/index.php b/mw-config/index.php index 2823210acb..270a8b26fe 100644 --- a/mw-config/index.php +++ b/mw-config/index.php @@ -24,11 +24,7 @@ define( 'MW_CONFIG_CALLBACK', 'Installer::overrideConfig' ); 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(); diff --git a/profileinfo.php b/profileinfo.php index 4117d975dd..489ff786c5 100644 --- a/profileinfo.php +++ b/profileinfo.php @@ -28,11 +28,7 @@ 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' ); diff --git a/thumb.php b/thumb.php index ede30e6ec4..669d87e6fb 100644 --- a/thumb.php +++ b/thumb.php @@ -22,11 +22,7 @@ */ 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;