Subversion Repositories php-qbpwcf

Rev

Rev 226 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 liveuser 1
#!/usr/bin/php
2
<?php
3
 
4
/*
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
239 liveuser 6
    Copyright (C) 2014~2026 MIN ZHI, CHEN
3 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/>.
226 liveuser 22
 
3 liveuser 23
*/
24
 
25
/*
26
說明:
27
將指定的svn目錄輸出、打包、壓縮、上傳到目標Server,然後解壓縮、安裝、移除伺服端跟local端安裝檔案.
28
 
29
範例:
30
 
31
依照 myConfig.php 設定檔的內容執行
32
packetFromSvnToRemoteServer.php myConfig.php
33
 
34
建立新的設定檔案 myConfig.php
35
packetFromSvnToRemoteServer.php --create-conf myConfig.php
36
 
37
*/
38
 
39
#使用命名空間qbpwcf
40
namespace qbpwcf;
41
 
42
#取得 lib path
43
exec("php -f ".escapeshellarg(pathinfo(__FILE__)["dirname"]."/libexec/folderOfUsrLib.php"),$output,$status);
44
 
45
#如果執行失敗
46
if($status!==0){
47
 
48
	#debug
49
	var_dump(__LINE__,$output);
50
 
51
	#結束執行,回傳shell 1.
52
	exit(1);
53
 
54
	}#if end
55
 
56
#儲存lib path
57
$folderOfUsrLib=$output[0];
58
 
59
#以該檔案的實際位置的 lib path 為 include path 首位
60
$output=array();
61
exec("cd ".escapeshellarg(pathinfo(__FILE__)["dirname"]."/../".$folderOfUsrLib."/qbpwcf").";pwd;",$output,$status);
62
 
63
#如果執行失敗
64
if($status!==0){
65
 
66
	#debug
67
	var_dump(__LINE__,$output);
68
 
69
	#結束執行,回傳shell 1.
70
	exit(1);
71
 
72
	}#if end
73
 
226 liveuser 74
#設置 include path
3 liveuser 75
set_include_path($output[0].PATH_SEPARATOR.get_include_path());
76
 
77
#匯入外部套件
78
include("allInOne.php");
79
 
80
#函式說明:
81
#export svn 上的檔案目錄,進行打包放到遠端伺服器上並進行安裝或更新的動作.
82
#回傳結果:
83
#無.
84
#必填參數:
85
#無.
86
#可省略參數:
87
#無.
88
#參考資料:
89
#無.
90
#備註:
91
#用戶端上需要有安裝php,openssh-clients,subversion(svn),openssh-askpass,zstd套件.
92
#網站伺服器端需要有安裝openssh-server,zstd套件.
93
#待測試
94
#建議將svn預先輸入密碼的功能分離出來
95
cmd::packetFromSvnToRemoteServer();
96
 
226 liveuser 97
?>