Remove hphpc support and deprecate related functions
authorTim Starling <tstarling@wikimedia.org>
Wed, 8 May 2013 06:48:56 +0000 (16:48 +1000)
committerTim Starling <tstarling@wikimedia.org>
Wed, 8 May 2013 22:28:05 +0000 (08:28 +1000)
hphpc has been superseded by hhvm, so support for hphpc is no longer
needed.

* Continue to use Preprocessor_Hash under HipHop since it is still
  faster under hhvm
* Keep $wgCompiledFiles for now, so that wikihiero doesn't give an error
  before Ic9d1e795 is merged
* Migrate the run-server script and associated configuration file to
  hhvm. Enable EnableStaticContentFromDisk since it doesn't seem
  ridiculously inefficient at first glance. Run from $IP rather than
  $IP/.. since hhvm is apparently not picky about sourcing files from
  outside of the current directory.

Change-Id: Ic3e769f1fbad4f7ad26dd819406796fee48c6b45

28 files changed:
RELEASE-NOTES-1.22
api.php
img_auth.php
includes/DefaultSettings.php
includes/Init.php
includes/Setup.php
includes/Skin.php
includes/WebStart.php
includes/externalstore/ExternalStore.php
includes/filebackend/SwiftFileBackend.php
includes/filerepo/FileRepo.php
includes/job/JobQueue.php
includes/parser/Parser.php
includes/parser/Tidy.php
includes/profiler/Profiler.php
includes/profiler/ProfilerSimpleUDP.php
index.php
languages/Language.php
load.php
maintenance/doMaintenance.php
maintenance/hiphop/compiler.conf [deleted file]
maintenance/hiphop/extra-files [deleted file]
maintenance/hiphop/make [deleted file]
maintenance/hiphop/run-server [changed mode: 0644->0755]
maintenance/hiphop/server.conf
mw-config/index.php
profileinfo.php
thumb.php

index 161084f..1a62c80 100644 (file)
@@ -137,6 +137,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 bc90229..b9efe2c 100644 (file)
--- 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 );
index ccaa8af..667a40a 100644 (file)
  */
 
 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()
index 053e3a8..407ac8f 100644 (file)
@@ -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
index 835ffdb..64431f0 100644 (file)
@@ -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
 
 /**
  * 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 );
        }
 }
index 1ceee49..565ca49 100644 (file)
@@ -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;
index 1aa1f05..ca7a91b 100644 (file)
@@ -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 );
index 3b7d701..bfa3c71 100644 (file)
@@ -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" );
 }
index 4ca193d..f5119d5 100644 (file)
@@ -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;
        }
 
        /**
index f0b289e..1527cfe 100644 (file)
@@ -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
index aa41135..b82a0b8 100644 (file)
@@ -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 );
        }
 
        /**
index 6bf6f82..08d4f39 100644 (file)
@@ -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 );
index 957aa6a..b2bcd61 100644 (file)
@@ -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)
index e3ea40b..0625140 100644 (file)
@@ -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;
 
index c77fef5..6f112ae 100644 (file)
@@ -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 );
                }
        }
index 2b9a322..9204763 100644 (file)
@@ -41,7 +41,7 @@ class ProfilerSimpleUDP extends ProfilerSimple {
                        return;
                }
 
-               if ( !MWInit::functionExists( 'socket_create' ) ) {
+               if ( !function_exists( 'socket_create' ) ) {
                        # Sockets are not enabled
                        return;
                }
index 0e9676d..6039769 100644 (file)
--- 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();
index 2fd4bb7..137b9a9 100644 (file)
@@ -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" );
                }
        }
 
index f363c3f..d3e980f 100644 (file)
--- 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' );
 
index 2e138e0..8576b8a 100644 (file)
@@ -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 (file)
index 3e01640..0000000
+++ /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 (file)
index f07f7c7..0000000
+++ /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 (file)
index 13e3163..0000000
+++ /dev/null
@@ -1,311 +0,0 @@
-#!/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 );
old mode 100644 (file)
new mode 100755 (executable)
index 1adfe29..cae8788
@@ -1,4 +1,4 @@
-#!/usr/bin/hphpi -f
+#!/usr/bin/hhvm -f
 <?php
 
 require( __DIR__ . '/../Maintenance.php' );
@@ -6,63 +6,16 @@ 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'
                        ),
index 16af0f2..558bdad 100644 (file)
@@ -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
                        }
                }
index 2823210..270a8b2 100644 (file)
@@ -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();
 
index 4117d97..489ff78 100644 (file)
 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' );
 
index ede30e6..669d87e 100644 (file)
--- a/thumb.php
+++ b/thumb.php
  */
 
 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;