Subversion Repositories qbpwcf-lib(archive)

Rev

Rev 936 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 936 Rev 950
Line 12522... Line 12522...
12522
	#$conf["target"],字串,要檢查status的目標.
12522
	#$conf["target"],字串,要檢查status的目標.
12523
	#$conf["target"]="";
12523
	#$conf["target"]="";
12524
	#參考資料:
12524
	#參考資料:
12525
	#無.
12525
	#無.
12526
	#備註:
12526
	#備註:
12527
	#無.
-
 
-
 
12527
	#範例輸出->svn: warning: W155010: The node '.../usr/lib64' was not found.
12528
	*/
12528
	*/
12529
	public static function svnsta(&$conf=array()){
12529
	public static function svnsta(&$conf=array()){
12530
 
12530
 
12531
		#初始化要回傳的結果
12531
		#初始化要回傳的結果
12532
		$result=array();
12532
		$result=array();
Line 12757... Line 12757...
12757
		$result["content"]["ori"]=$callShell["output"];
12757
		$result["content"]["ori"]=$callShell["output"];
12758
 
12758
 
12759
		#如果不等於空陣列
12759
		#如果不等於空陣列
12760
		if($result["content"]["ori"]!==array()){
12760
		if($result["content"]["ori"]!==array()){
12761
 
12761
 
12762
			#針對每一列
-
 
12763
			foreach($result["content"]["ori"] as $line){
-
 
12764
 
-
 
12765
				#取得檔案的 status 與名稱
12762
			#未進入版本控制的軟連結到目錄,會出現類似以下警告訊息.
12766
				sscanf($line,"%s %s",$sta,$fi);
12763
			#svn: warning: W155010: The node '.../usr/lib64' was not found
12767
 
12764
 
-
 
12765
			#如果遇到沒有進入版本控制的軟連結
-
 
12766
			if( strpos($result["content"]["ori"][0]," W155010: ")!==false && strpos($result["content"]["ori"][0]," The node ")!==false && strpos($result["content"]["ori"][0]," was not found")!==false ){
-
 
12767
			
12768
				#設置該目標的 狀態(status), 路徑與名稱(target), 是否為目錄(is_dir).
12768
				#設置該目標的 狀態(status), 路徑與名稱(target), 是否為目錄(is_dir).
12769
				$result["content"]["status"][]=array(
12769
				$result["content"]["status"][]=array(
12770
					"status"=>$sta,
12770
					"status"=>"?",
12771
					"target"=>$fi,
12771
					"target"=>$conf["target"],
12772
					"is_dir"=>is_file($fi)?"false":"true"
12772
					"is_dir"=>"false"
12773
					);
12773
					);
-
 
12774
			
-
 
12775
				}#if end
-
 
12776
			
-
 
12777
			#反之
-
 
12778
			else{
-
 
12779
			
-
 
12780
				#針對每一列
-
 
12781
				foreach($result["content"]["ori"] as $line){
12774
 
12782
 
-
 
12783
					#取得檔案的 status 與名稱
-
 
12784
					sscanf($line,"%s %s",$sta,$fi);
-
 
12785
 
-
 
12786
					#設置該目標的 狀態(status), 路徑與名稱(target), 是否為目錄(is_dir).
-
 
12787
					$result["content"]["status"][]=array(
-
 
12788
						"status"=>$sta,
-
 
12789
						"target"=>$fi,
-
 
12790
						"is_dir"=>is_file($fi)?"false":"true"
-
 
12791
						);
-
 
12792
 
12775
				}#foreach end
12793
					}#foreach end
-
 
12794
			
-
 
12795
				}#else end
12776
 
12796
 
12777
			}#if end
12797
			}#if end
12778
 
12798
 
12779
		#設置執行正常
12799
		#設置執行正常
12780
		$result["status"]="true";
12800
		$result["status"]="true";
Line 17463... Line 17483...
17463
					$conf["fileAccess::checkMultiFileExist"]["fileArgu"]=__FILE__;
17483
					$conf["fileAccess::checkMultiFileExist"]["fileArgu"]=__FILE__;
17464
					#可省略參數:
17484
					#可省略參數:
17465
					#$conf["disableWebSearch"],"字串",是否取消「當檔案找不到時,改用catchWebContent類別的wget函數來檢查檔案是否存在於網路上」的功能,"false"不取消,若要取消該功能請設為"true",若抓到的內容為空字串則會視為檔案不存在,預設為"true".
17485
					#$conf["disableWebSearch"],"字串",是否取消「當檔案找不到時,改用catchWebContent類別的wget函數來檢查檔案是否存在於網路上」的功能,"false"不取消,若要取消該功能請設為"true",若抓到的內容為空字串則會視為檔案不存在,預設為"true".
17466
					#$conf["disableWebSearch"]="false";
17486
					#$conf["disableWebSearch"]="false";
17467
					#$conf["userDir"],字串,網頁是否置放於家目錄底下,"true"為是,"false"為不是,預設為"true".
17487
					#$conf["userDir"],字串,網頁是否置放於家目錄底下,"true"為是,"false"為不是,預設為"true".
17468
					#$conf["userDir"]="true";
17488
					#$conf["fileAccess::checkMultiFileExist"]["userDir"]="true";
17469
					#$conf["web"],字串,檔案是放在web就是"true",反之為檔案系統"false",預設為"true".
17489
					#$conf["web"],字串,檔案是放在web就是"true",反之為檔案系統"false",預設為"true".
17470
					$conf["fileAccess::checkMultiFileExist"]["web"]="false";
17490
					$conf["fileAccess::checkMultiFileExist"]["web"]="false";
17471
					#參考資料:
17491
					#參考資料:
17472
					#http://php.net/manual/en/function.file-exists.php
17492
					#http://php.net/manual/en/function.file-exists.php
17473
					#http://php.net/manual/en/control-structures.foreach.php
17493
					#http://php.net/manual/en/control-structures.foreach.php
Line 17503... Line 17523...
17503
						}#if end
17523
						}#if end
