function get_edition_package($edition_id)
{
    $edition = get_post($edition_id);
    $edition_key = pugpig_get_full_edition_key($edition);
    //print_r("*** $edition_key ***");
    $package_search_expression = PUGPIG_MANIFESTPATH . 'packages/' . $edition_key . '-package-*.xml';
    return _package_get_most_recent_file($package_search_expression);
}
Пример #2
0
function _package_edition_package_contents($base, $edition_tag, $timestamp = '*')
{
    $contents = array();
    // Get the XML file
    $xml_package = _package_get_most_recent_file($base . $edition_tag . '-package-' . $timestamp . '.xml');
    if ($xml_package != null) {
        $contents['xml_timestamp'] = filemtime($xml_package);
        if ($timestamp == '*') {
            $timestamp = str_replace($base . $edition_tag . '-package-', '', $xml_package);
            $timestamp = str_replace('.xml', '', $timestamp);
        }
    }
    // Get the file names of the HTML and Asset zip files
    $html_archive = $base . $edition_tag . '-html-' . $timestamp . '.zip';
    $assets_archive = $base . $edition_tag . '-assets-' . $timestamp . '.zip';
    // Check our files exist
    if (!file_exists($html_archive)) {
        $html_archive = '';
    }
    if (!file_exists($assets_archive)) {
        $assets_archive = '';
    }
    $prefix_len = strlen($base);
    // Spit out data about the files
    $contents['html_archive'] = $html_archive;
    $contents['html_timestamp'] = file_exists($contents['html_archive']) ? filemtime($contents['html_archive']) : NULL;
    $contents['html_size'] = file_exists($contents['html_archive']) ? filesize($contents['html_archive']) : 0;
    $contents['html_url'] = substr($contents['html_archive'], $prefix_len);
    $contents['assets_archive'] = $assets_archive;
    $contents['assets_timestamp'] = file_exists($contents['assets_archive']) ? filemtime($contents['assets_archive']) : NULL;
    $contents['assets_size'] = file_exists($contents['assets_archive']) ? filesize($contents['assets_archive']) : 0;
    $contents['assets_url'] = substr($contents['assets_archive'], $prefix_len);
    return $contents;
}
function _package_edition_get_package_xml_filename($base, $edition_tag, $timestamp)
{
    $filename = "{$base}{$edition_tag}-package-{$timestamp}.xml";
    return _package_get_most_recent_file($filename);
}