Yo
See attached for first cut of lftp drush task. lftp is a poor mans rsync. Even these days we are all occasionally inflicted with the pain of having to deploy to a live site over ftp, and this allows that.
It's currently (probably) DANGEROUS. I've literally only tested it in one circumstance.
Provides drush lsync command (lftp-sync)
# drush lsync @project.local:%files @project.live:%files
- Code based on (copied and pasted from) drush core rsync. Ultimately it could make sense to make rsync more generic to allow multiple providers (rsync or lftp). That could be cleaner. On the other hand, writing a seperate command is quicker to get done.
- Works against drush head as at Feb 10 2011
- This is the first time I've looked at site alias code, at 3:30am and really don't understand what it's doing. At all. I copied sitealias_evaluate_path into my own drush_lftp_sitealias_evaluate_path as the original seems hard coded to expect rsync relevant parameters (remote host etc). So for purposes of first version I duplicate.
- This expects your site alias file to have an 'lftp' array. E.G
$aliases['live'] = array(
'uri' => 'mydomain.com',
'root' => '/public_html',
'lftp' => array(
'protocol' => 'sftp://',
'user' => 'mydomainuser',
'pass' => 'mydomainpass',
'host' => 'mydomainhost.com',
'root' => '/public_html'
),
'path-aliases' => array (
'%files' => 'sites/default/files',
),
);
The extra lftp array made sense at 3:30am "getting it to work". Probably not in real life.
Hoping someone who knows what they doing with drush site aliases will pick this up and clean it up.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | lftp.drush_.inc_.txt | 13.09 KB | willieseabrook |
Comments
Comment #1
willieseabrook commentedComment #2
willieseabrook commentedAdditionally, I havn't set up the possible parameters like the rsync command.
lftp options are as follows:
Comment #3
greg.1.anderson commentedNot opposed to this at all, if it was cleaned up as described above.
Perhaps even better would be a change to drush core that allowed the rsync command to use some other transport mechanism if appropriate options were set. I may have to do this shortly to support sql-sync on Windows. Once that is available, perhaps lftp / sftp might be another transport mechanism to consider.