files being pushed server via ftp. process them php code in drupal module. o/s ubuntu , ftp server vsftp.
at regular intervals check new files, process them simplexml , move them "done" folder. how avoid processing partially uploaded file?
vsftp has lock_upload_files defaulted yes. thought of attempting move files first, expecting move fail on uploading file. doesn't seem happen, @ least on command line. if start uploading large file , move, keeps growing in new location. guess directory entry not locked.
should try fopen mode 'a' or 'r+' see if succeeds before attempting load simplexml or there better way this? guess detect simplexml load failing but... seems messy.
i don't have control of sender. won't upload , rename.
thanks
if locking doesn't work, don't know of solution clean/simple you'd like. make educated guess not processing files last modified time (which can filemtime()
) within past x minutes.
if want higher degree of confidence that, check , store each file's size (using filesize()
) in simple database, , every x minutes check new size against old size. if size hasn't changed in x minutes, can assume nothing more being sent.
Comments
Post a Comment