Subversion Repositories qbpwcf-lib(archive)

Rev

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

Rev 554 Rev 564
Line 42... Line 42...
42
	echo "--rootPath path where QBPWCF to put. Default is /usr/lib/".PHP_EOL;
42
	echo "--rootPath path where QBPWCF to put. Default is /usr/lib/".PHP_EOL;
43
	echo "--name folder name where QBPWCF to put inside. Default is qbpwcf".PHP_EOL;
43
	echo "--name folder name where QBPWCF to put inside. Default is qbpwcf".PHP_EOL;
44
	echo "--mode cp/link, default is link".PHP_EOL;
44
	echo "--mode cp/link, default is link".PHP_EOL;
45
	echo "\tcp means copy and overwrite to installation path".PHP_EOL;
45
	echo "\tcp means copy and overwrite to installation path".PHP_EOL;
46
	echo "\tlink means create a softlink from current path to installation path".PHP_EOL;
46
	echo "\tlink means create a softlink from current path to installation path".PHP_EOL;
-
 
47
	echo "--configUrl ur, specify url to get config, default is https://config.qbpwcf.org".PHP_EOL;
47
	echo "--getIpUrl url, specify url to get www ip, default is https://ip.qbpwcf.org".PHP_EOL;
48
	echo "--getIpUrl url, specify url to get www ip, default is https://ip.qbpwcf.org".PHP_EOL;
48
	echo "--ip ip address, specify self ip address, if need.".PHP_EOL;
49
	echo "--ip ip address, specify self ip address, if need.".PHP_EOL;
49
	echo "--dbAddr MariaDb service address, default is \"localhost\"".PHP_EOL;
50
	echo "--dbAddr MariaDb service address, default is \"localhost\"".PHP_EOL;
50
	echo "--dbAcct MariaDb service account, default is \"root\"".PHP_EOL;
51
	echo "--dbAcct MariaDb service account, default is \"root\"".PHP_EOL;
51
	echo "--dbPass MariaDb service password, default is output of uuid command".PHP_EOL;
52
	echo "--dbPass MariaDb service password, default is output of uuid command".PHP_EOL;
Line 180... Line 181...
180
$name="qbpwcf";
181
$name="qbpwcf";
181
 
182
 
182
#預設運作模式為 "link" 亦即建立軟連結
183
#預設運作模式為 "link" 亦即建立軟連結
183
$mode="link";
184
$mode="link";
184
 
185
 
-
 
186
#預設取得設定檔服務的網址
-
 
187
$configUrl="https://config.qbpwcf.org";
-
 
188
 
185
#預設取得自己對外ip的服務網址
189
#預設取得自己對外ip的服務網址
186
$getIpUrl="https://ip.qbpwcf.org";
190
$getIpUrl="https://ip.qbpwcf.org";
187
 
191
 
188
#預設不指定自己的IP
192
#預設不指定自己的IP
189
$ip="";
193
$ip="";
Line 243... Line 247...
243
#$conf["canNotBeEmpty"],字串陣列,哪些必填參數的內容不得為空字串或空陣列,僅當$conf["canBeEmptyString"]為"true"時會生效.
247
#$conf["canNotBeEmpty"],字串陣列,哪些必填參數的內容不得為空字串或空陣列,僅當$conf["canBeEmptyString"]為"true"時會生效.
244
#$conf["canNotBeEmpty"]=array();
248
#$conf["canNotBeEmpty"]=array();
245
#$conf["canBeEmpty"],字串陣列,哪些必填參數的內容可為空字串或空陣列,僅當$conf["canBeEmptyString"]為"false"時會生效.
249
#$conf["canBeEmpty"],字串陣列,哪些必填參數的內容可為空字串或空陣列,僅當$conf["canBeEmptyString"]為"false"時會生效.
246
#$conf["canBeEmpty"]=array();
250
#$conf["canBeEmpty"]=array();
247
#$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或空陣列.
251
#$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或空陣列.
248
$conf["skipableVariableCanNotBeEmpty"]=array("rootPath","name","mode","getIpUrl","ip","dbAcct","dbPass","dbName","dbAddr","dbPort","sshAddrAndPort","headless");
252
$conf["skipableVariableCanNotBeEmpty"]=array("rootPath","name","mode","configUrl","getIpUrl","ip","dbAcct","dbPass","dbName","dbAddr","dbPort","sshAddrAndPort","headless");
249
#$conf["skipableVariableName"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
253
#$conf["skipableVariableName"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
250
$conf["skipableVariableName"]=array("rootPath","name","mode","getIpUrl","ip","dbAcct","dbPass","dbName","dbAddr","dbPort","sshAddrAndPort","headless");
254
$conf["skipableVariableName"]=array("rootPath","name","mode","configUrl","getIpUrl","ip","dbAcct","dbPass","dbName","dbAddr","dbPort","sshAddrAndPort","headless");
251
#$conf["skipableVariableType"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
255
#$conf["skipableVariableType"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
252
$conf["skipableVariableType"]=array("array","array","array","array","array","array","array","array","array","array","array","array");
256
$conf["skipableVariableType"]=array("array","array","array","array","array","array","array","array","array","array","array","array","array");
253
#$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
257
#$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
254
$conf["skipableVarDefaultValue"]=array(null,null,null,null,null,null,null,null,null,null,null,null);
258
$conf["skipableVarDefaultValue"]=array(null,null,null,null,null,null,null,null,null,null,null,null,null);
255
#$conf["disallowAllSkipableVarIsEmpty"],字串,是否允許每個可省略參數都為空字串,預設為"true"允許,反之為"false".
259
#$conf["disallowAllSkipableVarIsEmpty"],字串,是否允許每個可省略參數都為空字串,預設為"true"允許,反之為"false".
256
#$conf["disallowAllSkipableVarIsEmpty"]="";
260
#$conf["disallowAllSkipableVarIsEmpty"]="";
257
#$conf["disallowAllSkipableVarIsEmptyArray"],字串,是否允許每個可省略參數都為空陣列,預設為"true"允許,反之為"false".
261
#$conf["disallowAllSkipableVarIsEmptyArray"],字串,是否允許每個可省略參數都為空陣列,預設為"true"允許,反之為"false".
258
#$conf["disallowAllSkipableVarIsEmptyArray"]="";
262
#$conf["disallowAllSkipableVarIsEmptyArray"]="";
259
#$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
263
#$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
260
$conf["arrayCountEqualCheck"][]=array("rootPath","name","mode","ip","dbAcct","dbPass","dbName","dbAddr","dbPort","headless");
264
$conf["arrayCountEqualCheck"][]=array("rootPath","name","mode","configUrl","getIpUrl","ip","dbAcct","dbPass","dbName","dbAddr","dbPort","headless");
261
#參考資料:
265
#參考資料:
262
#array_keys=>http://php.net/manual/en/function.array-keys.php
266
#array_keys=>http://php.net/manual/en/function.array-keys.php
263
#備註:
267
#備註:
264
#無.
268
#無.
265
$checkArguments=variableCheck::checkArguments($conf);
269
$checkArguments=variableCheck::checkArguments($conf);
Line 331... Line 335...
331
		
