8 Commits

Author SHA1 Message Date
e84c1eba42 Set logging program name 2011-08-06 14:57:14 +01:00
b93efc9878 Replace if block with switch case for extensibility 2011-08-06 14:55:29 +01:00
9697654594 Propagate changes to logging system from framework library 2011-08-06 14:54:22 +01:00
5121f78cea Merge branch 'master' of git+ssh://git.sihnon.net/home/git/public/handbrake-cluster-webui 2011-08-05 19:40:42 +01:00
dbc1252bef Added config file override for worker script 2011-08-05 19:35:55 +01:00
a3e58e4ee4 Merge branch 'master' of git+ssh://git.sihnon.net/home/git/public/handbrake-cluster-webui 2011-06-28 20:11:50 +01:00
3b22b0f2c9 Bug fix: Undefined index $values[9]
RippingCluster_LogEntry overwrote base class field list, causing
undefined index notices when the base class was explicitly used.
2011-06-28 20:06:24 +01:00
efb7db35d8 Fixed typo in _inc.php 2011-06-20 22:33:18 +01:00
5 changed files with 53 additions and 28 deletions

View File

@@ -4,12 +4,20 @@ class RippingCluster_LogEntry extends SihnonFramework_LogEntry {
protected $job_id;
protected static $types;
public static function initialise() {
self::$types['job_id'] = 'int';
// Copy the list of datatypes from the parent
// We can't modify it in place, else we'll break any logging done inside the SihnonFramework tree
// or other subclass trees.
static::$types = parent::$types;
// Add the new data types for this subclass
static::$types['job_id'] = 'int';
}
protected function __construct($level, $category, $ctime, $pid, $file, $line, $message, $job_id) {
parent::__construct($level, $category, $ctime, $pid, $file, $line, $message);
protected function __construct($level, $category, $ctime, $hostname, $progname, $pid, $file, $line, $message, $job_id) {
parent::__construct($level, $category, $ctime, $hostname, $progname, $pid, $file, $line, $message);
$this->job_id = $job_id;
}
@@ -19,6 +27,8 @@ class RippingCluster_LogEntry extends SihnonFramework_LogEntry {
$row['level'],
$row['category'],
$row['ctime'],
$row['hostname'],
$row['progname'],
$row['pid'],
$row['file'],
$row['line'],
@@ -32,8 +42,8 @@ class RippingCluster_LogEntry extends SihnonFramework_LogEntry {
$this->level,
$this->category,
$this->ctime,
static::$hostname,
static::$progname,
$this->hostname,
$this->progname,
$this->pid,
$this->file,
$this->line,
@@ -48,7 +58,7 @@ class RippingCluster_LogEntry extends SihnonFramework_LogEntry {
protected static function log($logger, $severity, $job_id, $message, $category = SihnonFramework_Log::CATEGORY_DEFAULT) {
$backtrace = debug_backtrace(false);
$entry = new self($severity, $category, time(), getmypid(), $backtrace[1]['file'], $backtrace[1]['line'], $message, $job_id);
$entry = new self($severity, $category, time(), static::$localHostname, static::$localProgname, getmypid(), $backtrace[1]['file'], $backtrace[1]['line'], $message, $job_id);
$logger->log($entry);
}

View File

@@ -16,7 +16,8 @@ class RippingCluster_Main extends SihnonFramework_Main {
$this->request = new RippingCluster_RequestParser($request_string);
if (HBC_File == 'index') {
switch (HBC_File) {
case 'index': {
$this->smarty = new Smarty();
$this->smarty->template_dir = './source/templates';
$this->smarty->compile_dir = './tmp/templates';
@@ -29,6 +30,8 @@ class RippingCluster_Main extends SihnonFramework_Main {
$this->smarty->assign('messages', array());
$this->smarty->assign('base_uri', $this->base_uri);
} break;
}
}

View File

@@ -3,7 +3,7 @@
require_once '/etc/ripping-cluster/config.php';
require_once SihnonFramework_Lib . 'SihnonFramework/Main.class.php';
SihnonFramework::registerAutoloadClasses('SihnonFramework', SihnonFramework_Lib,
SihnonFramework_Main::registerAutoloadClasses('SihnonFramework', SihnonFramework_Lib,
'RippingCluster', RippingCluster_Lib);
?>

View File

@@ -6,6 +6,7 @@ require '_inc.php';
try {
$main = RippingCluster_Main::instance();
RippingCluster_LogEntry::setLocalProgname('webui');
$smarty = $main->smarty();
$page = new RippingCluster_Page($smarty, $main->request());

View File

@@ -2,7 +2,17 @@
define('HBC_File', 'worker');
$options = array();
if (isset($_SERVER['argv'])) {
$options = getopt('c:', array('config:'));
}
if (isset($options['config'])) {
require_once $options['config'];
} else {
require_once '/etc/ripping-cluster/config.php';
}
require_once(SihnonFramework_Lib . 'SihnonFramework/Main.class.php');
require_once 'Net/Gearman/Worker.php';
@@ -16,6 +26,7 @@ try {
set_time_limit(0);
$main = RippingCluster_Main::instance();
RippingCluster_LogEntry::setLocalProgname('ripping-cluster-worker');
$smarty = $main->smarty();
$worker = new RippingCluster_Worker();