Skip to content
Commits on Source (2)
  • Paul Wise's avatar
    Improve excuses page · b87670b3
    Paul Wise authored
    Only accept package names that are valid according to Debian Policy.
    
    Improve title for the search page to mention experimental too.
    
    Make title include the package name so package is more visible.
    
    Make title mention if there are no excuses for the package.
    
    Add link to the testing/experimental page from the opposite page.
    
    Use same text on the forms as in the new links, expanded for clarity.
    
    Refactor internals of suite selection.
    
    Comment code that is immutable due to external assumptions.
    b87670b3
  • Paul Wise's avatar
    Fix excuses page syntax and title · 3244f653
    Paul Wise authored
    Fixes: commit b87670b3
    3244f653
......@@ -24,20 +24,31 @@
// global variables
$prefix="/srv/qa.debian.org/data/ddpo/results";
$filter_re = '/^[^<>&"]+$/'; // filter against special HTML characters
$filter_re = '/^[a-z0-9][-+.a-z0-9]+$/'; // only accept valid package names
$default_title = 'Search testing migration excuses or experimental manual migration pseudo-excuses';
$suites = array(
array (
'name' => 'testing',
'title' => 'Testing Excuses for ',
'link' => 'excuses.php?package=',
'text' => 'Testing migration excuses for ',
),
array (
'name' => 'experimental',
'title' => 'Experimental Pseudo-Excuses for ',
'link' => 'excuses.php?experimental=1&package=',
'text' => 'Experimental manual migration pseudo-excuses for ',
),
);
function start_output ()
function start_output ($title)
{
header('Content-Type: text/html; charset="utf-8"');
header('Content-Style-Type: text/css');
header('Pragma: no-cache');
if ($_REQUEST['experimental'] != 1) {
$title = 'Testing Excuses';
} else {
$title = 'Experimental Pseudo-Excuses';
}
?>
#use wml::templ::template title="<?php print $title ?>" author="Igor Genibel, Christoph Berg, and others"
......@@ -51,43 +62,58 @@ function start_output ()
include("common-html.php");
function print_excuse($suite, $package)
function print_excuse($data_suite, $link_suite, $package)
{
global $prefix;
$excuses_db = dba_open("$prefix/excuses-$suite.db", 'r', 'db4');
$txt = dba_fetch($package, $excuses_db);
$timestamp = dba_fetch("_timestamp", $excuses_db);
$data_excuses_db = dba_open("$prefix/excuses-{$data_suite['name']}.db", 'r', 'db4');
$txt = dba_fetch($package, $data_excuses_db);
$timestamp = dba_fetch("_timestamp", $data_excuses_db);
dba_close($data_excuses_db);
$link_excuses_db = dba_open("$prefix/excuses-{$link_suite['name']}.db", 'r', 'db4');
$link = dba_exists($package, $link_excuses_db);
dba_close($link_excuses_db);
if ($txt) {
start_output();
start_output($data_suite['title'].$package);
print $txt;
print html_p("Excuses generated $timestamp");
} else {
header('Status: 404 Not Found', FALSE, 404);
start_output();
start_output('No '.$data_suite['title'].$package);
// "No excuse for" must not be changed as grep-excuses relies on it
print html_h("No excuse for $package", 2);
}
$url_pkg = urlencode($package);
if ($link) {
$link = " ".html_a("{$link_suite['text']}$package", "{$link_suite['link']}$url_pkg", "");
} else {
$link = "";
}
print html_p(
// "Maintainer page" must not be changed as grep-excuses relies on it
html_a("Maintainer page", "developer.php?package=$url_pkg", "")." ".
html_a("Package tracker", "https://tracker.debian.org/pkg/$url_pkg", "")
html_a("Package tracker", "https://tracker.debian.org/pkg/$url_pkg", "").
$link
);
}
if ($_REQUEST['experimental'] != 1) {
$suite = 'testing';
} else {
$suite = 'experimental';
}
$data_suite_num = (int)($_REQUEST['experimental'] == 1);
$link_suite_num = (int)!$data_suite_num;
$data_suite = $suites[$data_suite_num];
$link_suite = $suites[$link_suite_num];
if ($package = $_REQUEST['package'] and preg_match($filter_re, $package)) {
print_excuse($suite, $package);
print_excuse($data_suite, $link_suite, $package);
} else {
unset($package);
start_output();
start_output($default_title);
$form_data = html_input_text("package");
print html_form("excuses.php", "GET", "Testing excuse for ", $form_data, "Go");
print html_form("excuses.php", "GET", $suites[0]['text'], $form_data, "Go");
}
......@@ -105,7 +131,7 @@ print html_p(
if ( !isset($package) ) {
$form_data .= html_input_hidden("experimental", "1");
print html_form("excuses.php", "GET", "Experimental pseudo-excuse for ", $form_data, "Go");
print html_form("excuses.php", "GET", $suites[1]['text'], $form_data, "Go");
}
print html_p(
......