summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEudyptula <eitan@mosenkis.net>2009-06-22 10:52:52 -0400
committerEudyptula <eitan@mosenkis.net>2009-06-22 10:52:52 -0400
commit91e3bccf35c01c05f2062266ca1433ae46313bb5 (patch)
tree26bbe304f52c7255e0c8f43d20bb57cffe966c64
parentAdded ACCEPT_KEYWORDS from Packages headers to make.conf (diff)
downloadingenue-91e3bccf35c01c05f2062266ca1433ae46313bb5.tar.gz
ingenue-91e3bccf35c01c05f2062266ca1433ae46313bb5.tar.bz2
ingenue-91e3bccf35c01c05f2062266ca1433ae46313bb5.zip
Little fixes to error handling and other minor things
-rw-r--r--frontend/functions/throw_exception.php5
-rw-r--r--frontend/index.php2
-rw-r--r--frontend/js/debug.js.php2
-rw-r--r--frontend/pages/logview.php5
-rwxr-xr-xpkglist.php2
-rw-r--r--shared/classes/build.php4
-rw-r--r--shared/classes/task.php2
7 files changed, 13 insertions, 9 deletions
diff --git a/frontend/functions/throw_exception.php b/frontend/functions/throw_exception.php
new file mode 100644
index 0000000..6a9c288
--- /dev/null
+++ b/frontend/functions/throw_exception.php
@@ -0,0 +1,5 @@
+<?php
+function throw_exception($msg='') {
+ throw new Exception($msg);
+}
+?>
diff --git a/frontend/index.php b/frontend/index.php
index d17324a..30ced1c 100644
--- a/frontend/index.php
+++ b/frontend/index.php
@@ -40,7 +40,7 @@ for ($line=fgets($routing, 32768); !feof($routing); $line=fgets($routing, 32768)
while ($dest != null) {
debug('routing','Routing to '.$dest);
if (!is_file('pages/'.$dest.'.php')) {
- throw new Exception('Routing to '.$dest.' but pages/'.$dest.'.php doesn\'t exist.');
+ throw_exception('Routing to '.$dest.' but pages/'.$dest.'.php doesn\'t exist.');
}
require_once('pages/'.$dest.'.php');
$dest=str_replace(array('/', '-'), '_', $dest);
diff --git a/frontend/js/debug.js.php b/frontend/js/debug.js.php
index 9043235..5e33ce8 100644
--- a/frontend/js/debug.js.php
+++ b/frontend/js/debug.js.php
@@ -21,7 +21,7 @@ function debug (subtype, text) {
div.className='debug '+(++debugrow%2?'odd':'even');
div.id='debug'+debugrow;
big=text.match('<br') || text.length > 100;
- div.innerHTML='<span class="type'+(big?' pointer" onclick="toggledebug('+debugrow+')':'')+'">'+(big?'<img id="debugmanager'+debugrow+'" src="'+url('images/minusbox.gif')+'" alt="[Hide]" /> ':'')+(subtype!=null?subtype+':':'')+(big?'</span>':'')+'<span> '+text+'</span>';
+ div.innerHTML='<span class="type'+(big?' pointer" onclick="toggledebug('+debugrow+')':'')+'">'+(big?'<img id="debugmanager'+debugrow+'" src="'+url('images/minusbox.gif')+'" alt="[Hide]" /> ':'')+(subtype!=null?subtype+':':'')+'</span><span> '+text+'</span>';
document.getElementById("debugbox").appendChild(div);
document.getElementById("debugcount").childNodes[0].nodeValue=debugrow;
}
diff --git a/frontend/pages/logview.php b/frontend/pages/logview.php
index bb4900b..798bb85 100644
--- a/frontend/pages/logview.php
+++ b/frontend/pages/logview.php
@@ -30,7 +30,7 @@ function body_logview() {
echo '<div style="font-family: monospace">';
while ($entry=$s->fetch(PDO::FETCH_ASSOC)) {
$entry=new sql_buildlog_entry($entry);
- $text=str_replace(array("\n", "\t"), array("<hr/>\n", str_repeat('&nbsp;', 4)), htmlentities($entry->text));
+ $text=str_replace(array("\n", "\t"), array("<br/>\n", str_repeat('&nbsp;', 4)), htmlentities($entry->text));
echo '<a name="entry_'.$task->id.'_'.$entry->order.'"'.($entry->stream=='stderr'?' style="color: red" ':'').' title="'.strtoupper($entry->stream).', entry #'.$entry->order.' @ '.date('D j M Y @ H:i:s', $entry->timestamp).' UTC">'.$text.'</a>';
}
echo '<a name="end">&nbsp;</a>';
@@ -51,13 +51,12 @@ function body_logview() {
echo '<a href="'.url('logs/task'.$task->id).'#end">Task #'.++$i.'</a>: '.htmlentities($task->command).'<br/>';
}
} else {
- $r=$S['pdo']->query('SELECT * FROM `builds` ORDER BY `id` ASC');
+ $r=$S['pdo']->query('SELECT * FROM `builds` ORDER BY `ctime` ASC');
if ($r->rowCount() == 0) {
echo print_warning('No builds found.');
}
while ($build=$r->fetch(PDO::FETCH_ASSOC)) {
$build=new sql_build($build);
- debug('<pre>'.print_r($build, true).'</pre>');
echo '<a href="'.url('logs/build'.$build->id).'">Build '.$build->id.'</a>: ';
if (isset($build->name)) {
echo htmlentities($build->name);
diff --git a/pkglist.php b/pkglist.php
index 1be1dbb..747a436 100755
--- a/pkglist.php
+++ b/pkglist.php
@@ -4,7 +4,7 @@ require_once(dirname(__FILE__).'/shared/include/includes.php'); // USE __DIR__ i
require_once(SHARED.'/config.php');
require_once(SHARED.'/include/dbinit.php');
$pdo=&$S['pdo'];
-$r=$pdo->query('SELECT * FROM `profiles`');
+$r=$pdo->query('SELECT * FROM `profiles`'.(isset($argv[1])?' WHERE `name` LIKE "%'.$argv[1].'%" OR `pkgdir` LIKE "%'.$argv[1].'%"':''));
while ($p=$r->fetch(PDO::FETCH_ASSOC)) {
$p=new sql_profile($p);
echo ($p->name?$p->name:$p->pkgdir)."\n";
diff --git a/shared/classes/build.php b/shared/classes/build.php
index 6034cf5..8907693 100644
--- a/shared/classes/build.php
+++ b/shared/classes/build.php
@@ -42,7 +42,7 @@ class sql_build extends sql_row_obj {
public function init() {
global $S;
$this->owner=$S['user']->id;
- $this->status='config/step0';
+ $this->status='config/step1';
$fails=0;
while (true) {
$id=randstring(6);
@@ -52,7 +52,7 @@ class sql_build extends sql_row_obj {
break;
}
if (++$fails == 10) {
- throw new Exception('Failed 10 times to find a unique build id... this shouldn\'t happen.');
+ throw_exception('Failed 10 times to find a unique build id... this shouldn\'t happen.');
}
}
$this->id=$id;
diff --git a/shared/classes/task.php b/shared/classes/task.php
index cdea343..19afff7 100644
--- a/shared/classes/task.php
+++ b/shared/classes/task.php
@@ -26,7 +26,7 @@ class sql_task extends sql_row_obj {
'unsigned' => true,
'not_null' => true
),
- 'end' => array (
+ 'finish' => array (
'type' => 'INT',
'length' => 10,
'unsigned' => true