Weblog entry #43 for Steve

An explaination of the recent site problems
Posted by Steve on Tue 8 Nov 2005 at 18:56
Tags:
Site Outages

There have been several site outages in the past day or two. Now I'll tell you why ;)

The reason is that I've been refactoring the code that runs the site, a project called Yawns.

Initially the code was structured in several large monolithic files:

index.cgi

The dispatcher, called for all pages. All this did was lookup the parameters and then call the appropriate function in "Pages.pl".

Pages.pl

This file contains one function for each of the "pages" the site supports. For example there is a "view article" function which reads an article from the database and displays it along with any comments, etc.

Data.pl

This is a collection of functions for interfacing with the database. The intention is that every database action is defined here - so that if we need to get the number of times an article has been read for use in Pages.pl we'll have the function defined here.

Sidebar.pl

This file implements two functions, and just returns some "semi-static" content:

  • The login box or user menu for display upon almost all pages.
  • The user's menu - recent articles, topics, weblogs, etc. As defined by their preferences.

This shouldn't really justify a file of its own to be honest.

Admin.pl

A small collection of functions for working with the submissions queue, and content generally. Not really applicable to regular visitors of the site.

As you can see whilst there is some nice seperation between notionally distinct areas of code there is no real organisation. To that end I've been refactoring the code massively.

The intention is that once things are done the code will be much more clean. So far I have a lot of smallish Perl modules:

  • Yawns::Article - contains code for fetching/editting/updating an article.
  • Yawns::Weblogs - Contains code for adding/editting/deleting and dispalying a weblog entry.

So all the code for one area will be in one module. Hopefully making it easier to change things without touching surrounding code.

Anyway I've made some "hasty" commits and updates and that is the source of the recent site breakage. I'm now being much more careful!

If there is any interest in the discussion of code/changes/updates I'll make more regular updates. (Although I've been saying that for months ;)

 

Comments on this Entry

Posted by k2 (69.157.xx.xx) on Wed 9 Nov 2005 at 06:09
[ Send Message | View Weblogs ]
This is more of a bug/enhancement request. When adding a comment a user gets an option of plain text or html. However, if the user tries to preview the comment, the option is lost. And in case the user chooses the HTML option, they loose the text showing the permitted tags during a preview. I have a feeling that the tags display should be easy to fix.

[ Parent | Reply to this comment ]

Posted by Anonymous (213.164.xx.xx) on Wed 9 Nov 2005 at 16:05
Plain text handling has changed too. For example, each sentence in this comment box is one a new line. Under the old behaviour, new lines stayed as new lines in the commnet (they were converted to html line breaks). It doesn't do that any more.

[ Parent | Reply to this comment ]

Posted by Steve (82.41.xx.xx) on Wed 9 Nov 2005 at 17:03
[ Send Message | View Steve's Scratchpad | View Weblogs ]
Yes.
Put two linefeeds for a new line. I'm in the middle of changing this, because a lot of comment handling code is fragile - causing people to not have escaped "<" characters, etc.

[ Parent | Reply to this comment ]

Posted by Steve (82.41.xx.xx) on Thu 10 Nov 2005 at 11:27
[ Send Message | View Steve's Scratchpad | View Weblogs ]

It should all be fixed now.

Steve
--

[ Parent | Reply to this comment ]

Posted by Anonymous (82.41.xx.xx) on Thu 10 Nov 2005 at 11:27
Indeed:
Test

This is a test of <documentroot> and other Apache markup:

<virtualhost *>
DocumentRoot /var/www
</virtualhost>

[ Parent | Reply to this comment ]

Posted by Steve (82.41.xx.xx) on Thu 10 Nov 2005 at 11:27
[ Send Message | View Steve's Scratchpad | View Weblogs ]

That looks OK :)

Steve
--

[ Parent | Reply to this comment ]

Posted by Anonymous (217.11.xx.xx) on Thu 10 Nov 2005 at 09:07
"More Weblogs" has fine spacing between lines. Could "Recent Weblogs" have the same spacing? There could be 5 more links and less space... ;) Thanks.

[ Parent | Reply to this comment ]

Posted by Steve (82.41.xx.xx) on Thu 10 Nov 2005 at 13:27
[ Send Message | View Steve's Scratchpad | View Weblogs ]
http://foo.com/
This is a test of link detection (http://www.steve.org.uk)

Steve

[ Parent | Reply to this comment ]

User Login

Username:

Password:

[ Advanced Login ]

Register Account

Quick Site Search