<commit_before><?php
/**
 * Extends the 'sftpMgr' class and implementing doPutFile doGetFile using Aspera.
 * For additional comments please look at the 'sftpMgr' class.
 * 
 * @package infra
 * @subpackage Storage
 */
class asperaMgr extends sftpMgr
{
	
	// upload a file to the server ising Aspera connection (ftp_mode is irrelevant)
	protected function doPutFile ($remote_file , $local_file , $ftp_mode, $http_field_name = null, $http_file_name = null)
	{
		$remote_file = ltrim($remote_file,'/');
		$cmd= $this->getCmdPrefix();
		$cmd.=" $local_file $this->user@$this->server:$remote_file";
		return $this->executeCmd($cmd);
	}
		
	// upload a file to the server ising Aspera connection (ftp_mode is irrelevant)
	protected function doGetFile ($remote_file, $local_file, $ftp_mode)
	{	
		$remote_file = ltrim($remote_file,'/');
		$cmd= $this->getCmdPrefix();
		$cmd.=" $this->user@$this->server:$remote_file $local_file";
		return $this->executeCmd($cmd);
	}
	
	private function getCmdPrefix(){
		$cmd = '';
		if ($this->privKeyFile){
			if ($this->passphrase)
				$cmd = "(echo $this->passphrase) | ascp ";
			else  
				$cmd = "ascp ";
		}
		else 
			$cmd = "(echo $this->pass) | ascp ";
		$cmd.=" -P $this->port ";
		if ($this->privKeyFile)
			$cmd.=" -i $this->privKeyFile ";
		return $cmd;
		
	}
	
	private function executeCmd($cmd){
		KalturaLog::debug('Get file using command: '.$cmd);
		$return_value = null;
		$beginTime = time();
		system($cmd, $return_value);
		$duration = (time() - $beginTime)/1000;
		KalturaLog::debug("Download took [$duration]sec with value [$return_value]");
		return $return_value;
	}
}<commit_msg>PS:P-70002 if return_value=0 (execution succeed), return true.  +documantation<commit_after><?php
/**
 * Extends the 'sftpMgr' class and implementing doPutFile doGetFile using Aspera.
 * For additional comments please look at the 'sftpMgr' class.
 * 
 * @package infra
 * @subpackage Storage
 */
class asperaMgr extends sftpMgr
{
	
	// upload a file to the server ising Aspera connection (ftp_mode is irrelevant)
	protected function doPutFile ($remote_file , $local_file , $ftp_mode, $http_field_name = null, $http_file_name = null)
	{
		$remote_file = ltrim($remote_file,'/');
		$cmd= $this->getCmdPrefix();
		$cmd.=" $local_file $this->user@$this->server:$remote_file";
		return $this->executeCmd($cmd);
	}
		
	// upload a file to the server ising Aspera connection (ftp_mode is irrelevant)
	protected function doGetFile ($remote_file, $local_file, $ftp_mode)
	{	
		$remote_file = ltrim($remote_file,'/');
		$cmd= $this->getCmdPrefix();
		$cmd.=" $this->user@$this->server:$remote_file $local_file";
		return $this->executeCmd($cmd);
	}
	
	private function getCmdPrefix(){
		$cmd = '';
		if ($this->privKeyFile){
			if ($this->passphrase)
				$cmd = "(echo $this->passphrase) | ascp ";
			else  
				$cmd = "ascp ";
		}
		else 
			$cmd = "(echo $this->pass) | ascp ";
		$cmd.=" -P $this->port ";
		if ($this->privKeyFile)
			$cmd.=" -i $this->privKeyFile ";
		return $cmd;
		
	}
	
	private function executeCmd($cmd){
		KalturaLog::debug('Executing command: '.$cmd);
		$return_value = null;
		$beginTime = time();
		system($cmd, $return_value);
		$duration = (time() - $beginTime)/1000;
		KalturaLog::debug("Execution took [$duration]sec with value [$return_value]");
		if ($return_value == 0)
			return true;
		return false;
	}
}
{'fraction_non_alphanumeric': 0.16305316305316306, 'fraction_numerical': 0.004455004455004455, 'mean_word_length': 4.213622291021672, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1560383', 'n_tokens_mistral': 1296, 'n_tokens_neox': 1172, 'n_words': 292}