puuro / ftpcatapult-2

FTP sync tool written in PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FTP CATAPULT

FTP sync tool/ website deployment tool written in PHP for UNIX/LINUX/MAC. Only thing that is OS specific is some shell "cp" and "mkdir" commands.
May be useful if you have only FTP connection to server and want to edit the files and if you don't like doing development in a FTP client and if you don't want to keep track which files you have edited and if you don't want to send a whole directory to server after you have made a small change. So this tool enables you to edit files locally with editor you like and deploy them to server easily and fast and it enables you to do this from multiple computers and it enables your friends, too, to sync your files and help you.
It works and I have been using this with a couple of small projects.

Installation

Put pultd.php and conf.php files in a folder. Set variables in conf.php. Local path is the directory where you work with your code, e.g. "../work/". Remote path is path in server from your FTP home directory e.g. "/htdocs/".
If you don't have the project in your hard disk yet, save it now to the directory that you set in conf.php. You can also leave it empty if you wish to only pull single files from the server.
Rename conf2.php to conf.php.
Run php pultd.php init.
This creates directories in tool's folder.
Run php pultd.php push list.
This creates a list of files in your project directory and sends it to server. Possible other contributors to the same server don't need to do this command.

Some explanation

image/ directory has an up-to-date image of your server contents, that's why it's called image. When you push files to server the tool compares your project directory and image directory and sees which files have changed. So comparison happens offline and is fast.
files/ directory has some files that are used in determining which files should be pulled. They are also updated when pushing.
Tool maintains a list of all files and when they have changed. The file is located in the server and is downloaded every time you push or pull. It also keeps in memory when you have last pushed or pulled from that computer. When you pull it makes comparisons between those times to determine which files have changed and should be pulled.
Multiple users can make changes to the files at the server. Users can pull the changes each of them has made.
Files are never deleted in server but they may be overwritten.
Files are never deleted locally either but they may be overwritten.

Commands

Run php pultd.php [ARGUMENT] [ARGUMENT] ...
Run php pultd.php for a list of commands.
init: Create directories and copy content from project folder to image folder.
push: Send to server files that have changed or are new.
push anyway: Push anyway, even though there may be conflicts(Files in server have changed since your last pull/push)
push list: Create a list of files and send it to server.
pull: Pull files from server that have changed since last pull. They are downloaded to image folder not project folder.
pull brave: Pull files from server that have changed since last pull. They are downloaded to image folder and project folder.
pull local: Copy files from image folder to project folder.
pull force: Pull everything from server.
pull file [FILE]: Pull a single file from server. You can edit and push single files, too. You don't need to have a whole project on your hard disk. When using this command you have to create proper directories in image and project folder because this command doesn't create the needed directories. E.g. pull files css/css.css: you have to create mkdir image/css and mkdir [PROJECT DIR]/css.
uptodate: If you know you're files are up to date you may use this command so files are not pulled that have changed before current time.

About

FTP sync tool written in PHP


Languages

Language:PHP 100.0%