Forum Moderators: coopster
Is there a possibility that one request could happen in between the other requests open and lock?
LOCK_EX = Acquire an exclusive lock on the file while proceeding to the writing. Mutually exclusive with FILE_APPEND.
include_once 'file-location.php';
if(filemtime($file) < time()-60*60) {
$new_file_location='file-name-'.time().'.php';
$set_file_location='<?php $file=\''.$new_file_location.'\' ?>';
file_put_contents($new_file_location,'http://www.example.com/the-file');
file_put_contents('file-location.php',$set_file_location,LOCK_EX);
unlink($file);
}
else { exit; }