PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sun Jun 25, 2017 5:31 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: diff over FTP
PostPosted: Sat Apr 02, 2016 10:04 am 
Offline
Forum Contributor
User avatar

Joined: Wed Apr 14, 2010 4:45 pm
Posts: 375
Location: UK
Hi,

Does anyone know how I can diff files on my local machine and a remote server accessible only via FTP? The problem I have is that my client doesn't have any kind of CVS and I have to do all my development on my local machine before uploading it to their test server, then if everything works OK I have to do the same thing with their live server. A bonus feature(?) of this arrangement is that one of their other developers only works on the live site and never updates the test server with his changes, so I can't automatically overwrite the files on both servers in case I overwrite some of his code. This isn't strictly a Linux question because I'm using OS X, but if there's any Un*x/Linux software available I should be able to compile it.

Thanks in advance,

Mecha Godzilla


Top
 Profile  
 
 Post subject: Re: diff over FTP
PostPosted: Sat Apr 02, 2016 10:36 am 
Offline
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 13408
Location: New York, NY, US
Have you tried rsync? That is the standard solution for *nix. I use is all the time.

_________________
(#10850)


Top
 Profile  
 
 Post subject: Re: diff over FTP
PostPosted: Sat Apr 02, 2016 12:25 pm 
Offline
Forum Contributor
User avatar

Joined: Wed Apr 14, 2010 4:45 pm
Posts: 375
Location: UK
Thanks - I'll look into that. I think rdiff might be closer to what I want because what I need to be able to do is see whether or not any changes have been made to the files on the remote server before I overwrite them, so that I can sync my local copy of the files before I overwrite the copies on the live server. If rsync or rdiff can compare the file checksums and ask me whether I want the files overwritten that would probably work. What I was hoping for was a networked version of diff, so maybe I could do something like

diff /htdocs/my_web_site/my_script.php ftp://username:password@www.mydomain.com/my_script.php

and diff would go and get the file on the remote server for me. Maybe I could do what I want using PHP - loop through all the files and retrieve them via FTP, then pipe the output to diff. Not exactly optimal but it might work.

M_G


Top
 Profile  
 
 Post subject: Re: diff over FTP
PostPosted: Sat Apr 02, 2016 4:03 pm 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6249
Location: Montreal, Canada
Still thinking this through, but what if you set up Git on your end (if you haven't already), rsync'ed the live environment to your local, and git diff locally. That would at least allow you to see their changes, merge them in, create a commit for the changes they've made (commit messages would be interesting...), and then add your new work on top. At least have commit history and the ability to revert changes available on one end and get diff in the process.

_________________
Supported PHP versions No longer supported versions


Top
 Profile  
 
 Post subject: Re: diff over FTP
PostPosted: Sun Apr 03, 2016 12:18 pm 
Offline
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 13408
Location: New York, NY, US
rsync had a -n dry run flag that will give you the same info (rdiff is not always installed standard). I agree with Celauran that you might want to look at your entire process and incorporate Git into it. There are some major benefits to using Git. You may even be able to use Git hooks to do the rsync part automatically.

_________________
(#10850)


Top
 Profile  
 
 Post subject: Re: diff over FTP
PostPosted: Sun Apr 03, 2016 2:58 pm 
Offline
Forum Contributor
User avatar

Joined: Wed Apr 14, 2010 4:45 pm
Posts: 375
Location: UK
Thank you both for your suggestions. I haven't used rsync before so that's something I need to look at. I use Fossil for version control rather than Git but that's just because I found Fossil easier to get on with - I do have Git installed though. So, I guess I need to do some reading up and report back - thanks again for your help.

M_G


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group