classes/phing/tasks/ext/FileSyncTask.php
public function executeCommand()
    {
        if ($this->rsyncPath === null) {
            throw new BuildException('The "rsyncPath" attribute is missing or undefined.');
        }

        if ($this->sourceDir === null) {
            throw new BuildException('The "sourcedir" attribute is missing or undefined.');
        } else {
            if ($this->destinationDir === null) {
                throw new BuildException('The "destinationdir" attribute is missing or undefined.');
            }
        }

        if (strpos($this->destinationDir, ':')) {
            $this->setIsRemoteConnection(true);
        }

        if (strpos($this->sourceDir, ':')) {
            if ($this->isRemoteConnection) {
                throw new BuildException('The source and destination cannot both be remote.');
            }
            $this->setIsRemoteConnection(true);
        } else {
            if (!(is_dir($this->sourceDir) && is_readable($this->sourceDir))) {
                throw new BuildException('No such file or directory: ' . $this->sourceDir);
            }
        }

        if ($this->backupDir !== null && $this->backupDir == $this->destinationDir) {
            throw new BuildException("Invalid backup directory: " . $this->backupDir);
        }

        $command = $this->getCommand();

        $output = [];
        $return = null;
        exec($command, $output, $return);

        $lines = '';
        foreach ($output as $line) {
            if (!empty($line)) {
                $lines .= "\r\n" . "\t\t\t" . $line;
            }
        }

        $this->log($command);

        if ($return != 0) {
            $this->log('Task exited with code: ' . $return, Project::MSG_ERR);
            $this->log(
                'Task exited with message: (' . $return . ') ' . $this->getErrorMessage($return),
                Project::MSG_ERR
            );
            throw new BuildException($return . ': ' . $this->getErrorMessage($return));
        } else {
            $this->log($lines, Project::MSG_INFO);
        }

        return $return;
    }
public function executeCommand()
    {
        if ($this->rsyncPath === null) {
            throw new BuildException('The "rsyncPath" attribute is missing or undefined.');
        }

        if ($this->sourceDir === null) {
            throw new BuildException('The "sourcedir" attribute is missing or undefined.');
        } else {
            if ($this->destinationDir === null) {
                throw new BuildException('The "destinationdir" attribute is missing or undefined.');
            }
        }

        if (strpos($this->destinationDir, ':')) {
            $this->setIsRemoteConnection(true);
        }

        if (strpos($this->sourceDir, ':')) {
            if ($this->isRemoteConnection) {
                throw new BuildException('The source and destination cannot both be remote.');
            }
            $this->setIsRemoteConnection(true);
        } else {
            if (!(is_dir($this->sourceDir) && is_readable($this->sourceDir))) {
                throw new BuildException('No such file or directory: ' . $this->sourceDir);
            }
        }

        if ($this->backupDir !== null && $this->backupDir == $this->destinationDir) {
            throw new BuildException("Invalid backup directory: " . $this->backupDir);
        }

        $command = $this->getCommand();

        $output = [];
        $return = null;
        exec($command, $output, $return);

        $lines = '';
        foreach ($output as $line) {
            if (!empty($line)) {
                $lines .= "\r\n" . "\t\t\t" . $line;
            }
        }

        $this->log($command);

        if ($return != 0) {
            $this->log('Task exited with code: ' . $return, Project::MSG_ERR);
            $this->log(
                'Task exited with message: (' . $return . ') ' . $this->getErrorMessage($return),
                Project::MSG_ERR
            );
            throw new BuildException($return . ': ' . $this->getErrorMessage($return));
        } else {
            $this->log($lines, Project::MSG_INFO);
        }

        return $return;
    }
public function executeCommand ( ) { if ( $ this -> rsyncPath === null ) { throw new BuildException ( 'The "rsyncPath" attribute is missing or undefined.' ) ; } if ( $ this -> sourceDir === null ) { throw new BuildException ( 'The "sourcedir" attribute is missing or undefined.' ) ; } else { if ( $ this -> destinationDir === null ) { throw new BuildException ( 'The "destinationdir" attribute is missing or undefined.' ) ; } } if ( strpos ( $ this -> destinationDir , ':' ) ) { $ this -> setIsRemoteConnection ( true ) ; } if ( strpos ( $ this -> sourceDir , ':' ) ) { if ( $ this -> isRemoteConnection ) { throw new BuildException ( 'The source and destination cannot both be remote.' ) ; } $ this -> setIsRemoteConnection ( true ) ; } else { if ( ! ( is_dir ( $ this -> sourceDir ) && is_readable ( $ this -> sourceDir ) ) ) { throw new BuildException ( 'No such file or directory: ' . $ this -> sourceDir ) ; } } if ( $ this -> backupDir !== null && $ this -> backupDir == $ this -> destinationDir ) { throw new BuildException ( "Invalid backup directory: " . $ this -> backupDir ) ; } $ command = $ this -> getCommand ( ) ; $ output = [ ] ; $ return = null ; exec ( $ command , $ output , $ return ) ; $ lines = '' ; foreach ( $ output as $ line ) { if ( ! empty ( $ line ) ) { $ lines .= "\r\n" . "\t\t\t" . $ line ; } } $ this -> log ( $ command ) ; if ( $ return != 0 ) { $ this -> log ( 'Task exited with code: ' . $ return , Project :: MSG_ERR ) ; $ this -> log ( 'Task exited with message: (' . $ return . ') ' . $ this -> getErrorMessage ( $ return ) , Project :: MSG_ERR ) ; throw new BuildException ( $ return . ': ' . $ this -> getErrorMessage ( $ return ) ) ; } else { $ this -> log ( $ lines , Project :: MSG_INFO ) ; } return $ return ; }
Executes the rsync command and returns the exit code.

@return int            Return code from execution.
@throws BuildException
Executes the rsync command and returns the exit code .