Subversion Repositories qbpwcf-lib(archive)

Rev

Rev 906 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 liveuser 1
#!/bin/php
2
<?php
3
 
465 liveuser 4
/*
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
622 liveuser 6
    Copyright (C) 2015~2024 Min-Jhin,Chen
465 liveuser 7
 
8
    This file is part of QBPWCF.
9
 
10
    QBPWCF is free software: you can redistribute it and/or modify
11
    it under the terms of the GNU General Public License as published by
12
    the Free Software Foundation, either version 3 of the License, or
13
    (at your option) any later version.
14
 
15
    QBPWCF is distributed in the hope that it will be useful,
16
    but WITHOUT ANY WARRANTY; without even the implied warranty of
17
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
    GNU General Public License for more details.
19
 
20
    You should have received a copy of the GNU General Public License
21
    along with QBPWCF.  If not, see <http://www.gnu.org/licenses/>.
22
 
23
*/
24
 
1 liveuser 25
#使用命名空間qbpwcf
26
namespace qbpwcf;
27
 
466 liveuser 28
#以該檔案的實際位置的 lib path 為 include path 首位
925 liveuser 29
exec("cd ".pathinfo(__FILE__)["dirname"]."/../lib/qbpwcf;pwd;",$output,$status);
466 liveuser 30
set_include_path($output[0].PATH_SEPARATOR.get_include_path());
31
 
1 liveuser 32
#匯入外部套件
466 liveuser 33
include("allInOne.php");
1 liveuser 34
 
35
#如果不存在參數1跟2
36
if( !isset($_SERVER['argv'][1]) || !isset($_SERVER['argv'][2]) )
37
{
38
	#show help
39
	help();
40
 
41
	#停止執行
42
	exit;
43
}
44
 
45
#如果第參數為 "help" 或 "-h"
46
if( $_SERVER['argv'][1]==="help" || $_SERVER['argv'][1]==="-h" )
47
{
48
	#show help
49
	help();
50
 
51
	#停止執行
52
	exit;
53
 
54
}#if end
55
 
56
#涵式說明:
57
#變更word press網站的所有資訊為新的 domain name.
58
#回傳結果:
59
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
60
#$result["error"],錯誤訊息.
61
#$result["function"],當前執行的函數名稱.
62
#$result["argu"],所使用的參數.
63
#$result["content"],執行的結果.
64
#必填參數:
65
#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
66
$conf["fileArgu"]=__FILE__;
67
#$conf["oldDomain"],字串,舊的domain名稱.
68
$conf["oldDomain"]=$_SERVER['argv'][1];
69
#$conf["newDomain"],字串,新的domain名稱.
70
$conf["newDomain"]=$_SERVER['argv'][2];
71
#可省略參數:
72
 
73
#如果有第三個參數
74
if(isset($_SERVER['argv'][3])){
75
 
76
	#$conf["wpConfig"],字串,wp-cofnig.php的位置與名稱,預設為"wp-config.php".
77
	$conf["wpConfig"]=$_SERVER['argv'][3];
78
 
79
	}#if end
80
 
81
$changeWordPressDomain=cmd::changeWordPressDomain($conf);
82
unset($conf);
83
 
84
#印出結果
85
var_dump($changeWordPressDomain);
86
 
87
#說明
88
function help()
89
{
90
	#說明
91
	echo "change wordpress's domain.".PHP_EOL;
92
	echo "db config file wp-cofnig.php should be here.".PHP_EOL;
93
	echo $_SERVER['argv'][0]." old-domain new-domain [position and name of wp-admin.php]".PHP_EOL;
94
}
95
 
96
?>