Eventually got round to replacing FileZilla with Rsync and it is fantastic A single click now updates all local files to the server and takes about five seconds!
It is well worth taking the trouble to setup this method because it completely eliminates the need for FileZilla or other upload file transfer programs.
Rsync stands for “remote sync”, is a remote and local file synchronization tool. It uses an algorithm that minimizes the amount of data copied by only moving the portions of files that have changed.
A link on the localhost home page set
$_GET['rsync'] which is tested and if true then Linux RSYNC :
- tests local files which need updating
- zips required files that want updating
- uploads, unzips and overwrites ONLY outdated files
- sets all server file permissions, time stamps, etc
I created the following link on the home-page.php
<?php // RSYNC PAGE LINK or Version $rsync = '<i class="flr fss"> Ver: 5.505 </i>'; if(LOCALHOST): $rsync = '<a class="flr fss" href="?rsync"> rSync </a>'; endif; echo '<h5>' .$rsync .'</h5>';'
<?php // COMMON TO ALL PAGES - mine is in the SuperClass $rsync = isset($_GET['rsync']) ? true : false; if(LOCALHOST && $rsync): // SET LOCAL and REMOTE PATHS $HERE = '/var/www/EXAMPLE.COM/src_files/'; $THERE = 'SSH_ROOT_USER@18.104.22.168:/var/www/EXAMPLE.COM/src_files/'; $USER = 'SSH_USER'; $PWORD = 'SSH_PASSWORD'; $tmp = '/usr/bin/rsync -ratlz --rsh="/usr/bin/sshpass -p $PWORD ssh -o StrictHostKeyChecking=no -l $USER" $HERE $THERE'; $ok = exec($tmp); endif;
To prevent the SSH password from being entered every time I used the following: