• Home
  • Who Am I?
  •  

    Web based FTP Sync Tool written in PHP

    FTP Sync Jobs ScreenFTP Sync 0.9

    PURPOSE:
    To upload files which have changed to your production server , automating the task of comparing which files have changed. You simply create a FTP job
    in the script , run the job and it will upload the changed files for you.

    REQUIREMENTS:
    FTP functions are required for this script to work.
    PHP 4 Or 5
    MySQL 4+

    INSTALL:
    Open dbinc.php and put in the database connection variables in there. Once done run installer.php from your browser and you are all set to go.
    Its advised to remove installer.php once you have finished installation.

    SECURITY:
    It if advised that the admin creates users and allocates jobs to them. Also the admin should block access to the database and script files
    from general staff.

    INFO:
    We made this script for our internal use , thought it might be useful for some of you out there. It was a tiring job to find which files needed to be uploaded
    to the main server after development on local server. Thus i created this script , where you can create jobs and upload folders and files which were changed.

    The decision to upload happens on 3 rules:

    1 : you can provide time and date in the job page , files which were created after that time will be uploaded.

    2 : you can ask the script to match the time against the server file , the script would calculate the time offset and calculate if the file has
    changed since last upload.

    3 : The script also keeps a log , if the file changed after last upload , it will upload the file.

    You can exclude the files you dont want to upload, for instance you wont want to upload and overwrite config.php or something like that. So you
    can create the skip list. The skip list is the path of the file from the source directory you have provided.

    For instance if you have a source directory called “/www/something/upload/” , and you dont want to upload the file “/www/something/upload/config.php”
    or the folder “/www/something/upload/users/images” then you would put in something like this:

    config.php
    users/images

    Remember no trailing slash for folders.

    You need to have writable permissions for the logs folder , also if you want to utlize the copy permissions feature you will need the BcMath library
    compiled with PHP.

    The admin can run any job , but if you want to have users which can run specific jobs only please utilize the users section , in which a user can
    run all jobs or only specific jobs.

    Same goes for the jobs , you can set an attribute to allow all users to run the job.

    This code has been tested on PHP 5 and PHP 4.4.

    You are free to modify the code as you please. The code is released in the public domain under the GPL license.

    Enjoy!


    7 Responses to “Web based FTP Sync Tool written in PHP”

    1. Charles says:

      Nice tool. I have made a few fixes to the source, and added a feature – was curious if you are interested in continuing development on this? I would be interested in working with you on any new features.

    2. php ist says:

      Your script rocks man! It really really saves my day :D
      A bit different from what i need. My purpose is the opposite, which is to download from ftp server. But just couple hours of modification and it’s done. Yey!
      Thank a lot :) :)

    3. MariuszT says:

      Nice! Thank you :)

    4. tony says:

      Why does it only upload one file? Cant get it to upload all files in the local path.

    5. Alon Carmel says:

      Amazing script, i am porting it into the Symfony class, just amazing.
      One note. For effectiveness i’ve modified the runjob.php :: line : 160 – >

      if($file != “.” && $file != “..” && $file != “.svn”){

      It gave tons of errors, now it skips anything related to svn. works like charm.

    6. Alon Carmel says:

      Also, it fails and gets stuck on some files. dont know why. tried uploading .py file and gets stuck.

    7. I’m thinking about porting this into Drupal.

      Just FYI, You should correct your php tags from <? to <?php. This is going to become a requirement in future versions of PHP.

      Also, add a # in front of your —- in the database installation script. Without that installation fails in my installation.

      apart from those tiny things, great work – thank you for putting the effort into this script.

    Leave a Reply