Sorry about that
Published on 5 Feb 2006 at 12:09 am.
Filed under Uncategorized.
My ole boss Steve pointed out my Web site had some bugs in it. I feel that I should offer an apology for these bugs, and should offer an explanation.
On every page on this site you will notice that there are links to the last 10 blog entries. Because I am accessing this information outside of the blog directory, I wrote a little script that will call that information differently then the way WordPress does it, rather than worry about using WordPress’ version of doing so (if it’s even possible) outside of WordPress’ working directory. My initial thought was to try and cut down the number of SQL queries unless absolutely necessary, so why not parse the RSS file (I default to an SQL query if I cannot parse the RSS file). To do this, I used lastRSS.
lastRSS is a PHP RSS parser/reader. One of the neat features of lastRSS is that you can cache the results from a call to retrieve the RSS file. This is nice, because it means I do not have to access the Internet to retrieve the RSS file every time someone wants to access my Web page, and will keep more of the site running the way it’s supposed to if the database is down for some reason. Because I am very anal and want users to see the very latest posts, I hacked WordPress to delete the the cache file whenever I wrote a new post or deleted a post.
The other day it occurred: Why do I need to access the Internet to get the results running a file that’s hosted on my Web server? In theory this shouldn’t be a problem.
Of course, this requires telling the server the access to the file you want be parsed. Is that hard? One wouldn’t think so, but evidently I told it to access a file that doesn’t exist. No biggie, this means the server will fall back to my SQL query method. The page even looked fine when I checked the home page.
The problem with this is that my SQL backup method connects to the database using the same account used by WordPress, but a different variable name, and close the connection when it’s done getting information from the database. This is a problem for WordPress because a PHP will close the connection for both variables (since they are the same login information). Solution: create a new account or don’t close the database connection.
Now that I’ve got my fallback method fixed, why don’t I fix the original problem? I changed the file location for the file lastRSS should parse but no dice. After like 30 minutes of scratching my head and looking into WordPress, it accord to me “oh yea, when it’s being accessed over the Internet the file is being parsed, telling lastRSS is simply accessing the file without parsing it”. I wrap the call to use this file with a system call to parse the file and … what the heck? The blog was completely inaccessible. I’m scared now. Look on the server and oh look, there is a cache directory in here somewhere. Let’s rename that and see if it’ll build a new cache. Hey look! My site is back! Presumably, there is something wrong with streaming the output from parsing the file.
At this point, I decided that the site wasn’t broke before I tried to fix things, so now I’m accessing the RSS file off the Internet again. So my Web server is my Web site’s highest visitor. Oh well. The site is working again.
Again, I’m sorry for the down time.