17504
						
17524
						
17505
					#檢查檔案 $input 是否處於版本控制中
17525
					#檢查檔案 $input 是否處於版本控制中
17506
					
17526
					
17507
					#函式說明:
17527
					#函式說明:
17508
					#呼叫shell執行系統命令,並取得回傳的內容.
17528
					#執行svn status指令
17509
					#回傳結果:
17529
					#回傳結果:
17510
					#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
17530
					#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
17511
					#$result["error"],錯誤訊息陣列.
17531
					#$reuslt["error"],執行不正常結束的錯訊息陣列.
17512
					#$result["function"],當前執行的函數名稱.
17532
					#$result["function"],當前執行的函式名稱.
17513
					#$result["argu"],使用的參數.
-
 
17514
					#$result["cmd"],執行的指令內容.
17533
					#$result["content"]["ori"],指令輸出的原始結果陣列.
17515
					#$result["fullCmd"],如果參數 $conf["inBackGround"] 為 "true" 則會回傳該值.
17534
					#$result["content"]["status"][$i]["status"],第$i+1個目標的狀態.
17516
					#$result["output"],爲執行完二元碼後的輸出陣列,若 $conf["inBackGround"] 為 "true",則為當下的輸出.
17535
					#$result["content"]["status"][$i]["target"],第$i+1個目標的路徑與名稱.
17517
					#$result["tmpFileOutput"],儲存輸出的暫存檔案名稱,若 $conf["inBackGround"] 為 "true" 則會回傳該值.
17536
					#$result["content"]["status"][$i]["is_dir"],第$i+1個目標是否為目錄,"true"代表是,"false"代表不是.
17518
					#$result["running"],是否還在執行.
-
 
17519
					#$result["pid"],pid.
-
 
17520
					#$result["statusCode"],執行結束後的代碼.
-
 
17521
					#必填參數:
17537
					#必填參數:
17522
					#$conf["command"],字串,要執行的指令與.
-
 
17523
					$conf["external::callShell"]["command"]="svn";
-
 
17524
					#$conf["fileArgu"],字串,變數__FILE__的內容.
17538
					#$conf["fileArgu"],字串,變數__FILE__的內容.
17525
					$conf["external::callShell"]["fileArgu"]=$conf["fileArgu"];
17539
					$conf["cmd::svnsta"]["fileArgu"]=__FILE__;
17526
					#可省略參數:
17540
					#可省略參數:
17527
					#$conf["argu"],陣列字串,指令搭配的參數,預設為空陣列.
-
 
17528
					$conf["external::callShell"]["argu"]=array("status",$argv[0]);
-
 
17529
					#$conf["arguIsAddr"],陣列字串,指令搭配的哪些參數為路徑,為路徑的參數會進行轉換以便符合呼叫當前函數的位置,預設不指定,若有3個參數,其中第3個參數為路徑,則表示為array("false","false","true").
-
 
17530
					#$conf["arguIsAddr"]=array();
-
 
17531
					#$conf["plainArgu"],字串陣列,哪幾個參數不要加上"",若為"true"則代表不用包;反之"false"則代表要包.
-
 
