[ create a new paste ] login | about

Link: http://codepad.org/re9QmhHU    [ raw code | output | fork ]

fedecarg - PHP, pasted on Aug 19:
Index: FileSyncTask.php
===================================================================
--- FileSyncTask.php	(revision 39)
+++ FileSyncTask.php	(working copy)
@@ -130,12 +130,38 @@
 	protected $delete = false;

 	/**
+	 * List of error code/messages for rsync
+	 *
+	 * @var array
+	 */
+	protected $error = array();
+	
+	/**
 	 * Phing's main method. Wraps the executeCommand() method.
 	 * 
 	 * @return void
 	 */
 	public function main() 
 	{
+	    // error codes/message for rsync 
+        $this->error[0] = "Success";
+        $this->error[1] = "Syntax or usage error";
+        $this->error[2] = "Protocol incompatibility";
+        $this->error[3] = "Errors selecting input/output files, dirs";
+        $this->error[4] = "Requested action not supported: an attempt was made to manipulate 64-bit files on a platform that cannot support them; or an option was specified that is supported by the client and not by the server.";
+        $this->error[5] = "Error starting client-server protocol";
+        $this->error[10]= "Error in socket I/O";
+        $this->error[11]= "Error in file I/O";
+        $this->error[12]= "Error in rsync protocol data stream";
+        $this->error[13]= "Errors with program diagnostics";
+        $this->error[14]= "Error in IPC code";
+        $this->error[20]= "Received SIGUSR1 or SIGINT";
+        $this->error[21]= "Some error returned by waitpid()";
+        $this->error[22]= "Error allocating core memory buffers";
+        $this->error[23]= "Partial transfer due to error";
+        $this->error[24]= "Partial transfer due to vanished source files";
+        $this->error[30]= "Timeout in data send/receive";
+	    
 		$this->executeCommand();
 	}
 	
@@ -183,7 +209,7 @@
 		$return = null;
 		exec($command, $output, $return);
 		if ($return != 0) {
-			$this->log('Task exited with code: ' . $return, Project::MSG_INFO);
+			$this->log('Task exited with message: (' . $return.') '.$this->error[$return], Project::MSG_INFO);
 			$this->log($command);
 			return 1;
 		} else {


Output:
Index: FileSyncTask.php
===================================================================
--- FileSyncTask.php	(revision 39)
+++ FileSyncTask.php	(working copy)
@@ -130,12 +130,38 @@
 	protected $delete = false;

 	/**
+	 * List of error code/messages for rsync
+	 *
+	 * @var array
+	 */
+	protected $error = array();
+	
+	/**
 	 * Phing's main method. Wraps the executeCommand() method.
 	 * 
 	 * @return void
 	 */
 	public function main() 
 	{
+	    // error codes/message for rsync 
+        $this->error[0] = "Success";
+        $this->error[1] = "Syntax or usage error";
+        $this->error[2] = "Protocol incompatibility";
+        $this->error[3] = "Errors selecting input/output files, dirs";
+        $this->error[4] = "Requested action not supported: an attempt was made to manipulate 64-bit files on a platform that cannot support them; or an option was specified that is supported by the client and not by the server.";
+        $this->error[5] = "Error starting client-server protocol";
+        $this->error[10]= "Error in socket I/O";
+        $this->error[11]= "Error in file I/O";
+        $this->error[12]= "Error in rsync protocol data stream";
+        $this->error[13]= "Errors with program diagnostics";
+        $this->error[14]= "Error in IPC code";
+        $this->error[20]= "Received SIGUSR1 or SIGINT";
+        $this->error[21]= "Some error returned by waitpid()";
+        $this->error[22]= "Error allocating core memory buffers";
+        $this->error[23]= "Partial transfer due to error";
+        $this->error[24]= "Partial transfer due to vanished source files";
+        $this->error[30]= "Timeout in data send/receive";
+	    
 		$this->executeCommand();
 	}
 	
@@ -183,7 +209,7 @@
 		$return = null;
 		exec($command, $output, $return);
 		if ($return != 0) {
-			$this->log('Task exited with code: ' . $return, Project::MSG_INFO);
+			$this->log('Task exited with message: (' . $return.') '.$this->error[$return], Project::MSG_INFO);
 			$this->log($command);
 			return 1;
 		} else {


Create a new paste based on this one


Comments: