diff options
author | 2009-07-24 11:56:22 -0400 | |
---|---|---|
committer | 2009-07-24 11:56:22 -0400 | |
commit | 518e41513db9c60ec7cf5fc9b4e10e29c037e6ba (patch) | |
tree | 06fee7516b143ca6b61b5cdb876800f67b68c95c | |
parent | Require manually-configured URL - backend needs it anyway (diff) | |
download | ingenue-518e41513db9c60ec7cf5fc9b4e10e29c037e6ba.tar.gz ingenue-518e41513db9c60ec7cf5fc9b4e10e29c037e6ba.tar.bz2 ingenue-518e41513db9c60ec7cf5fc9b4e10e29c037e6ba.zip |
Reorganized log URLs; little update to routing.csv format
-rwxr-xr-x | backend/backend.php | 4 | ||||
-rw-r--r-- | frontend/index.php | 2 | ||||
-rw-r--r-- | frontend/pages/builds/task.php | 8 | ||||
-rw-r--r-- | frontend/pages/configurations/manager.php | 4 | ||||
-rw-r--r-- | frontend/routing.csv | 54 | ||||
-rw-r--r-- | shared/classes/build.php | 14 | ||||
-rw-r--r-- | shared/classes/task.php | 2 |
7 files changed, 44 insertions, 44 deletions
diff --git a/backend/backend.php b/backend/backend.php index 4939dc1..343be9f 100755 --- a/backend/backend.php +++ b/backend/backend.php @@ -83,7 +83,7 @@ while (true) { log_msg('Caught exception: '.$e->getMessage()); $build->status=126; $owner=$build->get_owner(); - xhtmlemail('"'.$owner->name.'" <'.$owner->email.'>', null, $conf['title'].' build failed', 'Your build has failed. You can find more information at <a href="'.url('logs/'.$build->id).'">'.url('logs/'.$build->id).'</a>'); + xhtmlemail('"'.$owner->name.'" <'.$owner->email.'>', null, $conf['title'].' build failed', 'Your build has failed. You can find more information at <a href="'.url("build/$build->id").'">'.url("build/$build->id").'</a>'); } $build->finish=time(); debug('Finished with build id='.$build->id); @@ -120,7 +120,7 @@ while (true) { $ext=substr($base, strpos($base, '.')); rename($file, COMPLETED.'/build-'.$build->id.$ext); } - xhtmlemail('"'.$owner->name.'" <'.$owner->email.'>', null, $conf['title'].' build finished', 'Your build has completed successfully. You can find more information and download the completed image at <a href="'.url('logs/'.$build->id).'">'.url('logs/'.$build->id).'</a>'); + xhtmlemail('"'.$owner->name.'" <'.$owner->email.'>', null, $conf['title'].' build finished', 'Your build has completed successfully. You can find more information and download the completed image at <a href="'.url("build/$build->id").'">'.url("build/$build->id").'</a>'); } $build->write(); unset($build); diff --git a/frontend/index.php b/frontend/index.php index 30ced1c..a103dd9 100644 --- a/frontend/index.php +++ b/frontend/index.php @@ -24,7 +24,7 @@ for ($line=fgets($routing, 32768); !feof($routing); $line=fgets($routing, 32768) $vars=explode("\t", $vars); } unset($line); - if (preg_match('{'.$expr.'}',$S['request'],$matches)) { + if (preg_match('{^'.$expr.'$}',$S['request'],$matches)) { fclose($routing); for ($i=0; $i < count($vars); $i++) { if (strpos($vars[$i],'=')) { diff --git a/frontend/pages/builds/task.php b/frontend/pages/builds/task.php index 8724857..ff3dd3f 100644 --- a/frontend/pages/builds/task.php +++ b/frontend/pages/builds/task.php @@ -13,12 +13,12 @@ function body_builds_task() { global $S, $request, $conf; $task=&$S['builds_task']; echo '<div style="font-size: 130%">'.$task->display().'</div>'; - echo '<a href="'.url("build/$task->build/log").'">Back</a><br/>'; + echo '<a href="'.url("build/$task->build").'">Back</a><br/>'; $page=isset($request['page']) && is_numeric($request['page'])?$request['page']:1; $count=$S['pdo']->query('SELECT COUNT(*) FROM `buildlogs` WHERE `build`=\''.$task->build.'\' AND `task`='.$task->order)->fetch(PDO::FETCH_COLUMN); $pager=''; if ($count > $conf['logview_max']) { - $pager='<form action="'.url("build/$task->build/log/$task->order").'" method="post" onsubmit="window.location.href=\''.url("build/$task->build/log/$task->order").'/\'+this.page.value; return false">Page: '; + $pager='<form action="'.url("build/$task->build/$task->order").'" method="post" onsubmit="window.location.href=\''.url("build/$task->build/$task->order").'/\'+this.page.value; return false">Page: '; if ($page > 1) { $pager.='<input type="button" value="<<" onclick="this.form.page.value='.($page-1).'; this.form.onsubmit()" /> '."\n"; } @@ -44,10 +44,10 @@ function body_builds_task() { echo $ansi->reset(); // Clear any leftover <span>s echo '</div>'; echo $pager; - echo '<a href="'.url("build/$task->build/log").'">Back</a><br/>'; + echo '<a href="'.url("build/$task->build").'">Back</a><br/>'; } else { if ($count) { - echo print_error("There aren't $page pages. Try an <a href=\"".url("build/$task->build/log/$task->order")."\">earlier page</a>."); + echo print_error("There aren't $page pages. Try an <a href=\"".url("build/$task->build/$task->order")."\">earlier page</a>."); } else { echo print_warning('No output'); } diff --git a/frontend/pages/configurations/manager.php b/frontend/pages/configurations/manager.php index 0488a11..dfd8322 100644 --- a/frontend/pages/configurations/manager.php +++ b/frontend/pages/configurations/manager.php @@ -17,7 +17,7 @@ function body_configurations_manager() { $name=isset($request['name'])?$request['name']:null; $build=$c->build($name); if (is_object($build)) - echo print_success('Submitted for build - <a href="'.url('logs/'.$build->id).'">Logs</a>'); + echo print_success('Submitted for build - <a href="'.url("build/$build->id").'">Logs</a>'); else echo print_error('Invalid configuration', 'Your configuration could not be submitted for build. Please return to <a href="'.url("config/$c->id/$build").'">step '.$build.'</a> and continue configuration from there.'); } @@ -54,7 +54,7 @@ function body_configurations_manager() { $builds=$c->get_builds(); if ($builds) { foreach ($builds as $build) { - echo '<a href="'.url('logs/'.$build).'">'.$build.'</a> '; + echo '<a href="'.url("build/$build").'">'.$build.'</a> '; } } else { echo '<i>None</i>'; diff --git a/frontend/routing.csv b/frontend/routing.csv index a0bf3c2..3151d27 100644 --- a/frontend/routing.csv +++ b/frontend/routing.csv @@ -10,40 +10,40 @@ # ^ 404 # Home -^$ welcome + welcome # Builds -^builds$ builds/index -^build/([a-z0-9]{6})/log$ builds/log build -^build/([a-z0-9]{6})/log/([0-9]+)$ builds/task build task -^build/([a-z0-9]{6})/log/([0-9]+)/([0-9]+)$ builds/task build task page -^build/([a-zA-Z0-9]{6})/download$ builds/download build -^build/([a-zA-Z0-9]{6})/history$ builds/history build -^build/([a-zA-Z0-9]{6})/delete$ builds/delete build -#^build/([a-z0-9]{6})/live$ builds/live build +builds builds/index +build/([a-z0-9]{6}) builds/log build +build/([a-z0-9]{6})/([0-9]+) builds/task build task +build/([a-z0-9]{6})/([0-9]+)/([0-9]+) builds/task build task page +build/([a-zA-Z0-9]{6})/download builds/download build +build/([a-zA-Z0-9]{6})/history builds/history build +build/([a-zA-Z0-9]{6})/delete builds/delete build +#build/([a-z0-9]{6})/live builds/live build # Configurations -^create$ configurations/wizard -^config/([a-zA-Z0-9]{6})$ configurations/wizard configuration -^config/([a-zA-Z0-9]{6})/([0-9]+)$ configurations/wizard configuration step -^config/([a-zA-Z0-9]{6})/status$ configurations/status configuration -^configurations$ configurations/manager +create configurations/wizard +config/([a-zA-Z0-9]{6}) configurations/wizard configuration +config/([a-zA-Z0-9]{6})/([0-9]+) configurations/wizard configuration step +config/([a-zA-Z0-9]{6})/status configurations/status configuration +configurations configurations/manager # Session -^login$ login -^login/(.+)$ login go -^logout$ logout -^logout/(.+)$ logout go +login login +login/(.+) login go +logout logout +logout/(.+) logout go # Account stuff -^register$ register -^register/([a-zA-Z0-9]{30})$ register token -^invite$ invite +register register +register/([a-zA-Z0-9]{30}) register token +invite invite # Pass through -^(js)/([0-9a-zA-Z-_]+\.(js))$ passthrough dir file ext -^(images)/([0-9a-zA-Z-_]+\.(gif|jpg|jpeg|ico|png))$ passthrough dir file ext +(js)/([0-9a-zA-Z-_]+\.(js)) passthrough dir file ext +(images)/([0-9a-zA-Z-_]+\.(gif|jpg|jpeg|ico|png)) passthrough dir file ext (?:.*/)?(favicon.(ico))$ passthrough file ext dir=images # Replace xinha with a directory name to turn it into fairly normal handling like without all this crazy redirecting -#^(xinha(?=/)[0-9a-zA-Z-_./]*).(?<=/)([0-9a-zA-Z-_.]+\.([a-zA-Z0-9]+))$ passthrough dir file ext +#(xinha(?=/)[0-9a-zA-Z-_./]*).(?<=/)([0-9a-zA-Z-_.]+\.([a-zA-Z0-9]+)) passthrough dir file ext # CSS -^style.css$ stylesheet +style.css stylesheet # Backend access only -^backend/upload_image$ upload +backend/upload_image upload # This is the catch-all - never remove it -^ 404 +.* 404 diff --git a/shared/classes/build.php b/shared/classes/build.php index 5427633..b086bd4 100644 --- a/shared/classes/build.php +++ b/shared/classes/build.php @@ -60,32 +60,32 @@ class sql_build extends conf_build_common { $html.="<span class=\"status queued\">[Queued ($num/$total)]</span>"; } elseif ($this->status == -127) { $html.='<span class="status successful">[uploading]</span>'; - if ($OoA) $links['Build log']=url("build/$this->id/log"); + if ($OoA) $links['Build log']=url("build/$this->id"); } elseif ($this->status < 0) { // TODO Build stage X $html.='<span class="status building">[building]</span>'; if ($OoA) { //$links['Watch']=url("build/$this->id/live"); - $links['Build Log']=url("build/$this->id/log"); + $links['Build Log']=url("build/$this->id"); } } elseif ($this->status == 0) { $r=$S['pdo']->query('SELECT COUNT(*) as `count`, MAX(`time`) as `time` FROM `downloads` WHERE `build`="'.$this->id.'"')->fetch(PDO::FETCH_ASSOC); $d=($OoA && $r['count']?'<a href="'.url("build/$this->id/history").'">':'').$r['count'].' download'.($r['count'] != 1?'s':'').($r['count']?($OoA?'</a>':'').'<br/><span class="time">(last at '.date($format, $r['time']).')</span>':''); $html.='<span class="downloads">'.$d.'</span><span class="status successful">[successful]</span>'; $links['Download image']=url("build/$this->id/download"); - if ($OoA) $links['Build log']=url("build/$this->id/log"); + if ($OoA) $links['Build log']=url("build/$this->id"); } elseif ($this->status == 127) { $html.='<span class="status failed">[upload failed]</span>'; - if ($OoA) $links['Build log']=url("build/$this->id/log"); + if ($OoA) $links['Build log']=url("build/$this->id"); } elseif ($this->status == 126) { $html.='<span class="status failed">[failed]</span>'; if ($OoA) { - //$links['View output of failed command']=url("logs/$this->id/failure"); - $links['Build log']=url("build/$this->id/log"); + //$links['View output of failed command']=url("build/$this->id/failure"); + $links['Build log']=url("build/$this->id"); } } else { $html.='<span class="status failed">[failed: got signal '.$this->status.']</span>'; - if ($OoA) $links['Build log']=url("build/$this->id/log"); + if ($OoA) $links['Build log']=url("build/$this->id"); } if ($this->status >= 0 || $this->status == -128) // Finished or queued $links['Delete']=url("build/$this->id/delete"); diff --git a/shared/classes/task.php b/shared/classes/task.php index d0bda3d..1112b0a 100644 --- a/shared/classes/task.php +++ b/shared/classes/task.php @@ -45,7 +45,7 @@ class sql_task extends sql_row_obj { ); function display() { - $html='<div class="task"><div class="description">'.htmlentities($this->description).'</div><div class="info">[<a href="'.url("build/$this->build/log/$this->order").'">log</a>] '.($this->command?'<span class="command">'.htmlentities($this->command).'</span> ':''); + $html='<div class="task"><div class="description">'.htmlentities($this->description).'</div><div class="info">[<a href="'.url("build/$this->build/$this->order").'">log</a>] '.($this->command?'<span class="command">'.htmlentities($this->command).'</span> ':''); if (isset($this->start)) { if (isset($this->finish)) { $html.='<span class="status '; |