From 91e3bccf35c01c05f2062266ca1433ae46313bb5 Mon Sep 17 00:00:00 2001 From: Eudyptula Date: Mon, 22 Jun 2009 10:52:52 -0400 Subject: Little fixes to error handling and other minor things --- frontend/functions/throw_exception.php | 5 +++++ frontend/index.php | 2 +- frontend/js/debug.js.php | 2 +- frontend/pages/logview.php | 5 ++--- pkglist.php | 2 +- shared/classes/build.php | 4 ++-- shared/classes/task.php | 2 +- 7 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 frontend/functions/throw_exception.php 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 @@ + 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(' 100; - div.innerHTML=''+(big?'[Hide] ':'')+(subtype!=null?subtype+':':'')+(big?'':'')+' '+text+''; + div.innerHTML=''+(big?'[Hide] ':'')+(subtype!=null?subtype+':':'')+' '+text+''; 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 '
'; while ($entry=$s->fetch(PDO::FETCH_ASSOC)) { $entry=new sql_buildlog_entry($entry); - $text=str_replace(array("\n", "\t"), array("
\n", str_repeat(' ', 4)), htmlentities($entry->text)); + $text=str_replace(array("\n", "\t"), array("
\n", str_repeat(' ', 4)), htmlentities($entry->text)); echo 'stream=='stderr'?' style="color: red" ':'').' title="'.strtoupper($entry->stream).', entry #'.$entry->order.' @ '.date('D j M Y @ H:i:s', $entry->timestamp).' UTC">'.$text.''; } echo ' '; @@ -51,13 +51,12 @@ function body_logview() { echo 'Task #'.++$i.': '.htmlentities($task->command).'
'; } } 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('
'.print_r($build, true).'
'); echo 'Build '.$build->id.': '; 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 -- cgit v1.2.3-65-gdbad