function expires_from_manifest($manifest_node, $xml)
{
    $expires = "";
    $client_id = $manifest_node['client_id'];
    $component_id = $manifest_node['component_id'];
    $component_manager_id = $manifest_node['component_manager_id'];
    $doc = new DOMDocument('1.0', 'utf-8');
    $doc->loadXML($xml);
    $nodes = $doc->getElementsByTagName('node');
    for ($i = 0; $i < $nodes->length; $i++) {
        $node = $nodes->item($i);
        if ($node->getAttribute('client_id') == $client_id && $node->getAttribute('component_id') == $component_id && $node->getAttribute('component_manager_id') == $component_manager_id) {
            $sliver_infos = $node->getElementsByTagName('geni_sliver_info');
            if ($sliver_infos->length > 0) {
                $sliver_info = $sliver_infos->item(0);
                //	if (!$sliver_info->hasAttributes()) {
                //	  error_log("NO ATTRIBS");
                //	} else {
                //  foreach($sliver_info->attributes as $attr) {
                //	    $name = $attr->nodeName;
                //	    $value = $attr->nodeValue;
                //	    error_log("NAME " . $name . " VAL " . $value);
                //	  }
                //	}
                $expires_orig = $sliver_info->getAttribute('expiration_time');
                $expires = rfc3339Format($expires_orig);
                break;
            }
        }
    }
    //  error_log("about to return: " . $expires);
    return $expires;
}
Example #2
0
        $desired_expiration = $slice[SA_ARGUMENT::EXPIRATION];
    } else {
        // If you didn't specify a time, use min of end of day, slice expiration
        $desired_array = date_parse($desired_expiration);
        if ($desired_array["hour"] == 0 and $desired_array["minute"] == 0 and $desired_array["second"] == 0 and $desired_array["fraction"] == 0) {
            $sliceexp_array = date_parse($slice[SA_ARGUMENT::EXPIRATION]);
            if ($desired_array["year"] == $sliceexp_array["year"] and $desired_array["month"] == $sliceexp_array["month"] and $desired_array["day"] == $sliceexp_array["day"]) {
                $desired_expiration = $slice[SA_ARGUMENT::EXPIRATION];
            } else {
                // renew for the end of the day
                $desired_expiration = $desired_expiration . " 23:59:59";
            }
        }
    }
    // what to send to the AM(s)
    $rfc3339_expiration = rfc3339Format($desired_expiration);
    // what to display to the user
    $ui_expiration = dateUIFormat($desired_expiration);
} else {
    no_time_error();
}
// Takes an arg am_id which may have multiple values. Each is treated
// as the ID from the DB of an AM which should be queried
// If no such arg is given, then query the DB and query all registered AMs
if (!isset($ams) || is_null($ams)) {
    // Didnt get an array of AMs
    if (!isset($am) || is_null($am)) {
        // Nor a single am
        $ams = get_services_of_type(SR_SERVICE_TYPE::AGGREGATE_MANAGER);
    } else {
        $ams = array();