17532
					#$conf["plainArgu"]=array();
-
 
17533
					#$conf["useApostrophe"],字串陣列,如果有需要包住,則用「'」,而非「"」處理.前者為"true";後者為"false".
-
 
17534
					#$conf["useApostrophe"]=array();
-
 
17535
					#$conf["pre"],陣列,要在本指令前執行的每個指令與參數.
-
 
17536
					#$conf["pre"][$i]["cmd"],字串,要在本指令前執行的第$i+1個指令.
17541
					#$conf["target"],字串,要檢查status的目標.
17537
					#$conf["pre"][$i]["param"],陣列字串,要在本指令前執行的第$i+1個指令的參數.
-
 
17538
					#$conf["enablePrintDescription"],字串,是否要印出$conf["printDescription"]的內容,"true"代表要,"false"代表不要,預設為"false".
-
 
17539
					#$conf["enablePrintDescription"]="true";
-
 
17540
					#$conf["printDescription"],字串,執行該外部程式前要印出來的的文字,預設為$conf["command"]的內容加上使用的$conf["argu"]參數.
-
 
17541
					#$conf["printDescription"]="";
-
 
17542
					#$conf["escapeshellarg"],字串,是否要啟用過濾參數,用了比較安全,但可能會出錯,"true"為啟用,"false"為不啟用,預設為"false".如果參數為"< 、<< 、> 、>> 、| 、2>&1"之一則不會過濾.
-
 
17543
					$conf["external::callShell"]["escapeshellarg"]="true";
-
 
17544
					#$conf["thereIsShellVar"],陣列字串,指令搭配的參數"argu",若含有「\'」,則取代為「"」.每個argu參數都要有對應的元素."true"代表要置換.
-
 
17545
					#$conf["thereIsShellVar"]=array();
17542
					$conf["cmd::svnsta"]["target"]=$input;
17546
					#$conf["username"],字串,要用什麼使用者來執行,預設為執行php的使用者,該參數不適用於apache環境.
-
 
17547
					#$conf["username"]="";
-
 
17548
					#$conf["password"],字串,root的使用者密碼,預設不使用密碼,該參數不適用於apache環境.
-
 
17549
					#$conf["password"]="";
-
 
17550
					#$conf["useScript"],字串,是否要啟用Linux的script指令來記錄輸出,"true"代表要,Fedora的selinux會擋住該操作;"false"代表不要,預設為"false".
-
 
17551
					#$conf["useScript"]="";
-
 
17552
					#$conf["logFilePath"],字串,當 $conf["useScript"] 為 "true" 時,輸出的內容要暫存到哪裡,預設為 "/tmp/.qbpwcf_tmp/external/callShell/".
-
 
17553
					#$conf["logFilePath"]=".qbpwcf_tmp/external/callShell/";
-
 
17554
					#$conf["inBackGround"],字串,是否要在背景執行,且不會等待程式執行結束再執行下一個指令,"true"代表是,"false"代表不要,預設為"false",如果$conf["command"]有用「;」區隔的多個指令將會出錯.
-
 
17555
					#$conf["inBackGround"]="";
-
 
17556
					#$conf["getErr"],字串,"true"代表將錯誤輸出變成標準輸出,反之"false"為不變動.
-
 
17557
					#$conf["getErr"]="false";
-
 
17558
					#$conf["doNotRun"],字串,"true"代表不執行指令,預設為"false"會執行指令.
-
 
17559
					#$conf["doNotRun"]="false";
-
 
17560
					#參考資料:
17543
					#參考資料:
17561
					#exec=>http://php.net/manual/en/function.exec.php
17544
					#無.
17562
					#escapeshellcmd=>http://php.net/manual/en/function.escapeshellcmd.php
-
 
17563
					#escapeshellarg=>http://php.net/manual/en/function.escapeshellarg.php
-
 
17564
					#備註:
17545
					#備註:
17565
					#不是所有指令都能用apache的身份執行,目前已知java,javac指令無法執行,使用root身份可能會被selinux阻擋.
-
 
17566
					$callShell=external::callShell($conf["external::callShell"]);
-
 
17567
					unset($conf["external::callShell"]);
-
 
17568
 
-
 
17569
					#debug
17546
					#無.
17570
					#var_dump(__LINE__,$callShell);
17547
					$svnsta=cmd::svnsta($conf["cmd::svnsta"]);
17571
 
-
 
17572
					#如果執行失敗
-
 
