1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
#!/usr/bin/hphpi -f
<?php
require( dirname( __FILE__ ) . '/../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( dirname( __FILE__ ) );
$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( dirname( __FILE__ ) );
$IP = realpath( "$thisDir/../.." );
$sourceBase = realpath( "$IP/.." );
passthru(
'cd ' . wfEscapeShellArg( $sourceBase ) . " && " .
'MW_INSTALL_PATH=' . wfEscapeShellArg( $IP ) . ' ' .
wfEscapeShellArg(
'hphpi',
'-c', "$thisDir/server.conf",
'-v', "Server.SourceRoot=$sourceBase",
'-v', "Server.IncludeSearchPaths.0=$sourceBase",
'--mode=server',
'--port=8080'
),
$ret
);
exit( $ret );
}
}
$maintClass = 'RunHipHopServer';
require_once( RUN_MAINTENANCE_IF_MAIN );
|