Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The question is a little unclear. Depending on how the file was modifed, your solution is going to vary. I mean, if the file is being modified via FTP or directly on the server via terminal then I'm guessing you could run a cronjob to check the mod date on the file every so often. If the last file change time is greater than the previously noted file change time then run a script to do the copy (see below). If the file modification is done by a php script as a result of a user action then you just have to run another script to do the backup (see below).</p> <p><strong>Tracking the last modification time on files</strong><br> So you asked about how to store the last mod time for comparison. You can do that with a database but if that's the only thing you need to store and there aren't going to be a lot files then you might want to go the text file route. In either case, the basic alg. would be to have files table with columns filepath,modification_time (unix time). Each time you check for changes on the file system, hold on to the current mod time. Compare it to the previous mod time (if one exists). If there isn't a previous mod time or if there is no record in the db for the file, add/update record with the current mod time and include this file as one to have the copy script run against. </p> <p><strong>The Copy Script</strong><br> The script to execute once you've figured out that a file has changed is really just a call to php's <em>copy</em> function making sure that you have permissions on the destination of the copy. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload