By Kim Haskell
© 2007-2016 Kim Haskell, Scriptol.com, Scriptol.fr
Free software under open source GNU LPG 2.0 license
It is a software for transferring file on a Web site, working in an automatic way, to update the contents of the site from file created locally on a personal computer.
It detects the modifications and transfers modified files.
It is possible in option to transfer the files published since a certain number of days.
To webmasters who realize a Web site locally and then upload the pages on the server.
It is not thus appropriate for those which work directly on line on the site and in particular those whose site is managed entirely by a CMS.
The software can nevertheless function if one uses static pages along with content management systems such as forums but it operates only on the static part.
One passes to the software the required parameters: FTP address, login, password, remote directory, source directory. The source directory is recursively scanned with its sub-directories, contents are compared with remote contents, and modified files are uploaded on the site.
The main options of acceleration are as follows:
One indicates a number of days spent, and all the files modified during these last days are transferred without comparison with the remote contents.
The program is used at command l line, in DOS window or an Unix console.
It is recommended to create a batch file (.BAT under Windows) to avoid typing the options with each use.
One can then add an icon on the desktop, which launches this command file, and on which one clicks to update each modification of a file.
In a personal environment one can place all the options in the file batch.
In a collective environment, it is not advised to put the password in the file. It should be asked by the program at runtime instead.
Two modes of operation are possible, with additional options:
Transfer according to the
period.
In this case all the files modified the very same day or
since a given number of days, are transferred on the server. The
backup directory becomes optional then.
Associated transfer and
backup.
The files are compared with the contents of a backup
directory. Those whose date (at the second near), are more recent
are copied to the server and also in the backup directory. In the
backup, original date and time are applied to the copy (for further
comparison).
It is possible also without using backup, to compare the files with those which are stored on the server, but the operation is extremely slow.
The command has the form:
solp ftpsync [options] [parameters] sourcedir [URL]
or directly in PHP:
php ftpsync.php [options] [parameters] sourcedir URL
The parameters allow to give the login, the password, etc. If a required parameter misses, the program prompt for it.
The options define the mode of update and what one wants to display at runtime. When an option misses, the default option is used.
The URL is the FTP address, in the “ftp . scriptol .com” form. If it is omitted, the program asks it.
Options and parameters
- t Test mode, the program proceeds virtually and displays what it would do. But nothing is modified neither on the server, nor in the backup directory. By defect the mode is real.
- ndays Last days mode. The code -n is followed by a number of days: 0 for today, 1 for yesterday and so on. All that is modified in the given period, today, yesterday or during the n last days, is uploaded on the server.
- bbackup Defines the backup
directory and states consequently that one chooses the backup mode.
The date of files is compared with that of files in this directory,
the more recent files are uploaded on the server. “Date”
actually means the exact moment in seconds.
If this option is
omitted, the program will compare the files with those which are on
the server. The transfer is very slow and could be interrupted by the
server.
-ddirectory Defines the directory on the server, in which one copies the files. Often the site is in a www directory. It is then necessary to add this option:
-dwww/ Define the sub-directory.
On a multi-domain hosting, it is
necessary to indicate the name of the directory associated with a
domain. The directory is the same one as that which one uses with a
FTP transfer software.
This directory is not part of the URL given to the browser.
- llogin Defines the login. If - l is specified but that nothing follows, the program display an error message. But if the option is not given, the program will prompt for the login at runtime.
- ppassword Defines the password. Works like for the login. If you are working in a collective environment, do not put the password in a command file. It is better to enter it when the program ask for it.
-c For a comparison of contents rather than on dates. That is done with the backup directory and is of course slower than the comparison by date, which is the default option.
-a Upload all the files to restore the site, no comparison is made. If a backup directory is given, the files will be also copied in this directory.
-v Verbose mode. Display more details about what is done.
-q Quiet Mode. Do not display anything about action of the program.
Options for link check
It is possible (since version 1.3) for each page loaded on the
server, to test the links it contains, in order to avoid broken
links, whether internal or external links.
Two options have been
added to activate the checking:
-u Activation of the test.
-wsite Indicate the domain of the site.
The URL of
the site is necessary for relative internal links, to rebuild an
absolute URL.
If the ftp address is also that of the site, the
option-w is superfluous, the ftp URL will be transformed into http.
This is not the case with sites sharing the same host, we must
specify the domain of the site.
Option for site map
The site map is automatically updated for any page put online. If the page is already in the map, only the date will be updated. The frequency change and priority are not changed.
-m Enable updating the site map.
PHP FTP Synchronizer is an
extensible program. If you are even a beginner in programming, you
can easily add options in the source.
In the event of problem to
use PHP FTP Synchronizer, do not hesitate to post on the forum in the
language of your choice, Scriptol.com
in English, Scriptol.fr in French.