Esempio n. 1
0
<?php

/**
 * \file
 * \brief Response to Verb ListRecords
 *
 * Lists records according to conditions. If there are too many, a resumptionToken is generated.
 * - If a request comes with a resumptionToken and is still valid, read it and send back records.
 * - Otherwise, set up a query with conditions such as: 'metadataPrefix', 'from', 'until', 'set'.
 * Only 'metadataPrefix' is compulsory.  All conditions are accessible through global array variable <B>$args</B>  by keywords.
 */
debug_message("\nI am debuging" . __FILE__);
// Resume previous session?
if (isset($args['resumptionToken'])) {
    $readings = readResumToken($args['resumptionToken']);
    if ($readings == false) {
        $errors[] = oai_error('badResumptionToken', '', $args['resumptionToken']);
    } else {
        debug_var_dump('readings', $readings);
        list($deliveredrecords, $extquery, $metadataPrefix) = $readings;
    }
} else {
    // no, we start a new session
    $deliveredrecords = 0;
    $extquery = '';
    $metadataPrefix = $args['metadataPrefix'];
    if (isset($args['from'])) {
        $from = checkDateFormat($args['from']);
        $extquery .= fromQuery($from);
    }
    if (isset($args['until'])) {
Esempio n. 2
0
/**
 * \file
 * \brief Response to Verb ListRecords
 *
 * Lists records according to conditions. If there are too many, a resumptionToken is generated.
 * - If a request comes with a resumptionToken and is still valid, read it and send back records.
 * - Otherwise, set up a query with conditions such as: 'metadataPrefix', 'from', 'until', 'set'.
 * Only 'metadataPrefix' is compulsory.  All conditions are accessible through global array variable <B>$args</B>  by keywords.
 */
debug_message("\nI am debuging" . __FILE__);
// Resume previous session?
if (isset($args['resumptionToken'])) {
    if (!file_exists(TOKEN_PREFIX . $args['resumptionToken'])) {
        $errors[] = oai_error('badResumptionToken', '', $args['resumptionToken']);
    } else {
        $readings = readResumToken(TOKEN_PREFIX . $args['resumptionToken']);
        if ($readings == false) {
            $errors[] = oai_error('badResumptionToken', '', $args['resumptionToken']);
        } else {
            debug_var_dump('readings', $readings);
            list($deliveredrecords, $extquery, $metadataPrefix) = $readings;
        }
    }
} else {
    // no, we start a new session
    $deliveredrecords = 0;
    $extquery = '';
    $metadataPrefix = $args['metadataPrefix'];
    if (isset($args['from'])) {
        $from = checkDateFormat($args['from']);
        $extquery .= fromQuery($from);