335
		
332
			}#if end
336
			}#if end
333
	
337
	
334
		}#if end
338
		}#if end
335
		
339
		
-
 
340
	#如果有 configUrl 參數
-
 
341
	if(isset($parseArgu["content"]["configUrl"])){
-
 
342
	
-
 
343
		#如果有 configUrl 參數存在
-
 
344
		if(isset($parseArgu["content"]["configUrl"][0])){
-
 
345
		
-
 
346
			#更新 configUrl
-
 
347
			$configUrl=$parseArgu["content"]["configUrl"][0];
-
 
348
		
-
 
349
			}#if end
-
 
350
	
-
 
351
		}#if end
-
 
352
		
336
	#如果有 dbAcct 參數
353
	#如果有 dbAcct 參數
337
	if(isset($parseArgu["content"]["dbAcct"])){
354
	if(isset($parseArgu["content"]["dbAcct"])){
338
	
355
	
339
		#如果有 dbAcct 參數存在
356
		#如果有 dbAcct 參數存在
340
		if(isset($parseArgu["content"]["dbAcct"][0])){
357
		if(isset($parseArgu["content"]["dbAcct"][0])){
Line 653... Line 670...
653
$conf["overWriteWith"][]="\$myIp="."\"".$ip."\";";
670
$conf["overWriteWith"][]="\$myIp="."\"".$ip."\";";
654
$conf["overWriteWith"][]="";
671
$conf["overWriteWith"][]="";
655
$conf["overWriteWith"][]="#specify url to get self www ip";
672
$conf["overWriteWith"][]="#specify url to get self www ip";
656
$conf["overWriteWith"][]="\$getIpUrl=\"".$getIpUrl."\";";
673
$conf["overWriteWith"][]="\$getIpUrl=\"".$getIpUrl."\";";
657
$conf["overWriteWith"][]="";
674
$conf["overWriteWith"][]="";
-
 
675
$conf["overWriteWith"][]="#specify url to get config";
-
 
676
$conf["overWriteWith"][]="\$configUrl=\"".$configUrl."\";";
-
 
677
$conf["overWriteWith"][]="";
658
$conf["overWriteWith"][]="?\>";
678
$conf["overWriteWith"][]="?\>";
659
#$conf["replaceWith"],字串陣列,要將什麼內容置換成什麼內容.
679
#$conf["replaceWith"],字串陣列,要將什麼內容置換成什麼內容.
660
#conf["replaceWith"]=array(array("ori content","new content"),array("ori content","new content"),...);
680
#conf["replaceWith"]=array(array("ori content","new content"),array("ori content","new content"),...);
661
#$conf["addToTailWhenNoMatch"],字串,預設為"false"不做事;若為"true",則代表若使用 "replaceWith" 參數但沒有符合條件的內容出現,則新增到檔案的尾端.
681
#$conf["addToTailWhenNoMatch"],字串,預設為"false"不做事;若為"true",則代表若使用 "replaceWith" 參數但沒有符合條件的內容出現,則新增到檔案的尾端.
662
#$conf["addToTailWhenNoMatch"]="false";
682
#$conf["addToTailWhenNoMatch"]="false";