Subversion Repositories php-qbpwcf

Rev

Rev 66 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 66 Rev 226
Line 1... Line 1...
1
#!/usr/bin/php
1
#!/usr/bin/php
2
<?php
2
<?php
3
 
3
 
4
/*
4
/*
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
6
    Copyright (C) 2014~2025 Min-Jhin,Chen
6
    Copyright (C) 2014~2025 MIN ZHI, CHEN
7
 
7
 
8
    This file is part of QBPWCF.
8
    This file is part of QBPWCF.
9
 
9
 
10
    QBPWCF is free software: you can redistribute it and/or modify
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
11
    it under the terms of the GNU General Public License as published by
Line 17... Line 17...
17
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
    GNU General Public License for more details.
18
    GNU General Public License for more details.
19
 
19
 
20
    You should have received a copy of the GNU General Public License
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/>.
21
    along with QBPWCF.  If not, see <http://www.gnu.org/licenses/>.
22
    
22
 
23
*/
23
*/
24
 
24
 
25
/*
25
/*
26
說明:
26
說明:
27
查詢目標節點(目錄、檔案)的擁有着與權限資訊.
27
查詢目標節點(目錄、檔案)的擁有着與權限資訊.
Line 64... Line 64...
64
	#結束執行,回傳shell 1.
64
	#結束執行,回傳shell 1.
65
	exit(1);
65
	exit(1);
66
 
66
 
67
	}#if end
67
	}#if end
68
 
68
 
69
#設置 include path 
69
#設置 include path
70
set_include_path($output[0].PATH_SEPARATOR.get_include_path());
70
set_include_path($output[0].PATH_SEPARATOR.get_include_path());
71
 
71
 
72
#匯入外部套件
72
#匯入外部套件
73
include("allInOne.php");
73
include("allInOne.php");
74
 
74
 
75
#說明函式
75
#說明函式
76
function help(){
76
function help(){
77
 
77
 
78
	#印出指令說明
78
	#印出指令說明
79
	echo "Usage of ".basename(__FILE__).":".PHP_EOL; 
79
	echo "Usage of ".basename(__FILE__).":".PHP_EOL;
80
	echo "--node path/node 取得指定節點的擁有着與權限資訊".PHP_EOL;
80
	echo "--node path/node 取得指定節點的擁有着與權限資訊".PHP_EOL;
81
	
81
 
82
	#結束執行
82
	#結束執行
83
	exit;
83
	exit;
84
 
84
 
85
	}#function help end
85
	}#function help end
86
 
86
 
Line 108... Line 108...
108
#如果解析參數失敗
108
#如果解析參數失敗
109
if($parseArgu["status"]==="false"){
109
if($parseArgu["status"]==="false"){
110
 
110
 
111
	#印出結果
111
	#印出結果
112
	var_dump($parseArgu);
112
	var_dump($parseArgu);
113
	
113
 
114
	#結束執行,回傳shell 1,代表異常.
114
	#結束執行,回傳shell 1,代表異常.
115
	exit(1);
115
	exit(1);
116
	
116
 
117
	}#if end
117
	}#if end
118
	
118
 
119
#函式說明:
119
#函式說明:
120
#使用 linux 的 uuid 指令來產生 uuid 字串
120
#使用 linux 的 uuid 指令來產生 uuid 字串
121
#回傳結果:
121
#回傳結果:
122
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
122
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
123
#$result["error"],錯誤訊息.
123
#$result["error"],錯誤訊息.
Line 136... Line 136...
136
#如果建立uuid失敗
136
#如果建立uuid失敗
137
if($uuid["status"]==="false"){
137
if($uuid["status"]==="false"){
138
 
138
 
139
	#印出結果
139
	#印出結果
140
	var_dump($uuid);
140
	var_dump($uuid);
141
	
141
 
142
	#結束執行,回傳shell 1,代表異常.
142
	#結束執行,回傳shell 1,代表異常.
143
	exit(1);
143
	exit(1);
144
 
144
 
145
	}#if end
145
	}#if end
146
	
146
 
147
#檢查參數
147
#檢查參數
148
#函式說明:
148
#函式說明:
149
#檢查必填與可省略參數,可省略參數可指定預設要給與什麼數值內容。
149
#檢查必填與可省略參數,可省略參數可指定預設要給與什麼數值內容。
150
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
150
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
151
#$reuslt["error"],執行不正常結束的錯訊息陣列.
151
#$reuslt["error"],執行不正常結束的錯訊息陣列.
Line 196... Line 196...
196
#若執行失敗
196
#若執行失敗
197
if($checkArguments["status"]==="false"){
197
if($checkArguments["status"]==="false"){
198
 
198
 
199
	#印出結果
199
	#印出結果
200
	var_dump($checkArguments);
200
	var_dump($checkArguments);
201
	
201
 
202
	#結束執行,回傳shell 1,代表異常.
202
	#結束執行,回傳shell 1,代表異常.
203
	exit(1);
203
	exit(1);
204
 
204
 
205
	}#if end
205
	}#if end
206
 
206
 
207
#若檢查不通過
207
#若檢查不通過
208
if($checkArguments["passed"]==="false"){
208
if($checkArguments["passed"]==="false"){
209
 
209
 
210
	#提示用法
210
	#提示用法
211
	help();
211
	help();
212
	
212
 
213
	#結束執行
213
	#結束執行
214
	exit;
214
	exit;
215
 
215
 
216
	}#if end
216
	}#if end
217
 
217
 
Line 222... Line 222...
222
#函式說明:
222
#函式說明:
223
#取得節點的資訊.
223
#取得節點的資訊.
224
#回傳結果:
224
#回傳結果:
225
#$result["status"],"true"爲建立成功,"false"爲建立失敗.
225
#$result["status"],"true"爲建立成功,"false"爲建立失敗.
226
#$result["error"],錯誤訊息陣列.
226
#$result["error"],錯誤訊息陣列.
227
#$result["function"],函數名稱. 
227
#$result["function"],函數名稱.
228
#$result["content"],檔案資訊陣列.
228
#$result["content"],檔案資訊陣列.
229
#$result["content"]["is_folder"],是否為目錄,"true"代表是,"false"代表不是.	
229
#$result["content"]["is_folder"],是否為目錄,"true"代表是,"false"代表不是.
230
#$result["content"]["ownerPerm"],檔案擁有者權限資訊.
230
#$result["content"]["ownerPerm"],檔案擁有者權限資訊.
231
#$result["content"]["groupPerm"],檔案歸屬群組權限資訊.
231
#$result["content"]["groupPerm"],檔案歸屬群組權限資訊.
232
#$result["content"]["otherPerm"],檔案對於其他身份使用者的權限資訊.
232
#$result["content"]["otherPerm"],檔案對於其他身份使用者的權限資訊.
233
#$result["content"]["subElementCount"],目錄底下的檔案目錄數量.
233
#$result["content"]["subElementCount"],目錄底下的檔案目錄數量.
234
#$result["content"]["ownerName"],檔案擁有着資訊.
234
#$result["content"]["ownerName"],檔案擁有着資訊.
Line 257... Line 257...
257
#如果執行異常
257
#如果執行異常
258
if($fileInfo["status"]==="false"){
258
if($fileInfo["status"]==="false"){
259
 
259
 
260
	#印出結果
260
	#印出結果
261
	var_dump($fileInfo);
261
	var_dump($fileInfo);
262
	
262
 
263
	#結束執行,回傳shell 1,代表異常.
263
	#結束執行,回傳shell 1,代表異常.
264
	exit(1);
264
	exit(1);
265
 
265
 
266
	}#if end
266
	}#if end
267
	
267
 
268
#印出結果
268
#印出結果
269
echo json_encode($fileInfo["content"]);
-
 
270
269
echo json_encode($fileInfo["content"]);
-
 
270