· Martin's Expiry Checker v3 Blog ·

M.E.Bush > Misc. > Expiry Checker v3 Blog > 13-Aug-2006

Second thoughts about expiredpagehandler.php4

Here's my revised pseudo-code for expiredpagehandler.php4, which is to be invoked once per week on a Monday morning...
expiredpagehandler.php4

open and lock the ExpiryData.xml file
append the missing "</expiredpages>"
copy ExpiryData.xml to ExpiryDataLastWeek.xml
initialise the ExpiryData.xml file (i.e. discard all the entries)
unlock and close the ExpiryData.xml file
for each raw url recorded in ExpiryDataLastWeek.xml
  normalise the url
  lynx -dump the normalised url to invoke expirychecker.php4
endfor
open and lock the ExpiryData.xml file
for each expired page now recorded in the ExpiryData.xml file
  if expirydate is older than today's date then
    send email to owner
    if expirydate is over a month older than today's date then
      send email to webmaster
    endif
  endif
endfor
unlock and close the ExpiryData.xml file
The idea is for this script to populate the ExpiryData.xml file with fresh, normalised data before sending reminder messages for the expired pages. During the time that the first for loop is executing there could be additional entries being recorded as a result of independent expired page hits, but I don't think that's a problem.