Beispiel #1
0
/**
 * Return an array of objects representing search results.
 *
 * See: http://www.bugzilla.org/docs/4.2/en/html/api/Bugzilla/WebService/Bug.html#search
 *
 * @param array $params search fields => values
 * @return array of stdClass bug objects for given search
 * @return boolean false if search failed altogether (I think)
 */
function search(array $params)
{
    $client = new jsonRPCClient("https://bugzilla.wikimedia.org/jsonrpc.cgi");
    try {
        $result = $client->call('Bug.search', array($params));
    } catch (\Exception $e) {
        Fail::log($e);
        return false;
    }
    $bugs = array();
    for ($i = 0, $c = count($result[1]['bugs']); $i < $c; ++$i) {
        $bugs[] = (object) $result[1]['bugs'][$i];
    }
    return $bugs;
}
function search_gerrit()
{
    $client = new jsonRPCClient("https://gerrit.wikimedia.org/r/gerrit/rpc/ChangeListService");
    try {
        $result = $client->call('allQueryNext', array());
    } catch (\Exception $e) {
        Fail::log($e);
        return false;
    }
    $bugs = array();
    for ($i = 0, $c = count($result[1]['bugs']); $i < $c; ++$i) {
        $bugs[] = (object) $result[1]['bugs'][$i];
    }
    return $bugs;
}