| Line 25... |
Line 25... |
| 25 |
|
25 |
|
| 26 |
#使用 qbpwcf 命名空間
|
26 |
#使用 qbpwcf 命名空間
|
| 27 |
namespace qbpwcf;
|
27 |
namespace qbpwcf;
|
| 28 |
|
28 |
|
| 29 |
#以該檔案的實際位置的 lib path 為 include path 首位
|
29 |
#以該檔案的實際位置的 lib path 為 include path 首位
|
| 30 |
exec("cd ".pathinfo(__FILE__)["dirname"]."/qbpwcf;pwd;",$output,$status);
|
30 |
exec("cd ".pathinfo(__FILE__)["dirname"]."/usr/lib/qbpwcf/;pwd;",$output,$status);
|
| 31 |
set_include_path($output[0].PATH_SEPARATOR.get_include_path());
|
31 |
set_include_path($output[0].PATH_SEPARATOR.get_include_path());
|
| 32 |
|
32 |
|
| 33 |
#匯入套件
|
33 |
#匯入套件
|
| 34 |
require_once("allInOne.php");
|
34 |
require_once("allInOne.php");
|
| 35 |
|
35 |
|
| Line 41... |
Line 41... |
| 41 |
|
41 |
|
| 42 |
#help
|
42 |
#help
|
| 43 |
echo basename($_SERVER["PHP_SELF"])." is a program to install QBPWCF.".PHP_EOL;
|
43 |
echo basename($_SERVER["PHP_SELF"])." is a program to install QBPWCF.".PHP_EOL;
|
| 44 |
echo basename($_SERVER["PHP_SELF"])." usage:".PHP_EOL;
|
44 |
echo basename($_SERVER["PHP_SELF"])." usage:".PHP_EOL;
|
| 45 |
echo "If run it without any argument, QBPWCF will be installed defaultly".PHP_EOL;
|
45 |
echo "If run it without any argument, QBPWCF will be installed defaultly".PHP_EOL;
|
| 46 |
echo "--rootPath path where QBPWCF to put. Default is /usr/lib/".PHP_EOL;
|
46 |
echo "--libOfRootPath path where QBPWCF to put. Default is /usr/lib".PHP_EOL;
|
| 47 |
echo "--name folder name where QBPWCF to put inside. Default is qbpwcf".PHP_EOL;
|
47 |
echo "--name folder name where QBPWCF to put inside. Default is qbpwcf".PHP_EOL;
|
| 48 |
echo "--mode cp/link, default is link".PHP_EOL;
|
48 |
echo "--mode cp/link, default is link".PHP_EOL;
|
| 49 |
echo "\tcp means copy and overwrite to installation path".PHP_EOL;
|
49 |
echo "\tcp means copy and overwrite to installation path".PHP_EOL;
|
| 50 |
echo "\tlink means create a softlink from current path to installation path".PHP_EOL;
|
50 |
echo "\tlink means create a softlink from current path to installation path".PHP_EOL;
|
| 51 |
echo "--configUrl ur, specify url to get config, default is https://config.qbpwcf.org".PHP_EOL;
|
51 |
echo "--configUrl ur, specify url to get config, default is https://config.qbpwcf.org".PHP_EOL;
|
| Line 182... |
Line 182... |
| 182 |
exit(1);
|
182 |
exit(1);
|
| 183 |
|
183 |
|
| 184 |
}#if end
|
184 |
}#if end
|
| 185 |
|
185 |
|
| 186 |
#預設的套件安裝位置
|
186 |
#預設的套件安裝位置
|
| 187 |
$rootPath="/usr/lib/";
|
187 |
$libOfRootPath="/usr/lib/";
|
| 188 |
|
188 |
|
| 189 |
#預設的套件資料夾名稱
|
189 |
#預設的套件資料夾名稱
|
| 190 |
$name="qbpwcf";
|
190 |
$name="qbpwcf";
|
| 191 |
|
191 |
|
| 192 |
#預設運作模式為 "link" 亦即建立軟連結
|
192 |
#預設運作模式為 "link" 亦即建立軟連結
|
| Line 262... |
Line 262... |
| 262 |
#$conf["canNotBeEmpty"],字串陣列,哪些必填參數的內容不得為空字串或空陣列,僅當$conf["canBeEmptyString"]為"true"時會生效.
|
262 |
#$conf["canNotBeEmpty"],字串陣列,哪些必填參數的內容不得為空字串或空陣列,僅當$conf["canBeEmptyString"]為"true"時會生效.
|
| 263 |
#$conf["canNotBeEmpty"]=array();
|
263 |
#$conf["canNotBeEmpty"]=array();
|
| 264 |
#$conf["canBeEmpty"],字串陣列,哪些必填參數的內容可為空字串或空陣列,僅當$conf["canBeEmptyString"]為"false"時會生效.
|
264 |
#$conf["canBeEmpty"],字串陣列,哪些必填參數的內容可為空字串或空陣列,僅當$conf["canBeEmptyString"]為"false"時會生效.
|
| 265 |
#$conf["canBeEmpty"]=array();
|
265 |
#$conf["canBeEmpty"]=array();
|
| 266 |
#$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或空陣列.
|
266 |
#$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或空陣列.
|
| 267 |
$conf["skipableVariableCanNotBeEmpty"]=array("rootPath","name","mode","configUrl","getIpUrl","ip","dbAcct","dbPass","dbName","dbAddr","dbPort","sshAddrAndPort","headless","whiteIp","libonly");
|
267 |
$conf["skipableVariableCanNotBeEmpty"]=array("libOfRootPath","name","mode","configUrl","getIpUrl","ip","dbAcct","dbPass","dbName","dbAddr","dbPort","sshAddrAndPort","headless","whiteIp","libonly");
|
| 268 |
#$conf["skipableVariableName"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
|
268 |
#$conf["skipableVariableName"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
|
| 269 |
$conf["skipableVariableName"]=array("rootPath","name","mode","configUrl","getIpUrl","ip","dbAcct","dbPass","dbName","dbAddr","dbPort","sshAddrAndPort","headless","whiteIp","libonly");
|
269 |
$conf["skipableVariableName"]=array("libOfRootPath","name","mode","configUrl","getIpUrl","ip","dbAcct","dbPass","dbName","dbAddr","dbPort","sshAddrAndPort","headless","whiteIp","libonly");
|
| 270 |
#$conf["skipableVariableType"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
|
270 |
#$conf["skipableVariableType"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
|
| 271 |
$conf["skipableVariableType"]=array("array","array","array","array","array","array","array","array","array","array","array","array","array","array","array");
|
271 |
$conf["skipableVariableType"]=array("array","array","array","array","array","array","array","array","array","array","array","array","array","array","array");
|
| 272 |
#$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
|
272 |
#$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
|
| 273 |
$conf["skipableVarDefaultValue"]=array(null,null,null,null,null,null,null,null,null,null,null,null,null);
|
273 |
$conf["skipableVarDefaultValue"]=array(null,null,null,null,null,null,null,null,null,null,null,null,null);
|
| 274 |
#$conf["disallowAllSkipableVarIsEmpty"],字串,是否允許每個可省略參數都為空字串,預設為"true"允許,反之為"false".
|
274 |
#$conf["disallowAllSkipableVarIsEmpty"],字串,是否允許每個可省略參數都為空字串,預設為"true"允許,反之為"false".
|
| 275 |
#$conf["disallowAllSkipableVarIsEmpty"]="";
|
275 |
#$conf["disallowAllSkipableVarIsEmpty"]="";
|
| 276 |
#$conf["disallowAllSkipableVarIsEmptyArray"],字串,是否允許每個可省略參數都為空陣列,預設為"true"允許,反之為"false".
|
276 |
#$conf["disallowAllSkipableVarIsEmptyArray"],字串,是否允許每個可省略參數都為空陣列,預設為"true"允許,反之為"false".
|
| 277 |
#$conf["disallowAllSkipableVarIsEmptyArray"]="";
|
277 |
#$conf["disallowAllSkipableVarIsEmptyArray"]="";
|
| 278 |
#$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
|
278 |
#$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
|
| 279 |
$conf["arrayCountEqualCheck"][]=array("rootPath","name","mode","configUrl","getIpUrl","ip","dbAcct","dbPass","dbName","dbAddr","dbPort","headless","libonly");
|
279 |
#$conf["arrayCountEqualCheck"][]=array("libOfRootPath","name","mode","configUrl","getIpUrl","ip","dbAcct","dbPass","dbName","dbAddr","dbPort","headless","libonly");
|
| 280 |
#參考資料:
|
280 |
#參考資料:
|
| 281 |
#array_keys=>http://php.net/manual/en/function.array-keys.php
|
281 |
#array_keys=>http://php.net/manual/en/function.array-keys.php
|
| 282 |
#備註:
|
282 |
#備註:
|
| 283 |
#無.
|
283 |
#無.
|
| 284 |
$checkArguments=variableCheck::checkArguments($conf);
|
284 |
$checkArguments=variableCheck::checkArguments($conf);
|
| Line 286... |
Line 286... |
| 286 |
|
286 |
|
| 287 |
#如果有設置參數
|
287 |
#如果有設置參數
|
| 288 |
if(count($parseArgu["content"])>0){
|
288 |
if(count($parseArgu["content"])>0){
|
| 289 |
|
289 |
|
| 290 |
#如果有 rootPath 參數
|
290 |
#如果有 rootPath 參數
|
| 291 |
if(isset($parseArgu["content"]["rootPath"])){
|
291 |
if(isset($parseArgu["content"]["libOfRootPath"])){
|
| 292 |
|
292 |
|
| 293 |
#如果有 rootPath 參數存在
|
293 |
#如果有 rootPath 參數存在
|
| 294 |
if(isset($parseArgu["content"]["rootPath"][0])){
|
294 |
if(isset($parseArgu["content"]["libOfRootPath"][0])){
|
| 295 |
|
295 |
|
| 296 |
#更新套件的安裝位置
|
296 |
#更新套件的安裝位置
|
| 297 |
$rootPath=$parseArgu["content"]["rootPath"][0];
|
297 |
$libOfRootPath=$parseArgu["content"]["libOfRootPath"][0];
|
| 298 |
|
298 |
|
| 299 |
#如果路徑不為 "/" 結束
|
299 |
#如果路徑不為 "/" 結束
|
| 300 |
if($rootPath[strlen($rootPath)-1]!=="/"){
|
300 |
if($libOfRootPath[strlen($libOfRootPath)-1]!=="/"){
|
| 301 |
|
301 |
|
| 302 |
#補上 "/"
|
302 |
#補上 "/"
|
| 303 |
$rootPath=$rootPath."/";
|
303 |
$libOfRootPath=$libOfRootPath."/";
|
| 304 |
|
304 |
|
| 305 |
}#if end
|
305 |
}#if end
|
| 306 |
|
306 |
|
| 307 |
}#if end
|
307 |
}#if end
|
| 308 |
|
308 |
|
| Line 509... |
Line 509... |
| 509 |
#$result["content"],軟連結的資訊.
|
509 |
#$result["content"],軟連結的資訊.
|
| 510 |
#必填參數:
|
510 |
#必填參數:
|
| 511 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
511 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
| 512 |
$conf["fileArgu"]=__FILE__;
|
512 |
$conf["fileArgu"]=__FILE__;
|
| 513 |
#$conf["linkTo"],字串,軟連結要指向哪邊.
|
513 |
#$conf["linkTo"],字串,軟連結要指向哪邊.
|
| 514 |
$conf["linkTo"]="qbpwcf/allInOneForCI.php";
|
514 |
$conf["linkTo"]="usr/lib/qbpwcf/allInOneForCI.php";
|
| 515 |
#可省略參數:
|
515 |
#可省略參數:
|
| 516 |
#$conf["path"],字串,軟連結要放在哪邊,預設為當前位置.
|
516 |
#$conf["path"],字串,軟連結要放在哪邊,預設為當前位置.
|
| 517 |
$conf["path"]="qbpwcf";
|
517 |
$conf["path"]="usr/lib/qbpwcf";
|
| 518 |
#$conf["name"],字串,軟連結的名稱,預設為 "linkTo" 參數的檔案或目錄名稱.
|
518 |
#$conf["name"],字串,軟連結的名稱,預設為 "linkTo" 參數的檔案或目錄名稱.
|
| 519 |
$conf["name"]="allInOne.php";
|
519 |
$conf["name"]="allInOne.php";
|
| 520 |
#$conf["overWrite"],字串,"true"代表要移除既有的項目名稱,來重新建立軟連結;預設為"false"不進行處理.
|
520 |
#$conf["overWrite"],字串,"true"代表要移除既有的項目名稱,來重新建立軟連結;預設為"false"不進行處理.
|
| 521 |
$conf["overWrite"]="true";
|
521 |
$conf["overWrite"]="true";
|
| 522 |
#參考資料:
|
522 |
#參考資料:
|
| Line 578... |
Line 578... |
| 578 |
#$result["function"],當前執行的函式名稱.
|
578 |
#$result["function"],當前執行的函式名稱.
|
| 579 |
#必填參數:
|
579 |
#必填參數:
|
| 580 |
#$conf["mode"],字串,提示輸入的文字描述,$conf["commentsArray"][$i]代表第($+1)行的描述.
|
580 |
#$conf["mode"],字串,提示輸入的文字描述,$conf["commentsArray"][$i]代表第($+1)行的描述.
|
| 581 |
$conf["mode"]="+x";
|
581 |
$conf["mode"]="+x";
|
| 582 |
#$conf["target"],字串,需要變更權限的目標.
|
582 |
#$conf["target"],字串,需要變更權限的目標.
|
| 583 |
$conf["target"]="qbpwcf/usr/bin";
|
583 |
$conf["target"]="usr/bin";
|
| 584 |
#可省略參數:
|
584 |
#可省略參數:
|
| 585 |
#$conf["recursive"],字串,"true"代表目標目錄底下的內容都要套用,預設為"false".
|
585 |
#$conf["recursive"],字串,"true"代表目標目錄底下的內容都要套用,預設為"false".
|
| 586 |
$conf["recursive"]="true";
|
586 |
$conf["recursive"]="true";
|
| 587 |
#參考資料:
|
587 |
#參考資料:
|
| 588 |
#無.
|
588 |
#無.
|
| Line 645... |
Line 645... |
| 645 |
#$result["function"],當前執行的函式名稱.
|
645 |
#$result["function"],當前執行的函式名稱.
|
| 646 |
#必填參數:
|
646 |
#必填參數:
|
| 647 |
#$conf["mode"],字串,提示輸入的文字描述,$conf["commentsArray"][$i]代表第($+1)行的描述.
|
647 |
#$conf["mode"],字串,提示輸入的文字描述,$conf["commentsArray"][$i]代表第($+1)行的描述.
|
| 648 |
$conf["mode"]="777";
|
648 |
$conf["mode"]="777";
|
| 649 |
#$conf["target"],字串,需要變更權限的目標.
|
649 |
#$conf["target"],字串,需要變更權限的目標.
|
| 650 |
$conf["target"]="qbpwcf/db";
|
650 |
$conf["target"]="usr/lib/qbpwcf/db";
|
| 651 |
#可省略參數:
|
651 |
#可省略參數:
|
| 652 |
#$conf["recursive"],字串,"true"代表目標目錄底下的內容都要套用,預設為"false".
|
652 |
#$conf["recursive"],字串,"true"代表目標目錄底下的內容都要套用,預設為"false".
|
| 653 |
#$conf["recursive"]="";
|
653 |
#$conf["recursive"]="";
|
| 654 |
#參考資料:
|
654 |
#參考資料:
|
| 655 |
#無.
|
655 |
#無.
|
| Line 713... |
Line 713... |
| 713 |
#$result["content"],軟連結的資訊.
|
713 |
#$result["content"],軟連結的資訊.
|
| 714 |
#必填參數:
|
714 |
#必填參數:
|
| 715 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
715 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
| 716 |
$conf["fileArgu"]=__FILE__;
|
716 |
$conf["fileArgu"]=__FILE__;
|
| 717 |
#$conf["file"],字串,要更新的檔案位置與名稱.
|
717 |
#$conf["file"],字串,要更新的檔案位置與名稱.
|
| 718 |
$conf["file"]="qbpwcf/etc/config.php";
|
718 |
$conf["file"]="etc/qbpwcf/config.php";
|
| 719 |
#可省略參數:
|
719 |
#可省略參數:
|
| 720 |
#$conf["overWriteWith"],字串陣列,要置換成什麼樣的內容,每個元素代表一行內容.
|
720 |
#$conf["overWriteWith"],字串陣列,要置換成什麼樣的內容,每個元素代表一行內容.
|
| 721 |
$conf["overWriteWith"][]="<?php";
|
721 |
$conf["overWriteWith"][]="<?php";
|
| 722 |
$conf["overWriteWith"][]="";
|
722 |
$conf["overWriteWith"][]="";
|
| 723 |
$conf["overWriteWith"][]="#specify host ip";
|
723 |
$conf["overWriteWith"][]="#specify host ip";
|
| Line 791... |
Line 791... |
| 791 |
#$result["function"],當前執行的函式名稱.
|
791 |
#$result["function"],當前執行的函式名稱.
|
| 792 |
#必填參數:
|
792 |
#必填參數:
|
| 793 |
#$conf["mode"],字串,提示輸入的文字描述,$conf["commentsArray"][$i]代表第($+1)行的描述.
|
793 |
#$conf["mode"],字串,提示輸入的文字描述,$conf["commentsArray"][$i]代表第($+1)行的描述.
|
| 794 |
$conf["mode"]="777";
|
794 |
$conf["mode"]="777";
|
| 795 |
#$conf["target"],字串,需要變更權限的目標.
|
795 |
#$conf["target"],字串,需要變更權限的目標.
|
| 796 |
$conf["target"]="qbpwcf/etc/config.php";
|
796 |
$conf["target"]="etc/qbpwcf/config.php";
|
| 797 |
#可省略參數:
|
797 |
#可省略參數:
|
| 798 |
#$conf["recursive"],字串,"true"代表目標目錄底下的內容都要套用,預設為"false".
|
798 |
#$conf["recursive"],字串,"true"代表目標目錄底下的內容都要套用,預設為"false".
|
| 799 |
#$conf["recursive"]="";
|
799 |
#$conf["recursive"]="";
|
| 800 |
#參考資料:
|
800 |
#參考資料:
|
| 801 |
#無.
|
801 |
#無.
|
| Line 853... |
Line 853... |
| 853 |
#$result["content"],軟連結的資訊.
|
853 |
#$result["content"],軟連結的資訊.
|
| 854 |
#必填參數:
|
854 |
#必填參數:
|
| 855 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
855 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
| 856 |
$conf["fileArgu"]=__FILE__;
|
856 |
$conf["fileArgu"]=__FILE__;
|
| 857 |
#$conf["file"],字串,要更新的檔案位置與名稱.
|
857 |
#$conf["file"],字串,要更新的檔案位置與名稱.
|
| 858 |
$conf["file"]="qbpwcf/usr/local/etc/backupDb.conf";
|
858 |
$conf["file"]="etc/qbpwcf/backupDb.conf";
|
| 859 |
#可省略參數:
|
859 |
#可省略參數:
|
| 860 |
#$conf["overWriteWith"],字串陣列,要置換成什麼樣的內容,每個元素代表一行內容.
|
860 |
#$conf["overWriteWith"],字串陣列,要置換成什麼樣的內容,每個元素代表一行內容.
|
| 861 |
$conf["overWriteWith"]=array();
|
861 |
$conf["overWriteWith"]=array();
|
| 862 |
$conf["overWriteWith"][]="<?php";
|
862 |
$conf["overWriteWith"][]="<?php";
|
| 863 |
$conf["overWriteWith"][]="#資料庫連線帳號";
|
863 |
$conf["overWriteWith"][]="#資料庫連線帳號";
|
| Line 924... |
Line 924... |
| 924 |
#異常結束執行
|
924 |
#異常結束執行
|
| 925 |
exit(1);
|
925 |
exit(1);
|
| 926 |
|
926 |
|
| 927 |
}#if end
|
927 |
}#if end
|
| 928 |
|
928 |
|
| 929 |
#重新建置 qbpwcf/usr/local/etc/qbpwcf.conf.xml
|
929 |
#重新建置 etc/qbpwcf.conf.xml
|
| 930 |
#函式說明:
|
930 |
#函式說明:
|
| 931 |
#更新檔案內容.
|
931 |
#更新檔案內容.
|
| 932 |
#回傳結果:
|
932 |
#回傳結果:
|
| 933 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
933 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
| 934 |
#$result["error"],錯誤訊息.
|
934 |
#$result["error"],錯誤訊息.
|
| Line 936... |
Line 936... |
| 936 |
#$result["content"],軟連結的資訊.
|
936 |
#$result["content"],軟連結的資訊.
|
| 937 |
#必填參數:
|
937 |
#必填參數:
|
| 938 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
938 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
| 939 |
$conf["fileArgu"]=__FILE__;
|
939 |
$conf["fileArgu"]=__FILE__;
|
| 940 |
#$conf["file"],字串,要更新的檔案位置與名稱.
|
940 |
#$conf["file"],字串,要更新的檔案位置與名稱.
|
| 941 |
$conf["file"]="qbpwcf/usr/local/etc/qbpwcf.conf.xml";
|
941 |
$conf["file"]="etc/qbpwcf/qbpwcf.conf.xml";
|
| 942 |
#可省略參數:
|
942 |
#可省略參數:
|
| 943 |
#$conf["overWriteWith"],字串陣列,要置換成什麼樣的內容,每個元素代表一行內容.
|
943 |
#$conf["overWriteWith"],字串陣列,要置換成什麼樣的內容,每個元素代表一行內容.
|
| 944 |
$conf["overWriteWith"]=array();
|
944 |
$conf["overWriteWith"]=array();
|
| 945 |
$conf["overWriteWith"][]="<?xml version=\"1.0\"?>";
|
945 |
$conf["overWriteWith"][]="<?xml version=\"1.0\"?>";
|
| 946 |
$conf["overWriteWith"][]="<root></root>";
|
946 |
$conf["overWriteWith"][]="<root></root>";
|
| Line 994... |
Line 994... |
| 994 |
#異常結束執行
|
994 |
#異常結束執行
|
| 995 |
exit(1);
|
995 |
exit(1);
|
| 996 |
|
996 |
|
| 997 |
}#if end
|
997 |
}#if end
|
| 998 |
|
998 |
|
| 999 |
#讓 "qbpwcf/usr/local/etc/qbpwcf.conf.xml" 可以被大家使用.
|
999 |
#讓 "etc/qbpwcf.conf.xml" 可以被大家使用.
|
| 1000 |
#函式說明:
|
1000 |
#函式說明:
|
| 1001 |
#使用 linux 的 chmod 指令來修改目標檔案或目錄的權限.
|
1001 |
#使用 linux 的 chmod 指令來修改目標檔案或目錄的權限.
|
| 1002 |
#回傳結果:
|
1002 |
#回傳結果:
|
| 1003 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
1003 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
| 1004 |
#$result["error"],錯誤訊息.
|
1004 |
#$result["error"],錯誤訊息.
|
| 1005 |
#$result["function"],當前執行的函式名稱.
|
1005 |
#$result["function"],當前執行的函式名稱.
|
| 1006 |
#必填參數:
|
1006 |
#必填參數:
|
| 1007 |
#$conf["mode"],字串,提示輸入的文字描述,$conf["commentsArray"][$i]代表第($+1)行的描述.
|
1007 |
#$conf["mode"],字串,提示輸入的文字描述,$conf["commentsArray"][$i]代表第($+1)行的描述.
|
| 1008 |
$conf["mode"]="777";
|
1008 |
$conf["mode"]="777";
|
| 1009 |
#$conf["target"],字串,需要變更權限的目標.
|
1009 |
#$conf["target"],字串,需要變更權限的目標.
|
| 1010 |
$conf["target"]="qbpwcf/usr/local/etc/qbpwcf.conf.xml";
|
1010 |
$conf["target"]="etc/qbpwcf/qbpwcf.conf.xml";
|
| 1011 |
#可省略參數:
|
1011 |
#可省略參數:
|
| 1012 |
#$conf["recursive"],字串,"true"代表目標目錄底下的內容都要套用,預設為"false".
|
1012 |
#$conf["recursive"],字串,"true"代表目標目錄底下的內容都要套用,預設為"false".
|
| 1013 |
#$conf["recursive"]="";
|
1013 |
#$conf["recursive"]="";
|
| 1014 |
#參考資料:
|
1014 |
#參考資料:
|
| 1015 |
#無.
|
1015 |
#無.
|
| Line 1173... |
Line 1173... |
| 1173 |
|
1173 |
|
| 1174 |
}#if end
|
1174 |
}#if end
|
| 1175 |
|
1175 |
|
| 1176 |
}#if end
|
1176 |
}#if end
|
| 1177 |
|
1177 |
|
| 1178 |
#移除 qbpwcf/usr/lib/systemd/system 底下服務設定檔的執行權限
|
1178 |
#移除 etc/systemd/system 底下服務設定檔的執行權限
|
| 1179 |
#函式說明:
|
1179 |
#函式說明:
|
| 1180 |
#使用 linux 的 chmod 指令來修改目標檔案或目錄的權限.
|
1180 |
#使用 linux 的 chmod 指令來修改目標檔案或目錄的權限.
|
| 1181 |
#回傳結果:
|
1181 |
#回傳結果:
|
| 1182 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
1182 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
| 1183 |
#$result["error"],錯誤訊息.
|
1183 |
#$result["error"],錯誤訊息.
|
| 1184 |
#$result["function"],當前執行的函式名稱.
|
1184 |
#$result["function"],當前執行的函式名稱.
|
| 1185 |
#必填參數:
|
1185 |
#必填參數:
|
| 1186 |
#$conf["mode"],字串,提示輸入的文字描述,$conf["commentsArray"][$i]代表第($+1)行的描述.
|
1186 |
#$conf["mode"],字串,提示輸入的文字描述,$conf["commentsArray"][$i]代表第($+1)行的描述.
|
| 1187 |
$conf["mode"]="640";
|
1187 |
$conf["mode"]="640";
|
| 1188 |
#$conf["target"],字串,需要變更權限的目標.
|
1188 |
#$conf["target"],字串,需要變更權限的目標.
|
| 1189 |
$conf["target"]="qbpwcf/usr/lib/systemd/system";
|
1189 |
$conf["target"]="etc/systemd/system";
|
| 1190 |
#可省略參數:
|
1190 |
#可省略參數:
|
| 1191 |
#$conf["recursive"],字串,"true"代表目標目錄底下的內容都要套用,預設為"false".
|
1191 |
#$conf["recursive"],字串,"true"代表目標目錄底下的內容都要套用,預設為"false".
|
| 1192 |
$conf["recursive"]="true";
|
1192 |
$conf["recursive"]="true";
|
| 1193 |
#$conf["excludeSelf"],字串,預設為"false"代表不處理;若為"true"則會排除目標自己(資料夾).
|
1193 |
#$conf["excludeSelf"],字串,預設為"false"代表不處理;若為"true"則會排除目標自己(資料夾).
|
| 1194 |
$conf["excludeSelf"]="true";
|
1194 |
$conf["excludeSelf"]="true";
|
| Line 1759... |
Line 1759... |
| 1759 |
#執行到這邊就好
|
1759 |
#執行到這邊就好
|
| 1760 |
exit(0);
|
1760 |
exit(0);
|
| 1761 |
|
1761 |
|
| 1762 |
}#if end
|
1762 |
}#if end
|
| 1763 |
|
1763 |
|
| 1764 |
#於 /usr/bin 底下建立 $rootPath.$name."/usr/bin" 底下所有檔案的軟連結.
|
1764 |
#於 /usr/bin 底下建立 $pathinfo(__FILE__)["dirname"]."/usr/bin" 底下所有檔案的軟連結.
|
| 1765 |
#函式說明:
|
1765 |
#函式說明:
|
| 1766 |
#針對特定目錄下的內容建立軟連結.
|
1766 |
#針對特定目錄下的內容建立軟連結.
|
| 1767 |
#回傳結果:
|
1767 |
#回傳結果:
|
| 1768 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
1768 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
| 1769 |
#$result["error"],錯誤訊息.
|
1769 |
#$result["error"],錯誤訊息.
|
| Line 1771... |
Line 1771... |
| 1771 |
#$result["content"],字串陣列,每個建立的軟連結資訊.
|
1771 |
#$result["content"],字串陣列,每個建立的軟連結資訊.
|
| 1772 |
#必填參數:
|
1772 |
#必填參數:
|
| 1773 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
1773 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
| 1774 |
$conf["fileArgu"]=__FILE__;
|
1774 |
$conf["fileArgu"]=__FILE__;
|
| 1775 |
#$conf["linkToDir"],字串,軟連結要指向哪個目錄底下的內容.
|
1775 |
#$conf["linkToDir"],字串,軟連結要指向哪個目錄底下的內容.
|
| 1776 |
$conf["linkToDir"]=$rootPath.$name."/usr/bin";
|
1776 |
$conf["linkToDir"]=$pathinfo(__FILE__)["dirname"]."/usr/bin";
|
| 1777 |
#可省略參數:
|
1777 |
#可省略參數:
|
| 1778 |
#$conf["path"],字串,軟連結要放在哪邊,預設為當前位置.
|
1778 |
#$conf["path"],字串,軟連結要放在哪邊,預設為當前位置.
|
| 1779 |
$conf["path"]="/usr/bin";
|
1779 |
$conf["path"]="/usr/bin";
|
| 1780 |
#$conf["name"],字串陣列,軟連結的名稱,預設為 "linkToDir" 目錄底下的檔案或目錄名稱.若要指定特定檔案目錄的軟連結名稱,則可以用 $conf["name"][]=array("原始名稱","新的名稱"); 來指定.
|
1780 |
#$conf["name"],字串陣列,軟連結的名稱,預設為 "linkToDir" 目錄底下的檔案或目錄名稱.若要指定特定檔案目錄的軟連結名稱,則可以用 $conf["name"][]=array("原始名稱","新的名稱"); 來指定.
|
| 1781 |
#$conf["name"]=array(array("oriName","newName"));
|
1781 |
#$conf["name"]=array(array("oriName","newName"));
|
| 1782 |
#$conf["overWrite"],字串,"true"代表要移除既有的項目名稱,來重新建立軟連結;預設為"false"不進行處理.
|
1782 |
#$conf["overWrite"],字串,"true"代表要移除既有的項目名稱,來重新建立軟連結;預設為"false"不進行處理.
|
| 1783 |
$conf["overWrite"]="true";
|
1783 |
$conf["overWrite"]="true";
|
| 1784 |
#參考資料:
|
1784 |
#參考資料:
|
| 1785 |
#無.
|
1785 |
#無.$
|
| 1786 |
#備註:
|
1786 |
#備註:
|
| 1787 |
#無.
|
1787 |
#無.
|
| 1788 |
$createMultiLinkInDir=fileAccess::createMultiLinkInDir($conf);
|
1788 |
$createMultiLinkInDir=fileAccess::createMultiLinkInDir($conf);
|
| 1789 |
unset($conf);
|
1789 |
unset($conf);
|
| 1790 |
|
1790 |
|
| Line 1825... |
Line 1825... |
| 1825 |
#異常結束執行
|
1825 |
#異常結束執行
|
| 1826 |
exit(1);
|
1826 |
exit(1);
|
| 1827 |
|
1827 |
|
| 1828 |
}#if end
|
1828 |
}#if end
|
| 1829 |
|
1829 |
|
| 1830 |
#於 /usr/bin/libexec 底下建立 $rootPath.$name."/usr/bin/libexec" 底下所有檔案的軟連結.
|
1830 |
#於 /usr/bin/libexec 底下建立 $pathinfo(__FILE__)["dirname"]."/usr/bin/libexec" 底下所有檔案的軟連結.
|
| 1831 |
#函式說明:
|
1831 |
#函式說明:
|
| 1832 |
#針對特定目錄下的內容建立軟連結.
|
1832 |
#針對特定目錄下的內容建立軟連結.
|
| 1833 |
#回傳結果:
|
1833 |
#回傳結果:
|
| 1834 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
1834 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
| 1835 |
#$result["error"],錯誤訊息.
|
1835 |
#$result["error"],錯誤訊息.
|
| Line 1837... |
Line 1837... |
| 1837 |
#$result["content"],字串陣列,每個建立的軟連結資訊.
|
1837 |
#$result["content"],字串陣列,每個建立的軟連結資訊.
|
| 1838 |
#必填參數:
|
1838 |
#必填參數:
|
| 1839 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
1839 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
| 1840 |
$conf["fileArgu"]=__FILE__;
|
1840 |
$conf["fileArgu"]=__FILE__;
|
| 1841 |
#$conf["linkToDir"],字串,軟連結要指向哪個目錄底下的內容.
|
1841 |
#$conf["linkToDir"],字串,軟連結要指向哪個目錄底下的內容.
|
| 1842 |
$conf["linkToDir"]=$rootPath.$name."/usr/bin/libexec";
|
1842 |
$conf["linkToDir"]=$pathinfo(__FILE__)["dirname"]."/usr/bin/libexec";
|
| 1843 |
#可省略參數:
|
1843 |
#可省略參數:
|
| 1844 |
#$conf["path"],字串,軟連結要放在哪邊,預設為當前位置.
|
1844 |
#$conf["path"],字串,軟連結要放在哪邊,預設為當前位置.
|
| 1845 |
$conf["path"]="/usr/binlibexec";
|
1845 |
$conf["path"]="/usr/bin/libexec";
|
| 1846 |
#$conf["name"],字串陣列,軟連結的名稱,預設為 "linkToDir" 目錄底下的檔案或目錄名稱.若要指定特定檔案目錄的軟連結名稱,則可以用 $conf["name"][]=array("原始名稱","新的名稱"); 來指定.
|
1846 |
#$conf["name"],字串陣列,軟連結的名稱,預設為 "linkToDir" 目錄底下的檔案或目錄名稱.若要指定特定檔案目錄的軟連結名稱,則可以用 $conf["name"][]=array("原始名稱","新的名稱"); 來指定.
|
| 1847 |
#$conf["name"]=array(array("oriName","newName"));
|
1847 |
#$conf["name"]=array(array("oriName","newName"));
|
| 1848 |
#$conf["overWrite"],字串,"true"代表要移除既有的項目名稱,來重新建立軟連結;預設為"false"不進行處理.
|
1848 |
#$conf["overWrite"],字串,"true"代表要移除既有的項目名稱,來重新建立軟連結;預設為"false"不進行處理.
|
| 1849 |
$conf["overWrite"]="true";
|
1849 |
$conf["overWrite"]="true";
|
| 1850 |
#參考資料:
|
1850 |
#參考資料:
|
| Line 1909... |
Line 1909... |
| 1909 |
#$result["varNameFullPath"][$i],爲第$i個資料夾或檔案的完整檔案系統路徑與名稱,如果不存在則代表路徑是網址.
|
1909 |
#$result["varNameFullPath"][$i],爲第$i個資料夾或檔案的完整檔案系統路徑與名稱,如果不存在則代表路徑是網址.
|
| 1910 |
#$result["varNameWebPath"][$i],為第$i個資料夾或檔案的網址,若"web"參數為"true",才會有該內容.
|
1910 |
#$result["varNameWebPath"][$i],為第$i個資料夾或檔案的網址,若"web"參數為"true",才會有該內容.
|
| 1911 |
#$result["varExist"][$i],爲第$i個資料夾或檔案是否存在,"true"代表存在,"false"代表不存在。
|
1911 |
#$result["varExist"][$i],爲第$i個資料夾或檔案是否存在,"true"代表存在,"false"代表不存在。
|
| 1912 |
#必填參數:
|
1912 |
#必填參數:
|
| 1913 |
#$conf["fileArray"],陣列字串,要檢查是否存在的檔案有哪些,須爲一維陣列數值。
|
1913 |
#$conf["fileArray"],陣列字串,要檢查是否存在的檔案有哪些,須爲一維陣列數值。
|
| 1914 |
$conf["fileArray"]=array("./qbpwcf/usr/lib/systemd/system/ip-blockerd.service");
|
1914 |
$conf["fileArray"]=array("./etc/system/ip-blockerd.service");
|
| 1915 |
#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
|
1915 |
#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
|
| 1916 |
$conf["fileArgu"]=__FILE__;
|
1916 |
$conf["fileArgu"]=__FILE__;
|
| 1917 |
#可省略參數:
|
1917 |
#可省略參數:
|
| 1918 |
#$conf["disableWebSearch"],"字串",是否取消「當檔案找不到時,改用catchWebContent類別的wget函數來檢查檔案是否存在於網路上」的功能,"false"不取消,若要取消該功能請設為"true",若抓到的內容為空字串則會視為檔案不存在,預設為"true".
|
1918 |
#$conf["disableWebSearch"],"字串",是否取消「當檔案找不到時,改用catchWebContent類別的wget函數來檢查檔案是否存在於網路上」的功能,"false"不取消,若要取消該功能請設為"true",若抓到的內容為空字串則會視為檔案不存在,預設為"true".
|
| 1919 |
$conf["disableWebSearch"]="true";
|
1919 |
$conf["disableWebSearch"]="true";
|
| Line 2058... |
Line 2058... |
| 2058 |
#$result["content"],軟連結的資訊.
|
2058 |
#$result["content"],軟連結的資訊.
|
| 2059 |
#必填參數:
|
2059 |
#必填參數:
|
| 2060 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
2060 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
| 2061 |
$conf["fileArgu"]=__FILE__;
|
2061 |
$conf["fileArgu"]=__FILE__;
|
| 2062 |
#$conf["file"],字串,要更新的檔案位置與名稱.
|
2062 |
#$conf["file"],字串,要更新的檔案位置與名稱.
|
| 2063 |
$conf["file"]="./qbpwcf/usr/lib/systemd/system/ip-blockerd.service";
|
2063 |
$conf["file"]="./etc/systemd/system/ip-blockerd.service";
|
| 2064 |
#可省略參數:
|
2064 |
#可省略參數:
|
| 2065 |
#$conf["overWriteWith"],字串陣列,要置換成什麼樣的內容,每個元素代表一行內容.
|
2065 |
#$conf["overWriteWith"],字串陣列,要置換成什麼樣的內容,每個元素代表一行內容.
|
| 2066 |
#$conf["overWriteWith"]=array();
|
2066 |
#$conf["overWriteWith"]=array();
|
| 2067 |
#$conf["replaceWith"],字串陣列,要將什麼內容置換成什麼內容.
|
2067 |
#$conf["replaceWith"],字串陣列,要將什麼內容置換成什麼內容.
|
| 2068 |
$conf["replaceWith"]=array(array($serviceStartKeyWord,$serviceStartNewContent),array($serviceRestartKeyWord,$serviceRestartNewContent));
|
2068 |
$conf["replaceWith"]=array(array($serviceStartKeyWord,$serviceStartNewContent),array($serviceRestartKeyWord,$serviceRestartNewContent));
|
| Line 2120... |
Line 2120... |
| 2120 |
|
2120 |
|
| 2121 |
}#if end
|
2121 |
}#if end
|
| 2122 |
|
2122 |
|
| 2123 |
}#if end
|
2123 |
}#if end
|
| 2124 |
|
2124 |
|
| 2125 |
#於 /etc/systemd/system 底下建立 $rootPath.$name."/usr/lib/systemd/system" 底下所有服務檔案的軟連結.
|
2125 |
#於 /etc/systemd/system 底下建立 $pathinfo(__FILE__)["dirname"]."/etc/systemd/system" 底下所有服務檔案的軟連結.
|
| 2126 |
#函式說明:
|
2126 |
#函式說明:
|
| 2127 |
#針對特定目錄下的內容建立軟連結.
|
2127 |
#針對特定目錄下的內容建立軟連結.
|
| 2128 |
#回傳結果:
|
2128 |
#回傳結果:
|
| 2129 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
2129 |
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
|
| 2130 |
#$result["error"],錯誤訊息.
|
2130 |
#$result["error"],錯誤訊息.
|
| Line 2132... |
Line 2132... |
| 2132 |
#$result["content"],字串陣列,每個建立的軟連結資訊.
|
2132 |
#$result["content"],字串陣列,每個建立的軟連結資訊.
|
| 2133 |
#必填參數:
|
2133 |
#必填參數:
|
| 2134 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
2134 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
| 2135 |
$conf["fileArgu"]=__FILE__;
|
2135 |
$conf["fileArgu"]=__FILE__;
|
| 2136 |
#$conf["linkToDir"],字串,軟連結要指向哪個目錄底下的內容.
|
2136 |
#$conf["linkToDir"],字串,軟連結要指向哪個目錄底下的內容.
|
| 2137 |
$conf["linkToDir"]=$rootPath.$name."/usr/lib/systemd/system";
|
2137 |
$conf["linkToDir"]=$pathinfo(__FILE__)["dirname"]."/etc/systemd/system";
|
| 2138 |
#可省略參數:
|
2138 |
#可省略參數:
|
| 2139 |
#$conf["path"],字串,軟連結要放在哪邊,預設為當前位置.
|
2139 |
#$conf["path"],字串,軟連結要放在哪邊,預設為當前位置.
|
| 2140 |
$conf["path"]="/etc/systemd/system";
|
2140 |
$conf["path"]="/etc/systemd/system";
|
| 2141 |
#$conf["name"],字串陣列,軟連結的名稱,預設為 "linkToDir" 目錄底下的檔案或目錄名稱.若要指定特定檔案目錄的軟連結名稱,則可以用 $conf["name"][]=array("原始名稱","新的名稱"); 來指定.
|
2141 |
#$conf["name"],字串陣列,軟連結的名稱,預設為 "linkToDir" 目錄底下的檔案或目錄名稱.若要指定特定檔案目錄的軟連結名稱,則可以用 $conf["name"][]=array("原始名稱","新的名稱"); 來指定.
|
| 2142 |
#$conf["name"]=array(array("oriName","newName"));
|
2142 |
#$conf["name"]=array(array("oriName","newName"));
|
| Line 2197... |
Line 2197... |
| 2197 |
#$result["content"],字串陣列,每個建立的軟連結資訊.
|
2197 |
#$result["content"],字串陣列,每個建立的軟連結資訊.
|
| 2198 |
#必填參數:
|
2198 |
#必填參數:
|
| 2199 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
2199 |
#$conf["fileArgu"],字串,變數__FILE__的內容.
|
| 2200 |
$conf["fileArgu"]=__FILE__;
|
2200 |
$conf["fileArgu"]=__FILE__;
|
| 2201 |
#$conf["linkToDir"],字串,軟連結要指向哪個目錄底下的內容.
|
2201 |
#$conf["linkToDir"],字串,軟連結要指向哪個目錄底下的內容.
|
| 2202 |
$conf["linkToDir"]=$rootPath.$name."/usr/local/etc";
|
2202 |
$conf["linkToDir"]=$pathinfo(__FILE__)["dirname"]."/etc/qbpwcf";
|
| 2203 |
#可省略參數:
|
2203 |
#可省略參數:
|
| 2204 |
#$conf["path"],字串,軟連結要放在哪邊,預設為當前位置.
|
2204 |
#$conf["path"],字串,軟連結要放在哪邊,預設為當前位置.
|
| 2205 |
$conf["path"]="/usr/local/etc";
|
2205 |
$conf["path"]="/etc/qbpwcf";
|
| 2206 |
#$conf["name"],字串陣列,軟連結的名稱,預設為 "linkToDir" 目錄底下的檔案或目錄名稱.若要指定特定檔案目錄的軟連結名稱,則可以用 $conf["name"][]=array("原始名稱","新的名稱"); 來指定.
|
2206 |
#$conf["name"],字串陣列,軟連結的名稱,預設為 "linkToDir" 目錄底下的檔案或目錄名稱.若要指定特定檔案目錄的軟連結名稱,則可以用 $conf["name"][]=array("原始名稱","新的名稱"); 來指定.
|
| 2207 |
#$conf["name"]=array(array("oriName","newName"));
|
2207 |
#$conf["name"]=array(array("oriName","newName"));
|
| 2208 |
#$conf["overWrite"],字串,"true"代表要移除既有的項目名稱,來重新建立軟連結;預設為"false"不進行處理.
|
2208 |
#$conf["overWrite"],字串,"true"代表要移除既有的項目名稱,來重新建立軟連結;預設為"false"不進行處理.
|
| 2209 |
$conf["overWrite"]="true";
|
2209 |
$conf["overWrite"]="true";
|
| 2210 |
#參考資料:
|
2210 |
#參考資料:
|