git 2 rokov pred
rodič
commit
70df026813
1 zmenil súbory, kde vykonal 21 pridanie a 25 odobranie
  1. 21 25
      Home/Lib/Action/CronAction.class.php

+ 21 - 25
Home/Lib/Action/CronAction.class.php

@@ -8,33 +8,29 @@ class CronAction extends Action {
 
  
 	public  function searchFile2Ftp(  ){
+		while(true){
+			$dir = C('FTP_LOCAL_DIR');
+			$targetDir = C('FTP_SERVER_DIR');
+			$config = C('FTP_CONFIG');
 		
-		$dir = C('FTP_LOCAL_DIR');
-		$targetDir = C('FTP_SERVER_DIR');
-		$config = C('FTP_CONFIG');
-		$res = scanTargetFile($dir, 'md5');
-		$files = explode(';', $res);
-		array_pop($files);
-		foreach($files as $v){
-			$path_parts = pathinfo($v);
-			
-			
-			
-			$locDat = $path_parts['dirname']. '/' . $path_parts['filename'].'.dat';
-			$tagetDat = $targetDir.'/'. $path_parts['filename'].'.dat';
-			$datRes = Zmcoding\FtpFile::getInstance($config)->up_file($locDat, $tagetDat);
-			
-			if($datRes){
-				debug_log('upload_info',json_encode($tagetDat,JSON_UNESCAPED_UNICODE));
+			$res = scanTargetFile($dir, 'md5');
+			$files = explode(';', $res);
+			array_pop($files);
+			foreach($files as $v){
+				$path_parts = pathinfo($v);
+				$locDat = $path_parts['dirname']. '/' . $path_parts['filename'].'.dat';
+				$tagetDat = $targetDir.'/'. $path_parts['filename'].'.dat';
+				echo $tagetDat.PHP_EOL;
+				$datRes = Zmcoding\FtpFile::getInstance($config)->up_file($locDat, $tagetDat);
+				if($datRes){
+					debug_log('upload_info',json_encode($tagetDat,JSON_UNESCAPED_UNICODE));
+				}
+				$md5Res = Zmcoding\FtpFile::getInstance($config)->up_file($v,  $targetDir.'/'. $path_parts['basename']);//md5文件
+				if($md5Res){
+					debug_log('upload_info',json_encode($targetDir.'/'. $path_parts['basename'],JSON_UNESCAPED_UNICODE));
+				}
 			}
-			
-			$md5Res = Zmcoding\FtpFile::getInstance($config)->up_file($v,  $targetDir.'/'. $path_parts['basename']);//md5文件
-			
-			if($md5Res){
-				debug_log('upload_info',json_encode($targetDir.'/'. $path_parts['basename'],JSON_UNESCAPED_UNICODE));
-			}
-			
-			
+			sleep(3);
 		}
 	}