17573
					if($callShell["status"]==="false"){
17548
					unset($conf["cmd::svnsta"]);
17574
					
17549
					
-
 
17550
					#如果執行失敗
-
 
17551
					if($svnsta["status"]==="false"){
-
 
17552
 
17575
						#設置執行失敗
17553
						#設置執行失敗
17576
						$result["status"]="false";
17554
						$result["status"]="false";
17577
						
17555
						
17578
						#設置執行失敗訊息
17556
						#設置執行失敗訊息
17579
						$result["error"]=$callShell;
17557
						$result["error"]=$svnsta;
17580
						
17558
						
17581
						#回傳結果
17559
						#回傳結果
17582
						return $result;
17560
						return $result;
17583
					
17561
 
17584
						}#if end
17562
						}#if end
17585
					
17563
					
17586
					#印出執行的cmd
-
 
17587
					echo "cmd:".$callShell["cmd"].PHP_EOL;
-
 
17588
 
-
 
17589
					#印出執行後的回傳代碼
17564
					#var_dump(__LINE__,$svnsta);
17590
					echo "status:".$callShell["statusCode"].PHP_EOL;
-
 
17591
 
17565
					
17592
					#如果不等於空陣列
17566
					#如果沒有版本控制記錄
17593
					if($callShell["output"]!==array()){
-
 
17594
 
-
 
17595
						#取得檔案的 status 與名稱
-
 
17596
						sscanf($callShell["output"][0],"%s %s",$sta,$fi);
17567
					if($svnsta["content"]["status"][0]["status"]==="?"){
17597
 
-
 
17598
						#如果狀態等於 "?"
-
 
17599
						if($sta==="?"){
17568
					
17600
 
-
 
17601
							#函式說明:
17569
						#函式說明:
17602
							#呼叫shell執行系統命令,並取得回傳的內容.
17570
						#呼叫shell執行系統命令,並取得回傳的內容.
17603
							#回傳結果:
17571
						#回傳結果:
17604
							#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
17572
						#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
17605
							#$result["error"],錯誤訊息陣列.
17573
						#$result["error"],錯誤訊息陣列.
17606
							#$result["function"],當前執行的函數名稱.
17574
						#$result["function"],當前執行的函數名稱.
17607
							#$result["argu"],使用的參數.
17575
						#$result["argu"],使用的參數.
17608
							#$result["cmd"],執行的指令內容.
17576
						#$result["cmd"],執行的指令內容.
17609
							#$result["fullCmd"],如果參數 $conf["inBackGround"] 為 "true" 則會回傳該值.
17577
						#$result["fullCmd"],如果參數 $conf["inBackGround"] 為 "true" 則會回傳該值.
17610
							#$result["output"],爲執行完二元碼後的輸出陣列,若 $conf["inBackGround"] 為 "true",則為當下的輸出.
17578
						#$result["output"],爲執行完二元碼後的輸出陣列,若 $conf["inBackGround"] 為 "true",則為當下的輸出.
17611
							#$result["tmpFileOutput"],儲存輸出的暫存檔案名稱,若 $conf["inBackGround"] 為 "true" 則會回傳該值.
17579
						#$result["tmpFileOutput"],儲存輸出的暫存檔案名稱,若 $conf["inBackGround"] 為 "true" 則會回傳該值.
17612
							#$result["running"],是否還在執行.
17580
						#$result["running"],是否還在執行.
17613
							#$result["pid"],pid.
17581
						#$result["pid"],pid.
17614
							#$result["statusCode"],執行結束後的代碼.
17582
						#$result["statusCode"],執行結束後的代碼.
17615
							#必填參數:
17583
						#必填參數:
17616
							#$conf["command"],字串,要執行的指令與.
17584
						#$conf["command"],字串,要執行的指令與.
17617
							$conf["external::callShell"]["command"]="svn";
17585
						$conf["external::callShell"]["command"]="svn";
17618
							#$conf["fileArgu"],字串,變數__FILE__的內容.
17586
						#$conf["fileArgu"],字串,變數__FILE__的內容.
17619
							$conf["external::callShell"]["fileArgu"]=$conf["fileArgu"];
17587
						$conf["external::callShell"]["fileArgu"]=$conf["fileArgu"];
17620
							#可省略參數:
17588
						#可省略參數:
17621
							#$conf["argu"],陣列字串,指令搭配的參數,預設為空陣列.
17589
						#$conf["argu"],陣列字串,指令搭配的參數,預設為空陣列.
17622
							$conf["external::callShell"]["argu"]=array("add",$argv[0]);
17590
						$conf["external::callShell"]["argu"]=array("add",$argv[0]);
17623
							#$conf["arguIsAddr"],陣列字串,指令搭配的哪些參數為路徑,為路徑的參數會進行轉換以便符合呼叫當前函數的位置,預設不指定,若有3個參數,其中第3個參數為路徑,則表示為array("false","false","true").
17591
						#$conf["arguIsAddr"],陣列字串,指令搭配的哪些參數為路徑,為路徑的參數會進行轉換以便符合呼叫當前函數的位置,預設不指定,若有3個參數,其中第3個參數為路徑,則表示為array("false","false","true").
17624
							#$conf["arguIsAddr"]=array();
17592
						#$conf["arguIsAddr"]=array();
17625
							#$conf["plainArgu"],字串陣列,哪幾個參數不要加上"",若為"true"則代表不用包;反之"false"則代表要包.
17593
						#$conf["plainArgu"],字串陣列,哪幾個參數不要加上"",若為"true"則代表不用包;反之"false"則代表要包.
17626
							#$conf["plainArgu"]=array();
17594
						#$conf["plainArgu"]=array();
17627
							#$conf["useApostrophe"],字串陣列,如果有需要包住,則用「'」,而非「"」處理.前者為"true";後者為"false".
17595
						#$conf["useApostrophe"],字串陣列,如果有需要包住,則用「'」,而非「"」處理.前者為"true";後者為"false".
17628
							#$conf["useApostrophe"]=array();
17596
						#$conf["useApostrophe"]=array();
17629
							#$conf["pre"],陣列,要在本指令前執行的每個指令與參數.
17597
						#$conf["pre"],陣列,要在本指令前執行的每個指令與參數.
17630
							#$conf["pre"][$i]["cmd"],字串,要在本指令前執行的第$i+1個指令.
17598
						#$conf["pre"][$i]["cmd"],字串,要在本指令前執行的第$i+1個指令.
17631
							#$conf["pre"][$i]["param"],陣列字串,要在本指令前執行的第$i+1個指令的參數.
17599
						#$conf["pre"][$i]["param"],陣列字串,要在本指令前執行的第$i+1個指令的參數.
17632
							#$conf["enablePrintDescription"],字串,是否要印出$conf["printDescription"]的內容,"true"代表要,"false"代表不要,預設為"false".
17600
						#$conf["enablePrintDescription"],字串,是否要印出$conf["printDescription"]的內容,"true"代表要,"false"代表不要,預設為"false".
17633
							#$conf["enablePrintDescription"]="true";
17601
						#$conf["enablePrintDescription"]="true";
17634
							#$conf["printDescription"],字串,執行該外部程式前要印出來的的文字,預設為$conf["command"]的內容加上使用的$conf["argu"]參數.
17602
						#$conf["printDescription"],字串,執行該外部程式前要印出來的的文字,預設為$conf["command"]的內容加上使用的$conf["argu"]參數.
17635
							#$conf["printDescription"]="";
17603
						#$conf["printDescription"]="";
17636
							#$conf["escapeshellarg"],字串,是否要啟用過濾參數,用了比較安全,但可能會出錯,"true"為啟用,"false"為不啟用,預設為"false".如果參數為"< 、<< 、> 、>> 、| 、2>&1"之一則不會過濾.
17604
						#$conf["escapeshellarg"],字串,是否要啟用過濾參數,用了比較安全,但可能會出錯,"true"為啟用,"false"為不啟用,預設為"false".如果參數為"< 、<< 、> 、>> 、| 、2>&1"之一則不會過濾.
17637
							$conf["external::callShell"]["escapeshellarg"]="true";
17605
						$conf["external::callShell"]["escapeshellarg"]="true";
17638
							#$conf["thereIsShellVar"],陣列字串,指令搭配的參數"argu",若含有「\'」,則取代為「"」.每個argu參數都要有對應的元素."true"代表要置換.
17606
						#$conf["thereIsShellVar"],陣列字串,指令搭配的參數"argu",若含有「\'」,則取代為「"」.每個argu參數都要有對應的元素."true"代表要置換.
17639
							#$conf["thereIsShellVar"]=array();
17607
						#$conf["thereIsShellVar"]=array();
17640
							#$conf["username"],字串,要用什麼使用者來執行,預設為執行php的使用者,該參數不適用於apache環境.
17608
						#$conf["username"],字串,要用什麼使用者來執行,預設為執行php的使用者,該參數不適用於apache環境.
17641
							#$conf["username"]="";
17609
						#$conf["username"]="";
17642
							#$conf["password"],字串,root的使用者密碼,預設不使用密碼,該參數不適用於apache環境.
17610
						#$conf["password"],字串,root的使用者密碼,預設不使用密碼,該參數不適用於apache環境.
17643
							#$conf["password"]="";
17611
						#$conf["password"]="";
17644
							#$conf["useScript"],字串,是否要啟用Linux的script指令來記錄輸出,"true"代表要,Fedora的selinux會擋住該操作;"false"代表不要,預設為"false".
17612
						#$conf["useScript"],字串,是否要啟用Linux的script指令來記錄輸出,"true"代表要,Fedora的selinux會擋住該操作;"false"代表不要,預設為"false".
17645
							#$conf["useScript"]="";
17613
						#$conf["useScript"]="";
17646
							#$conf["logFilePath"],字串,當 $conf["useScript"] 為 "true" 時,輸出的內容要暫存到哪裡,預設為 "/tmp/.qbpwcf_tmp/external/callShell/".
17614
						#$conf["logFilePath"],字串,當 $conf["useScript"] 為 "true" 時,輸出的內容要暫存到哪裡,預設為 "/tmp/.qbpwcf_tmp/external/callShell/".
17647
							#$conf["logFilePath"]=".qbpwcf_tmp/external/callShell/";
17615
						#$conf["logFilePath"]=".qbpwcf_tmp/external/callShell/";
17648
							#$conf["inBackGround"],字串,是否要在背景執行,且不會等待程式執行結束再執行下一個指令,"true"代表是,"false"代表不要,預設為"false",如果$conf["command"]有用「;」區隔的多個指令將會出錯.
17616
						#$conf["inBackGround"],字串,是否要在背景執行,且不會等待程式執行結束再執行下一個指令,"true"代表是,"false"代表不要,預設為"false",如果$conf["command"]有用「;」區隔的多個指令將會出錯.
17649
							#$conf["inBackGround"]="";
17617
						#$conf["inBackGround"]="";
17650
							#$conf["getErr"],字串,"true"代表將錯誤輸出變成標準輸出,反之"false"為不變動.
17618
						#$conf["getErr"],字串,"true"代表將錯誤輸出變成標準輸出,反之"false"為不變動.
17651
							#$conf["getErr"]="false";
17619
						#$conf["getErr"]="false";
17652
							#$conf["doNotRun"],字串,"true"代表不執行指令,預設為"false"會執行指令.
17620
						#$conf["doNotRun"],字串,"true"代表不執行指令,預設為"false"會執行指令.
17653
							#$conf["doNotRun"]="false";
17621
						#$conf["doNotRun"]="false";
17654
							#參考資料:
17622
						#參考資料:
17655
							#exec=>http://php.net/manual/en/function.exec.php
17623
						#exec=>http://php.net/manual/en/function.exec.php
17656
							#escapeshellcmd=>http://php.net/manual/en/function.escapeshellcmd.php
17624
						#escapeshellcmd=>http://php.net/manual/en/function.escapeshellcmd.php
17657
							#escapeshellarg=>http://php.net/manual/en/function.escapeshellarg.php
17625
						#escapeshellarg=>http://php.net/manual/en/function.escapeshellarg.php
17658
							#備註:
17626
						#備註:
17659
							#不是所有指令都能用apache的身份執行,目前已知java,javac指令無法執行,使用root身份可能會被selinux阻擋.
17627
						#不是所有指令都能用apache的身份執行,目前已知java,javac指令無法執行,使用root身份可能會被selinux阻擋.
17660
							$callShell=external::callShell($conf["external::callShell"]);
17628
						$callShell=external::callShell($conf["external::callShell"]);
17661
							unset($conf["external::callShell"]);
17629
						unset($conf["external::callShell"]);
17662
 
17630
 
17663
							#如果執行失敗
17631
						#如果執行失敗
17664
							if($callShell["status"]==="false"){
17632
						if($callShell["status"]==="false"){
17665
							
17633
						
17666
								#設置執行失敗
17634
							#設置執行失敗
17667
								$result["status"]="false";
17635
							$result["status"]="false";
17668
								
-
 
17669
								#設置執行失敗訊息
-
 
17670
								$result["error"]=$callShell;
-
 
17671
								
-
 
17672
								#回傳結果
-
 
17673
								return $result;
-
 
17674
							
17636
							
17675
								}#if end
17637
							#設置執行失敗訊息
-
 
17638
							$result["error"]=$callShell;
17676
							
17639
							
17677
							#印出執行的cmd
-
 
17678
							echo "cmd:".$callShell["cmd"].PHP_EOL;
-
 
17679
 
-
 
17680
							#印出執行後的回傳代碼
-
 
17681
							echo "status:".$callShell["statusCode"].PHP_EOL;
-
 
17682
 
-
 
17683
							#針對每列輸出
-
 
17684
							foreach($callShell["output"] as $line){
-
 
17685
 
-
 
17686
								#印出內容
-
 
17687
								echo $line.PHP_EOL;
-
 
17688
 
-
 
17689
								}#foreach end
-
 
17690
 
-
 
17691
							#清空output
-
 
17692
							unset($output);
-
 
17693
 
-
 
17694
							#如果新增檔案到版本控制成功
-
 
17695
							if($callShell["statusCode"]===0){
-
 
17696
 
-
 
17697
								#記錄要commit的新增檔案
-
 
17698
								$filesToCommit[]=$argv[0];
-
 
17699
 
-
 
17700
								#記錄本次要新增的檔案
-
 
17701
								$fileAdded[]=$argv[0];
-
 
17702
 
-
 
17703
								#函式說明:
-
 
17704
								#清除字串的「"」或「'」符號.
-
 
17705
								#回傳結果:
-
 
17706
								#$result["status"],執行正常與否,"false"代表不正常,"true"代表正常.
-
 
17707
								#$result["function"],當前執行的函式內容.
-
 
17708
								#$result["error"],錯誤訊息陣列.
-
 
17709
								#$result["content"],剔除「"」或「'」符號後的字串.
-
 
17710
								#必填參數:
-
 
17711
								#$conf["str"],字串,要處理的字串.
-
 
17712
								$conf["stringProcess::clearStrSymbol"]["str"]=$argv[0];
-
 
17713
								#可省略參數:
-
 
17714
								#無.
-
 
17715
								#參考資料:
-
 
17716
								#無.
-
 
17717
								#備註:
-
 
17718
								#無.
-
 
17719
								$clearStrSymbol=stringProcess::clearStrSymbol($conf["stringProcess::clearStrSymbol"]);
-
 
17720
								unset($conf["stringProcess::clearStrSymbol"]);
-
 
17721
								
-
 
17722
								#如果執行失敗
-
 
17723
								if($clearStrSymbol["status"]==="false"){
-
 
17724
								
-
 
17725
									#設置執行失敗
-
 
17726
									$result["status"]="false";
-
 
17727
									
-
 
17728
									#設置執行失敗訊息
-
 
17729
									$result["error"]=$clearStrSymbol;
-
 
17730
									
-
 
17731
									#回傳結果
17640
							#回傳結果
17732
									return $result;
17641
							return $result;
17733
								
17642
						
17734
									}#if end
17643
							}#if end
17735
								
17644
						
17736
								#提示已經新增
17645
						#印出執行的cmd
17737
								echo "已新增檔案「".$clearStrSymbol["content"]."」到版本控制".PHP_EOL;
17646
						echo "cmd:".$callShell["cmd"].PHP_EOL;
17738
 
17647
 
17739
								#繼續讓使用者輸入要commit的檔案
17648
						#印出執行後的回傳代碼
17740
								break;
17649
						echo "status:".$callShell["statusCode"].PHP_EOL;
17741
 
17650
 
17742
								}#if end
17651
						#針對每列輸出
-
 
17652
						foreach($callShell["output"] as $line){
17743
 
17653
 
17744
							#反之
17654
							#印出內容
17745
							else{
17655
							echo $line.PHP_EOL;
17746
 
17656
 
17747
								#提示新增檔案到版本控制失敗
17657
							}#foreach end
17748
								echo "新增檔案「".$argv[0]."」到版本控制失敗(".$status.")".PHP_EOL;
-
 
17749
 
17658
 
17750
								#繼續讓使用者輸入要commit的檔案
17659
						#清空output
17751
								break;
17660
						unset($output);
17752
 
17661
 
-
 
17662
						#如果新增檔案到版本控制成功
17753
								}#else end
17663
						if($callShell["statusCode"]===0){
17754
 
17664
 
17755
							}#if end
-
 
17756
							
-
 
17757
						#如果狀態等於 "M"
-
 
17758
						else if($sta==="M"){
-
 
17759
						
-
 
17760
							#記錄要commit的新增檔案
17665
							#記錄要commit的新增檔案
17761
							$filesToCommit[]=$argv[0];
17666
							$filesToCommit[]=$argv[0];
17762
 
17667
 
17763
							#記錄本次要新增的檔案
17668
							#記錄本次要新增的檔案
17764
							$fileAdded[]=$argv[0];
17669
							$fileAdded[]=$argv[0];
Line 17795... Line 17700...
17795
								return $result;
17700
								return $result;
17796
							
17701
							
17797
								}#if end
17702
								}#if end
17798
							
17703
							
17799
							#提示已經新增
17704
							#提示已經新增
17800
							echo "已將檔案「".$clearStrSymbol["content"]."」的異動加到版本控制".PHP_EOL;
17705
							echo "已新增檔案「".$clearStrSymbol["content"]."」到版本控制".PHP_EOL;
17801
 
17706
 
17802
							#繼續讓使用者輸入要commit的檔案
17707
							#繼續讓使用者輸入要commit的檔案
17803
							break;
17708
							break;
17804
							
17709
 
17805
							}#if end
17710
							}#if end
