Hi. I have a file that is 1.2Mb (A .db file, from Links 2).
I have got so far a script that opens up the file, puts all the content of it into an array, and then it goes through to check the status of the site (i.e. 404, 200 etc).
Now what I am trying to do is use a foreach loop to write the new data to links.db (the old file will be backed up to links.db.$date). However, it occured to me that seeing as there is over 4,000 links in the directory, what were to happen if the script were canceled (purposly or accidently). Would the whole file get corrupted too, or just the info that was being put in would not appear.
I have thought about writing the data to links.db.new, and then renaming it to links.db (after renaming the old copy). This would only happen at the end of the script, AFTER a successful go-through of the file.
Does this sound like a good idea, or are there better faster ones?
Thanks
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
I have got so far a script that opens up the file, puts all the content of it into an array, and then it goes through to check the status of the site (i.e. 404, 200 etc).
Now what I am trying to do is use a foreach loop to write the new data to links.db (the old file will be backed up to links.db.$date). However, it occured to me that seeing as there is over 4,000 links in the directory, what were to happen if the script were canceled (purposly or accidently). Would the whole file get corrupted too, or just the info that was being put in would not appear.
I have thought about writing the data to links.db.new, and then renaming it to links.db (after renaming the old copy). This would only happen at the end of the script, AFTER a successful go-through of the file.
Does this sound like a good idea, or are there better faster ones?
Thanks
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!