Skip to content

Instantly share code, notes, and snippets.

@mcantelon
Created July 27, 2017 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcantelon/429307d59b2839fda74bdeeb464fef93 to your computer and use it in GitHub Desktop.
Save mcantelon/429307d59b2839fda74bdeeb464fef93 to your computer and use it in GitHub Desktop.
<?php
// Run this file using AtoM's tools:run task, for example:
//
// $ php symfony tools:run ead_cache_filepaths.php
$slug = readline('Slug to determine EAD filepaths for? ');
// Attempt to get slug
$criteria = new Criteria;
$criteria->add(QubitSlug::SLUG, $slug);
$slugObject = QubitSlug::getOne($criteria);
if ($slugObject === null)
{
print "Slug not found.\n";
}
else
{
// Attempt to get corresponding information object
$io = QubitInformationObject::getById($slugObject->objectId);
if ($io === null)
{
print "Information object corresponding to slug not found.\n";
}
else
{
// Display EAD cache paths
$representation = new QubitInformationObjectXmlCacheResource($io);
print "\nMain XML file: ". $representation->getFilePath('ead') ."\n";
print 'XML file for embedding into OAI-PMH*: '. $representation->getFilePath('ead', true) ."\n\n";
print "*For OAI-PMH version, the first two lines (XML declaration and the doctype) should be removed.\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment