Пример #1
0
    }
}
function status_print($op, $mem, $expected)
{
    $code = $mem->getResultcode();
    if ($code == $expected) {
        echo "{$op} status code as expected" . PHP_EOL;
    } else {
        $expected = resolve_to_constant($expected);
        $code = resolve_to_constant($code);
        echo "{$op} status code mismatch, expected {$expected} but got {$code}";
        echo PHP_EOL;
    }
}
$mem = new Memcached();
$mem->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
$mem->addServer('localhost', '11211');
$key = uniqid('touch_t_');
$mem->get($key);
status_print('get', $mem, Memcached::RES_NOTFOUND);
$mem->set($key, 1);
status_print('set', $mem, Memcached::RES_SUCCESS);
$mem->get($key);
status_print('get', $mem, Memcached::RES_SUCCESS);
$mem->touch($key, 10);
status_print('touch', $mem, Memcached::RES_SUCCESS);
$mem->get($key);
status_print('get', $mem, Memcached::RES_SUCCESS);
$mem->get($key);
status_print('get', $mem, Memcached::RES_SUCCESS);
echo "OK\n";
Пример #2
0
}
// Input
if (!isset($_GET['phpver'])) {
    echo "<h3>Bug stats for both <a href='lstats.php?phpver=5'>PHP 5</a> and <a href='lstats.php?phpver=6'>PHP 6</a>:</h3>\n<pre>\n";
} else {
    $phpver = (int) $_GET['phpver'];
    echo "<h3>Bug stats for PHP {$phpver}:</h3>\n<pre>\n";
}
if (isset($_GET['per_category'])) {
    $project = !empty($_GET['project']) ? $_GET['project'] : false;
    $pseudo_pkgs = get_pseudo_packages($project);
    $totals = array();
    foreach ($pseudo_pkgs as $category => $data) {
        $count = get_status_count("status NOT IN('to be documented', 'closed', 'not a bug', 'duplicate', 'wont fix', 'no feedback')", $category);
        if ($count > 0) {
            $totals[$category] = $count;
        }
    }
    arsort($totals);
    foreach ($totals as $category => $total) {
        status_print($category, $total, 40);
    }
} else {
    foreach ($tla as $status => $short) {
        if (!in_array($status, array('Duplicate'))) {
            $count = get_status_count($status);
            status_print($status, $count, 30);
        }
    }
}
echo "\n</pre>\n";