17806
 
17711
 
-
 
17712
						#反之
-
 
17713
						else{
-
 
17714
 
-
 
17715
							#提示新增檔案到版本控制失敗
-
 
17716
							echo "新增檔案「".$argv[0]."」到版本控制失敗(".$callShell["statusCode"].")".PHP_EOL;
-
 
17717
 
-
 
17718
							#繼續讓使用者輸入要commit的檔案
-
 
17719
							break;
-
 
17720
 
-
 
17721
							}#else end
-
 
17722
					
17807
						}#if end
17723
						}#if end
-
 
17724
								
-
 
17725
					#反之有異動過
-
 
17726
					else if($svnsta["content"]["status"][0]["status"]==="M"){
-
 
17727
					
-
 
17728
						#記錄要commit的新增檔案
-
 
17729
						$filesToCommit[]=$argv[0];
-
 
17730
 
-
 
17731
						#記錄本次要新增的檔案
-
 
17732
						$fileAdded[]=$argv[0];
17808
 
17733
 
-
 
17734
						#函式說明:
-
 
17735
						#清除字串的「"」或「'」符號.
-
 
17736
						#回傳結果:
-
 
17737
						#$result["status"],執行正常與否,"false"代表不正常,"true"代表正常.
-
 
17738
						#$result["function"],當前執行的函式內容.
-
 
17739
						#$result["error"],錯誤訊息陣列.
-
 
17740
						#$result["content"],剔除「"」或「'」符號後的字串.
-
 
17741
						#必填參數:
-
 
17742
						#$conf["str"],字串,要處理的字串.
-
 
17743
						$conf["stringProcess::clearStrSymbol"]["str"]=$argv[0];
-
 
17744
						#可省略參數:
-
 
17745
						#無.
-
 
17746
						#參考資料:
-
 
17747
						#無.
-
 
17748
						#備註:
-
 
17749
						#無.
-
 
17750
						$clearStrSymbol=stringProcess::clearStrSymbol($conf["stringProcess::clearStrSymbol"]);
-
 
17751
						unset($conf["stringProcess::clearStrSymbol"]);
-
 
17752
						
-
 
17753
						#如果執行失敗
-
 
17754
						if($clearStrSymbol["status"]==="false"){
-
 
17755
						
-
 
17756
							#設置執行失敗
-
 
17757
							$result["status"]="false";
-
 
17758
							
-
 
17759
							#設置執行失敗訊息
-
 
17760
							$result["error"]=$clearStrSymbol;
-
 
17761
							
-
 
17762
							#回傳結果
-
 
17763
							return $result;
-
 
17764
						
-
 
17765
							}#if end
-
 
17766
						
-
 
17767
						#提示已經新增
-
 
17768
						echo "已將檔案「".$clearStrSymbol["content"]."」的異動加到版本控制".PHP_EOL;
-
 
17769
 
-
 
17770
						#繼續讓使用者輸入要commit的檔案
-
 
17771
						break;
-
 
17772
				
-
 
17773
						}#if end
-
 
17774
						
17809
					#反之
17775
					#反之
17810
					else{
17776
					else{
17811
 
17777
 
17812
						#提示新增檔案到版本控制失敗
17778
						#提示node無異動,所以無法加入為commit的清單
17813
						echo "新增檔案「".$argv[0]."」到版本控制失敗(".$status.")".PHP_EOL;
17779
						echo "檔案「".$argv[0]."」無異動".PHP_EOL;
17814
 
17780
 
17815
						#繼續讓使用者輸入要commit的檔案
17781
						#繼續讓使用者輸入要commit的檔案
17816
						break;
17782
						break;
17817
 
17783
 
17818
						}#else end
17784
						}#else end
17819
 
17785
					
17820
					#繼續輸入要commit的檔案名稱
17786
					#繼續輸入要commit的檔案名稱
17821
					break;
17787
					break;
17822
 
17788
 
17823
				#如果參數數量為0
17789
				#如果參數數量為0
17824
				case 0:
17790
				case 0: