Index: trunk/phase3/maintenance/doMaintenance.php |
— | — | @@ -54,18 +54,10 @@ |
55 | 55 | $self = $maintenance->getName(); |
56 | 56 | |
57 | 57 | // Detect compiled mode |
58 | | -try { |
59 | | - $r = new ReflectionFunction( 'wfHipHopCompilerVersion' ); |
60 | | -} catch ( ReflectionException $e ) { |
61 | | - $r = false; |
62 | | -} |
63 | | - |
64 | | -if ( $r ) { |
| 58 | +if ( isset( $_SERVER['MW_COMPILED'] ) ) { |
65 | 59 | define( 'MW_COMPILED', 1 ); |
66 | | -} |
67 | | - |
68 | | -# Get the MWInit class |
69 | | -if ( !defined( 'MW_COMPILED' ) ) { |
| 60 | +} else { |
| 61 | + # Get the MWInit class |
70 | 62 | require_once( "$IP/includes/Init.php" ); |
71 | 63 | require_once( "$IP/includes/AutoLoader.php" ); |
72 | 64 | } |
— | — | @@ -77,7 +69,7 @@ |
78 | 70 | if ( !defined( 'MW_COMPILED' ) ) { |
79 | 71 | require_once( "$IP/includes/Defines.php" ); |
80 | 72 | } |
81 | | -require_once( "$IP/includes/DefaultSettings.php" ); |
| 73 | +require_once( MWInit::compiledPath( 'includes/DefaultSettings.php' ) ); |
82 | 74 | |
83 | 75 | if ( defined( 'MW_CONFIG_CALLBACK' ) ) { |
84 | 76 | # Use a callback function to configure MediaWiki |
Index: trunk/phase3/maintenance/hiphop/run-server |
— | — | @@ -1,12 +1,72 @@ |
2 | | -#!/bin/bash |
| 2 | +#!/usr/bin/hphpi -f |
| 3 | +<?php |
3 | 4 | |
4 | | -sourceDir=`dirname "$0"` |
5 | | -sourceRoot=`readlink -f "$sourceDir/../.."` |
| 5 | +require( dirname( __FILE__ ) . '/../Maintenance.php' ); |
6 | 6 | |
7 | | -"$sourceDir"/build/persistent/mediawiki-hphp \ |
8 | | - -c "$sourceDir/server.conf" \ |
9 | | - -v Server.SourceRoot="$sourceRoot" \ |
10 | | - --mode=server \ |
11 | | - --port=8080 |
| 7 | +class RunHipHopServer extends Maintenance { |
| 8 | + function __construct() { |
| 9 | + parent::__construct(); |
| 10 | + $this->addOption( 'interpret', 'Run in interpreted mode' ); |
| 11 | + } |
12 | 12 | |
| 13 | + function execute() { |
| 14 | + if ( $this->hasOption( 'interpret' ) ) { |
| 15 | + $this->runInterpreted(); |
| 16 | + } else { |
| 17 | + $this->runCompiled(); |
| 18 | + } |
| 19 | + } |
13 | 20 | |
| 21 | + function runCompiled() { |
| 22 | + global $wgHipHopBuildDirectory; |
| 23 | + $thisDir = realpath( dirname( __FILE__ ) ); |
| 24 | + $IP = realpath( "$thisDir/../.." ); |
| 25 | + if ( strval( $wgHipHopBuildDirectory ) !== '' ) { |
| 26 | + $buildDir = $wgHipHopBuildDirectory; |
| 27 | + } else { |
| 28 | + $buildDir = "$thisDir/build"; |
| 29 | + } |
| 30 | + |
| 31 | + if ( file_exists( "$buildDir/source" ) ) { |
| 32 | + $sourceBase = "$buildDir/source"; |
| 33 | + } else { |
| 34 | + $sourceBase = realpath( "$IP/.." ); |
| 35 | + } |
| 36 | + |
| 37 | + passthru( |
| 38 | + 'cd ' . wfEscapeShellArg( $sourceBase ) . " && " . |
| 39 | + 'MW_INSTALL_PATH=' . wfEscapeShellArg( $IP ) . ' ' . |
| 40 | + wfEscapeShellArg( |
| 41 | + "$buildDir/persistent/mediawiki-hphp", |
| 42 | + '-c', "$thisDir/server.conf", |
| 43 | + '-v', "Server.SourceRoot=$sourceBase", |
| 44 | + '-v', "Server.IncludeSearchPaths.0=$sourceBase", |
| 45 | + '--mode=server', |
| 46 | + '--port=8080' |
| 47 | + ), |
| 48 | + $ret |
| 49 | + ); |
| 50 | + exit( $ret ); |
| 51 | + } |
| 52 | + |
| 53 | + function runInterpreted() { |
| 54 | + $thisDir = realpath( dirname( __FILE__ ) ); |
| 55 | + $IP = realpath( "$thisDir/../.." ); |
| 56 | + $sourceBase = realpath( "$IP/.." ); |
| 57 | + |
| 58 | + passthru( |
| 59 | + wfEscapeShellArg( |
| 60 | + 'hphpi', |
| 61 | + '-c', "$thisDir/server.conf", |
| 62 | + '-v', "Server.SourceRoot=$sourceBase", |
| 63 | + '-v', "Server.IncludeSearchPaths.0=$sourceBase", |
| 64 | + '--mode=server', |
| 65 | + '--port=8080' |
| 66 | + ), |
| 67 | + $ret |
| 68 | + ); |
| 69 | + exit( $ret ); |
| 70 | + } |
| 71 | +} |
| 72 | +$maintClass = 'RunHipHopServer'; |
| 73 | +require_once( RUN_MAINTENANCE_IF_MAIN ); |
Index: trunk/phase3/maintenance/hiphop/server.conf |
— | — | @@ -1,7 +1,6 @@ |
2 | 2 | Log { |
3 | 3 | Level = Warning |
4 | 4 | UseLogFile = true |
5 | | - File = /dev/stdout |
6 | 5 | NativeStackTrace = true |
7 | 6 | InjectedStackTrace = true |
8 | 7 | } |
— | — | @@ -12,5 +11,23 @@ |
13 | 12 | TranslateSource = true |
14 | 13 | } |
15 | 14 | Server { |
16 | | - EnableStaticContentFromDisk = true |
| 15 | + EnableStaticContentCache = false |
| 16 | + EnableStaticContentFromDisk = false |
| 17 | + AlwaysUseRelativePath = true |
17 | 18 | } |
| 19 | +ServerVariables { |
| 20 | + MW_COMPILED = 1 |
| 21 | +} |
| 22 | +VirtualHost { |
| 23 | + * { |
| 24 | + ServerName = localhost |
| 25 | + Pattern = . |
| 26 | + RewriteRules { |
| 27 | + * { |
| 28 | + pattern = ^/wiki/(.*)$ |
| 29 | + to = /phase3/index.php?title=$1 |
| 30 | + } |
| 31 | + } |
| 32 | + } |
| 33 | +} |
| 34 | + |
Index: trunk/phase3/maintenance/hiphop/make |
— | — | @@ -5,13 +5,20 @@ |
6 | 6 | |
7 | 7 | class MakeHipHop extends Maintenance { |
8 | 8 | function execute() { |
| 9 | + global $wgHipHopBuildDirectory; |
| 10 | + |
9 | 11 | $startTime = time(); |
10 | 12 | |
11 | | - $sourceDir = realpath( dirname( __FILE__ ) ); |
12 | | - $IP = realpath( "$sourceDir/../.." ); |
13 | | - $buildDir = "$sourceDir/build"; |
| 13 | + $thisDir = realpath( dirname( __FILE__ ) ); |
| 14 | + $IP = realpath( "$thisDir/../.." ); |
| 15 | + if ( strval( $wgHipHopBuildDirectory ) !== '' ) { |
| 16 | + $buildDir = $wgHipHopBuildDirectory; |
| 17 | + } else { |
| 18 | + $buildDir = "$thisDir/build"; |
| 19 | + } |
| 20 | + $extensionsDir = realpath( MWInit::getExtensionsDirectory() ); |
14 | 21 | $outDir = "$buildDir/hiphop-output"; |
15 | | - $persistentDir = "$buildDir/persistent" ; |
| 22 | + $persistentDir = "$buildDir/persistent"; |
16 | 23 | |
17 | 24 | if ( !is_dir( $buildDir ) ) { |
18 | 25 | mkdir( $buildDir, 0777, true ); |
— | — | @@ -20,6 +27,17 @@ |
21 | 28 | mkdir( $persistentDir, 0777, true ); |
22 | 29 | } |
23 | 30 | |
| 31 | + if ( realpath( "$IP/../phase3" ) !== $IP |
| 32 | + || realpath( "$IP/../extensions" ) !== $extensionsDir ) |
| 33 | + { |
| 34 | + # Set up a fake source directory with the correct layout |
| 35 | + $sourceBase = "$buildDir/source"; |
| 36 | + $this->setupFakeSourceBase( $IP, $extensionsDir, $sourceBase ); |
| 37 | + } else { |
| 38 | + $sourceBase = realpath( "$IP/.." ); |
| 39 | + unlink( "$buildDir/source" ); |
| 40 | + } |
| 41 | + |
24 | 42 | # With the CentOS RPMs, you just get g++44, no g++, so we have to |
25 | 43 | # use the environment |
26 | 44 | if ( isset( $_ENV['CXX'] ) ) { |
— | — | @@ -39,13 +57,8 @@ |
40 | 58 | "}\n" |
41 | 59 | ); |
42 | 60 | |
43 | | - # Generate the file list from the autoloader |
44 | | - global $wgAutoloadLocalClasses; |
45 | | - $files = array_merge( |
46 | | - array_values( $wgAutoloadLocalClasses ), |
47 | | - array_map( 'trim', file( "$sourceDir/extra-files" ) ) |
48 | | - ); |
49 | | - $files = array_unique( $files ); |
| 61 | + # Generate the file list |
| 62 | + $files = $this->getFileList(); |
50 | 63 | file_put_contents( |
51 | 64 | "$buildDir/file-list", |
52 | 65 | implode( "\n", $files ) . "\n" ); |
— | — | @@ -55,10 +68,10 @@ |
56 | 69 | 'hphp' . |
57 | 70 | ' --target=cpp' . |
58 | 71 | ' --format=file' . |
59 | | - ' --input-dir=' . wfEscapeShellArg( $IP ) . |
| 72 | + ' --input-dir=' . wfEscapeShellArg( $sourceBase ) . |
60 | 73 | ' --input-list=' . wfEscapeShellArg( "$buildDir/file-list" ) . |
61 | 74 | ' --inputs=' . wfEscapeShellArg( "$buildDir/HipHopCompilerVersion.php" ) . |
62 | | - ' -c ' . wfEscapeShellArg( "$sourceDir/compiler.conf" ) . |
| 75 | + ' -c ' . wfEscapeShellArg( "$thisDir/compiler.conf" ) . |
63 | 76 | ' --parse-on-demand=false' . |
64 | 77 | ' --program=mediawiki-hphp' . |
65 | 78 | ' --output-dir=' . wfEscapeShellArg( $outDir ) . |
— | — | @@ -181,7 +194,7 @@ |
182 | 195 | $elapsed -= $minutes * 60; |
183 | 196 | } |
184 | 197 | echo $elapsed . "s\n"; |
185 | | - echo "The MediaWiki executable is at build/persistent/mediawiki-hphp\n"; |
| 198 | + echo "The MediaWiki executable is at $buildDir/persistent/mediawiki-hphp\n"; |
186 | 199 | } |
187 | 200 | |
188 | 201 | function checkVolatileClasses( $dir ) { |
— | — | @@ -224,6 +237,71 @@ |
225 | 238 | return 1; |
226 | 239 | } |
227 | 240 | } |
| 241 | + |
| 242 | + function setupFakeSourceBase( $phase3, $extensions, $dest ) { |
| 243 | + if ( !file_exists( $dest ) ) { |
| 244 | + mkdir( $dest, 0777, true ); |
| 245 | + } |
| 246 | + |
| 247 | + $this->forceCreateLink( "$dest/phase3", $phase3 ); |
| 248 | + $this->forceCreateLink( "$dest/extensions", $extensions ); |
| 249 | + } |
| 250 | + |
| 251 | + function forceCreateLink( $target, $link ) { |
| 252 | + if ( file_exists( $target ) ) { |
| 253 | + if ( readlink( $target ) === $link ) { |
| 254 | + return; |
| 255 | + } |
| 256 | + unlink( $target ); |
| 257 | + } |
| 258 | + symlink( $target, $link ); |
| 259 | + } |
| 260 | + |
| 261 | + function getFileList() { |
| 262 | + global $wgAutoloadClasses, $wgAutoloadLocalClasses, $wgCompiledFiles; |
| 263 | + $inputFiles = array_merge( |
| 264 | + array_values( $wgAutoloadClasses ), |
| 265 | + array_values( $wgAutoloadLocalClasses ), |
| 266 | + $wgCompiledFiles |
| 267 | + ); |
| 268 | + $processedFiles = array(); |
| 269 | + foreach ( $inputFiles as $file ) { |
| 270 | + if ( substr( $file, 0, 1 ) === '/' ) { |
| 271 | + $processedFiles[] = $this->absoluteToRelative( $file ); |
| 272 | + } elseif ( preg_match( '/^extensions/', $file ) ) { |
| 273 | + $processedFiles[] = $file; |
| 274 | + } else { |
| 275 | + $processedFiles[] = "phase3/$file"; |
| 276 | + } |
| 277 | + } |
| 278 | + |
| 279 | + $extraCoreFiles = array_map( 'trim', file( dirname( __FILE__ ) . '/extra-files' ) ); |
| 280 | + foreach ( $extraCoreFiles as $file ) { |
| 281 | + if ( $file === '' ) { |
| 282 | + continue; |
| 283 | + } |
| 284 | + $processedFiles[] = "phase3/$file"; |
| 285 | + } |
| 286 | + return array_unique( $processedFiles ); |
| 287 | + } |
| 288 | + |
| 289 | + function absoluteToRelative( $file ) { |
| 290 | + global $IP; |
| 291 | + |
| 292 | + $coreBase = realpath( $IP ) . '/'; |
| 293 | + $extBase = realpath( MWInit::getExtensionsDirectory() ) . '/'; |
| 294 | + $file = realpath( $file ); |
| 295 | + |
| 296 | + if ( substr( $file, 0, strlen( $extBase ) ) === $extBase ) { |
| 297 | + return 'extensions/' . substr( $file, strlen( $extBase ) ); |
| 298 | + } elseif ( substr( $file, 0, strlen( $coreBase ) ) === $coreBase ) { |
| 299 | + return 'phase3/' . substr( $file, strlen( $coreBase ) ); |
| 300 | + } else { |
| 301 | + $this->error( "The following file is registered for compilation but is not in \$IP or " . |
| 302 | + "\$wgExtensionsDirectory: $file \n" ); |
| 303 | + exit( 1 ); |
| 304 | + } |
| 305 | + } |
228 | 306 | } |
229 | 307 | |
230 | 308 | $maintClass = 'MakeHipHop'; |
Index: trunk/phase3/includes/Init.php |
— | — | @@ -61,13 +61,63 @@ |
62 | 62 | global $IP; |
63 | 63 | |
64 | 64 | if ( defined( 'MW_COMPILED' ) ) { |
65 | | - return $file; |
| 65 | + return "phase3/$file"; |
66 | 66 | } else { |
67 | 67 | return "$IP/$file"; |
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
| 72 | + * The equivalent of MWInit::interpretedPath() but for files relative to the |
| 73 | + * extensions directory. |
| 74 | + */ |
| 75 | + static function extInterpretedPath( $file ) { |
| 76 | + return getExtensionsDirectory() . '/' . $file; |
| 77 | + } |
| 78 | + |
| 79 | + /** |
| 80 | + * The equivalent of MWInit::compiledPath() but for files relative to the |
| 81 | + * extensions directory. Any files referenced in this way must be registered |
| 82 | + * for compilation by including them in $wgCompiledFiles. |
| 83 | + */ |
| 84 | + static function extCompiledPath( $file ) { |
| 85 | + if ( defined( 'MW_COMPILED' ) ) { |
| 86 | + return "extensions/$file"; |
| 87 | + } else { |
| 88 | + return getExtensionsDirectory() . '/' . $file; |
| 89 | + } |
| 90 | + } |
| 91 | + |
| 92 | + /** |
| 93 | + * Register an extension setup file and return its path for compiled |
| 94 | + * inclusion. Use this function in LocalSettings.php to add extensions |
| 95 | + * to the build. For example: |
| 96 | + * |
| 97 | + * require( MWInit::extSetupPath( 'ParserFunctions/ParserFunctions.php' ) ); |
| 98 | + * |
| 99 | + * @param $path The path relative to the extensions directory, as defined by |
| 100 | + * $wgExtensionsDirectory. |
| 101 | + */ |
| 102 | + static function extSetupPath( $extRel ) { |
| 103 | + $baseRel = "extensions/$extRel"; |
| 104 | + if ( defined( 'MW_COMPILED' ) ) { |
| 105 | + return $baseRel; |
| 106 | + } else { |
| 107 | + global $wgCompiledFiles; |
| 108 | + $wgCompiledFiles[] = $baseRel; |
| 109 | + return self::getExtensionsDirectory() . '/' . $extRel; |
| 110 | + } |
| 111 | + } |
| 112 | + |
| 113 | + static function getExtensionsDirectory() { |
| 114 | + global $wgExtensionsDirectory, $IP; |
| 115 | + if ( $wgExtensionsDirectory === false ) { |
| 116 | + $wgExtensionsDirectory = "$IP/../extensions"; |
| 117 | + } |
| 118 | + return $wgExtensionsDirectory; |
| 119 | + } |
| 120 | + |
| 121 | + /** |
72 | 122 | * Determine whether a class exists, using a method which works under HipHop. |
73 | 123 | * |
74 | 124 | * Note that it's not possible to implement this with any variant of |
Index: trunk/phase3/includes/WebStart.php |
— | — | @@ -8,22 +8,6 @@ |
9 | 9 | * @file |
10 | 10 | */ |
11 | 11 | |
12 | | -/** |
13 | | - * Detect compiled mode by looking for a function that only exists if compiled |
14 | | - * in. Note that we can't use function_exists(), because it is terribly broken |
15 | | - * under HipHop due to the "volatile" feature. |
16 | | - * |
17 | | - * @return bool |
18 | | - */ |
19 | | -function wfDetectCompiledMode() { |
20 | | - try { |
21 | | - $r = new ReflectionFunction( 'wfHipHopCompilerVersion' ); |
22 | | - } catch ( ReflectionException $e ) { |
23 | | - $r = false; |
24 | | - } |
25 | | - return $r !== false; |
26 | | -} |
27 | | - |
28 | 12 | # Protect against register_globals |
29 | 13 | # This must be done before any globals are set by the code |
30 | 14 | if ( ini_get( 'register_globals' ) ) { |
— | — | @@ -88,11 +72,9 @@ |
89 | 73 | $IP = realpath( '.' ); |
90 | 74 | } |
91 | 75 | |
92 | | -if ( wfDetectCompiledMode() ) { |
| 76 | +if ( isset( $_SERVER['MW_COMPILED'] ) ) { |
93 | 77 | define( 'MW_COMPILED', 1 ); |
94 | | -} |
95 | | - |
96 | | -if ( !defined( 'MW_COMPILED' ) ) { |
| 78 | +} else { |
97 | 79 | # Get MWInit class |
98 | 80 | require_once( "$IP/includes/Init.php" ); |
99 | 81 | |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -5314,6 +5314,12 @@ |
5315 | 5315 | */ |
5316 | 5316 | |
5317 | 5317 | /** |
| 5318 | + * The build directory for HipHop compilation. |
| 5319 | + * Defaults to $IP/maintenance/hiphop/build. |
| 5320 | + */ |
| 5321 | +$wgHipHopBuildDirectory = false; |
| 5322 | + |
| 5323 | +/** |
5318 | 5324 | * The HipHop build type. Can be either "Debug" or "Release". |
5319 | 5325 | */ |
5320 | 5326 | $wgHipHopBuildType = 'Debug'; |
— | — | @@ -5324,6 +5330,31 @@ |
5325 | 5331 | */ |
5326 | 5332 | $wgHipHopCompilerProcs = 'detect'; |
5327 | 5333 | |
| 5334 | +/** |
| 5335 | + * Filesystem extensions directory. Defaults to $IP/../extensions. |
| 5336 | + * |
| 5337 | + * To compile extensions with HipHop, set $wgExtensionsDirectory correctly, |
| 5338 | + * and use code like: |
| 5339 | + * |
| 5340 | + * require( MWInit::extensionSetupPath( 'Extension/Extension.php' ) ); |
| 5341 | + * |
| 5342 | + * to include the extension setup file from LocalSettings.php. It is not |
| 5343 | + * necessary to set this variable unless you use MWInit::extensionSetupPath(). |
| 5344 | + */ |
| 5345 | +$wgExtensionsDirectory = false; |
| 5346 | + |
| 5347 | +/** |
| 5348 | + * A list of files that should be compiled into a HipHop build, in addition to |
| 5349 | + * those listed in $wgAutoloadClasses. Add to this array in an extension setup |
| 5350 | + * file in order to add files to the build. |
| 5351 | + * |
| 5352 | + * The files listed here must either be either absolute paths under $IP or |
| 5353 | + * under $wgExtensionsDirectory, or paths relative to the virtual source root |
| 5354 | + * "$IP/..", i.e. starting with "phase3" for core files, and "extensions" for |
| 5355 | + * extension files. |
| 5356 | + */ |
| 5357 | +$wgCompiledFiles = array(); |
| 5358 | + |
5328 | 5359 | /** @} */ # End of HipHop compilation } |
5329 | 5360 | |
5330 | 5361 | |
Index: trunk/phase3/trackback.php |
— | — | @@ -5,7 +5,11 @@ |
6 | 6 | * @ingroup SpecialPage |
7 | 7 | */ |
8 | 8 | |
9 | | -require_once( './includes/WebStart.php' ); |
| 9 | +if ( isset( $_SERVER['MW_COMPILED'] ) ) { |
| 10 | + require ( 'phase3/includes/WebStart.php' ); |
| 11 | +} else { |
| 12 | + require ( dirname( __FILE__ ) . '/includes/WebStart.php' ); |
| 13 | +} |
10 | 14 | |
11 | 15 | class TrackBack { |
12 | 16 | |
Index: trunk/phase3/img_auth.php |
— | — | @@ -26,7 +26,11 @@ |
27 | 27 | **/ |
28 | 28 | |
29 | 29 | define( 'MW_NO_OUTPUT_COMPRESSION', 1 ); |
30 | | -require_once( dirname( __FILE__ ) . '/includes/WebStart.php' ); |
| 30 | +if ( isset( $_SERVER['MW_COMPILED'] ) ) { |
| 31 | + require ( 'phase3/includes/WebStart.php' ); |
| 32 | +} else { |
| 33 | + require ( dirname( __FILE__ ) . '/includes/WebStart.php' ); |
| 34 | +} |
31 | 35 | wfProfileIn( 'img_auth.php' ); |
32 | 36 | require_once( dirname( __FILE__ ) . '/includes/StreamFile.php' ); |
33 | 37 | |
Index: trunk/phase3/mw-config/index.php |
— | — | @@ -9,7 +9,11 @@ |
10 | 10 | define( 'MEDIAWIKI_INSTALL', true ); |
11 | 11 | |
12 | 12 | chdir( dirname( dirname( __FILE__ ) ) ); |
13 | | -require( dirname( dirname( __FILE__ ) ) . '/includes/WebStart.php' ); |
| 13 | +if ( isset( $_SERVER['MW_COMPILED'] ) ) { |
| 14 | + require ( 'phase3/includes/WebStart.php' ); |
| 15 | +} else { |
| 16 | + require( dirname( dirname( __FILE__ ) ) . '/includes/WebStart.php' ); |
| 17 | +} |
14 | 18 | |
15 | 19 | wfInstallerMain(); |
16 | 20 | |
Index: trunk/phase3/redirect.php |
— | — | @@ -6,8 +6,12 @@ |
7 | 7 | * |
8 | 8 | * @file |
9 | 9 | */ |
| 10 | +if ( isset( $_SERVER['MW_COMPILED'] ) ) { |
| 11 | + require ( 'phase3/includes/WebStart.php' ); |
| 12 | +} else { |
| 13 | + require ( dirname( __FILE__ ) . '/includes/WebStart.php' ); |
| 14 | +} |
10 | 15 | |
11 | | -require_once( './includes/WebStart.php' ); |
12 | 16 | global $wgArticlePath; |
13 | 17 | |
14 | 18 | $page = $wgRequest->getVal( 'wpDropdown' ); |
Index: trunk/phase3/index.php |
— | — | @@ -64,7 +64,11 @@ |
65 | 65 | # Initialise common code. This gives us access to GlobalFunctions, the AutoLoader, and |
66 | 66 | # the globals $wgRequest, $wgOut, $wgUser, $wgLang and $wgContLang, amongst others; it |
67 | 67 | # does *not* load $wgTitle |
68 | | -require ( dirname( __FILE__ ) . '/includes/WebStart.php' ); |
| 68 | +if ( isset( $_SERVER['MW_COMPILED'] ) ) { |
| 69 | + require ( 'phase3/includes/WebStart.php' ); |
| 70 | +} else { |
| 71 | + require ( dirname( __FILE__ ) . '/includes/WebStart.php' ); |
| 72 | +} |
69 | 73 | |
70 | 74 | try { |
71 | 75 | wfIndexMain(); |
Index: trunk/phase3/api.php |
— | — | @@ -51,7 +51,11 @@ |
52 | 52 | } |
53 | 53 | |
54 | 54 | // Initialise common code. |
55 | | -require ( dirname( __FILE__ ) . '/includes/WebStart.php' ); |
| 55 | +if ( isset( $_SERVER['MW_COMPILED'] ) ) { |
| 56 | + require ( 'phase3/includes/WebStart.php' ); |
| 57 | +} else { |
| 58 | + require ( dirname( __FILE__ ) . '/includes/WebStart.php' ); |
| 59 | +} |
56 | 60 | |
57 | 61 | wfProfileIn( 'api.php' ); |
58 | 62 | $starttime = microtime( true ); |
Index: trunk/phase3/profileinfo.php |
— | — | @@ -28,8 +28,12 @@ |
29 | 29 | ini_set( 'zlib.output_compression', 'off' ); |
30 | 30 | |
31 | 31 | $wgEnableProfileInfo = $wgProfileToDatabase = false; |
| 32 | +if ( isset( $_SERVER['MW_COMPILED'] ) ) { |
| 33 | + require ( 'phase3/includes/WebStart.php' ); |
| 34 | +} else { |
| 35 | + require ( dirname( __FILE__ ) . '/includes/WebStart.php' ); |
| 36 | +} |
32 | 37 | |
33 | | -require_once( './includes/WebStart.php' ); |
34 | 38 | |
35 | 39 | header( 'Content-Type: text/html; charset=utf-8' ); |
36 | 40 | |
Index: trunk/phase3/load.php |
— | — | @@ -36,7 +36,12 @@ |
37 | 37 | wfDie( "MediaWiki $version requires at least PHP version 5.2.3." ); |
38 | 38 | } |
39 | 39 | |
40 | | -require ( dirname( __FILE__ ) . '/includes/WebStart.php' ); |
| 40 | +if ( isset( $_SERVER['MW_COMPILED'] ) ) { |
| 41 | + require ( 'phase3/includes/WebStart.php' ); |
| 42 | +} else { |
| 43 | + require ( dirname( __FILE__ ) . '/includes/WebStart.php' ); |
| 44 | +} |
| 45 | + |
41 | 46 | wfProfileIn( 'load.php' ); |
42 | 47 | |
43 | 48 | // URL safety checks |
Index: trunk/phase3/thumb.php |
— | — | @@ -7,7 +7,11 @@ |
8 | 8 | * @ingroup Media |
9 | 9 | */ |
10 | 10 | define( 'MW_NO_OUTPUT_COMPRESSION', 1 ); |
11 | | -require_once( './includes/WebStart.php' ); |
| 11 | +if ( isset( $_SERVER['MW_COMPILED'] ) ) { |
| 12 | + require ( 'phase3/includes/WebStart.php' ); |
| 13 | +} else { |
| 14 | + require ( dirname( __FILE__ ) . '/includes/WebStart.php' ); |
| 15 | +} |
12 | 16 | |
13 | 17 | $wgTrivialMimeDetection = true; //don't use fancy mime detection, just check the file extension for jpg/gif/png. |
14 | 18 | |