-
Notifications
You must be signed in to change notification settings - Fork 4
/
createControl.php
executable file
·44 lines (37 loc) · 1.22 KB
/
createControl.php
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
#!/usr/bin/env php
<?php
/**
* This is is used to create start and start88 control files.
*/
/* Judge argv count and get product var. */
if(count($argv) != 2) die('./createControl.php product=zentao|chanzhi|common');
$product = $argv[1];
/* Create start control file. */
$apacheFromPort = 88;
$apacheToPort = 80;
$mysqlFromPort = 3308;
$mysqlToPort = 3306;
file_put_contents('./start', createStart(file_get_contents('../start.tpl'), $product));
/* Create start88 control file. */
$apacheFromPort = 80;
$apacheToPort = 88;
$mysqlFromPort = 3306;
$mysqlToPort = 3308;
file_put_contents('./start88', createStart(file_get_contents('../start.tpl'), $product));
/**
* Create start.
*
* @param string $startTPL
* @param string $product
* @access public
* @return void
*/
function createStart($startTPL, $product)
{
global $apacheFromPort, $apacheToPort, $mysqlFromPort, $mysqlToPort;
$startTPL = str_replace('{apacheFromPort}', $apacheFromPort, $startTPL);
$startTPL = str_replace('{apacheToPort}', $apacheToPort, $startTPL);
$startTPL = str_replace('{mysqlFromPort}', $mysqlFromPort, $startTPL);
$startTPL = str_replace('{mysqlToPort}', $mysqlToPort, $startTPL);
return $startTPL;
}