August 30, 2023
by Matt Raines

Looking back to 2006

« 2004 | 2005 | 2006 | 2007 | 2008 »

We moved from renting servers to colocating our own equipment in a data centre on Marsh Wall in the Isle of Dogs. It was close enough to my house that I configured everything at home and cajoled a friend into helping me carry the servers there on foot. Once installed this increased redundancy, performance, and resilience for all of our sites. Thus Asquith and Gladstone began a so far uninterrupted trend for naming servers after Liberal leaders, and by the middle of the year they were hosting well over 250 Lib Dem websites.

Chris Huhne's campaign websiteStreaming video made its first appearance on our sites, courtesy of early YouTube competitor Google Video. During the autumn conference Menzies Campbell, Lynne Featherstone, and Duncan Brack provided daily video updates on any site that signed up to the service.

Prater Raines corporate website in 2006We began providing training on our products at various regional events around the country. Post-COVID this fields weirdly anachronistic to think about, we would certainly have done it all by video conferencing these days. The sessions were never wildly popular but I did get to swan around the country visiting towns I’d never seen and the customers who did show up seemed to find them valuable.

We kept up the non-Lib Dem site launches too, including PTAs, pubs and church websites.

A friend introduced me to the PHP London user group this year, a significant introduction as within a year I would go on to take over organising the monthly pub meets and the annual conference.

Tools of the trade

Location, location, location

The year in tech

Sample code

<?php

/**
 * Creates connections to the database.
 * 
 * @copyright © 2006 Prater Raines <info@prai.co.uk>
 */
class DatabaseConnectionFactory {

    /**
     * @var array
     */
    private static $definitions;

    /**
     * @var PDO
     */
    private static $readOnly;

    /**
     * @var PDO
     */
    private static $writable;
	
    /**
     * Where to find the file containing access information.
     */
    const PATH_TO_CONFIG = '../config/politic-access-definitions';
	
    /**
     * Returns the preferred connection to the database, which is read only.
     * 
     * @return PDO
     */
    public static function readOnly() {
        // For now, both connections are the same.
        return self::writable();
    }
	
    /**
     * Returns the writable connection to the database.
     * 
     * @return PDO
     */
    public static function writable() {
        if (!isset(self::$writable)) {
            $definitions = self::getAccessDefinitions();
            try {
                self::$writable = 
                    new PDO(
                        "mysql:host=$definitions[dbserver];dbname=$definitions[dbname]",
                        $definitions['dbusername'], $definitions['dbpassword']);
            } catch (PDOException $e) {
                user_error('Could not connect to database');
            }
            self::$writable->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
        }
        return self::$writable;
    }

    /**
     * Obtains access information from the configuration file.
     * 
     * @return array
     */
    private static function getAccessDefinitions() {
        if (!isset(self::$definitions)) {
            self::$definitions = parse_ini_file($_SERVER['DOCUMENT_ROOT'] . '/' . self::PATH_TO_CONFIG);
        }
        return self::$definitions;
    }
	
}

?>