Core class updates

Improved database abstraction class to support insert and select queries
in various forms.
Added classes for pulling log entries back out of the database.
Updated Job class to describe a known job in the database, and added
JobStatus to track status updates on jobs.
Updated Config class to connect to the database, and load all settings
on startup.
Improved the class autoloader to support Exceptions in a single file as
a special case, and added this file.
This commit is contained in:
2010-03-18 02:00:53 +00:00
parent 3603445a5b
commit a9ebf6e0cb
11 changed files with 541 additions and 9 deletions

View File

@@ -13,8 +13,16 @@ class HandBrakeCluster_Main {
private $request;
private function __construct() {
$this->smarty = new Smarty();
$request_string = isset($_GET['l']) ? $_GET['l'] : '';
$this->config = new HandBrakeCluster_Config("dbconfig.conf");
$this->database = new HandBrakeCluster_Database($this->config);
$this->config->setDatabase($this->database);
$this->log = new HandBrakeCluster_Log($this->database, $this->config);
$this->request = new HandBrakeCluster_RequestParser($request_string);
$this->smarty = new Smarty();
$this->smarty->template_dir = './templates';
$this->smarty->compile_dir = './tmp/templates';
$this->smarty->cache_dir = './tmp/cache';
@@ -23,8 +31,6 @@ class HandBrakeCluster_Main {
$this->smarty->assign('version', '0.1');
$this->smarty->assign('base_uri', '/handbrake/');
$request_string = isset($_GET['l']) ? $_GET['l'] : '';
$this->request = new HandBrakeCluster_RequestParser($request_string);
}
public static function instance() {
@@ -70,6 +76,12 @@ class HandBrakeCluster_Main {
return;
}
// Special case: All exceptions are stored in the same file
if (preg_match('/^HandBrakeCluster_Exception_/', $classname)) {
require_once('HandBrakeCluster/Exceptions.class.php');
return;
}
// Replace any underscores with directory separators
$filename = preg_replace('/_/', '/', $classname);