Rename metadataFormats to metadataPrefix

This commit is contained in:
Sebastian Meyer 2020-01-08 16:03:16 +01:00
parent e3d83ad9bc
commit 67acc1e2cb
3 changed files with 5 additions and 5 deletions

View File

@ -29,7 +29,7 @@ $deleted = array();
$timestamps = array(); $timestamps = array();
$earliest = time(); $earliest = time();
foreach($config['metadataFormats'] as $prefix => $uris) { foreach($config['metadataPrefix'] as $prefix => $uris) {
$files = glob(rtrim($config['dataDirectory'], '/').'/'.$prefix.'/*.xml'); $files = glob(rtrim($config['dataDirectory'], '/').'/'.$prefix.'/*.xml');
foreach($files as $file) { foreach($files as $file) {
$records[$prefix][pathinfo($file, PATHINFO_FILENAME)] = $file; $records[$prefix][pathinfo($file, PATHINFO_FILENAME)] = $file;
@ -112,7 +112,7 @@ $oai2 = new OAI2Server(
$formats = array(); $formats = array();
foreach($records as $format => $record) { foreach($records as $format => $record) {
if (!empty($record[$identifier])) { if (!empty($record[$identifier])) {
$formats[$format] = $config['metadataFormats'][$format]; $formats[$format] = $config['metadataPrefix'][$format];
} }
} }
if (!empty($formats)) { if (!empty($formats)) {
@ -121,7 +121,7 @@ $oai2 = new OAI2Server(
throw new OAI2Exception('idDoesNotExist'); throw new OAI2Exception('idDoesNotExist');
} }
} else { } else {
return $config['metadataFormats']; return $config['metadataPrefix'];
} }
} }
), ),

View File

@ -49,7 +49,7 @@ $config['deletedRecord'] = 'transient';
// but technically you can deliver any XML based data format you want. Just add // but technically you can deliver any XML based data format you want. Just add
// another entry with the 'metadataPrefix' as key and schema/namespace URIs as // another entry with the 'metadataPrefix' as key and schema/namespace URIs as
// array values or replace the default 'oai_dc' entry (not recommended). // array values or replace the default 'oai_dc' entry (not recommended).
$config['metadataFormats'] = array( $config['metadataPrefix'] = array(
'oai_dc' => array( 'oai_dc' => array(
'schema' => 'http://www.openarchives.org/OAI/2.0/oai_dc.xsd', 'schema' => 'http://www.openarchives.org/OAI/2.0/oai_dc.xsd',
'namespace' => 'http://www.openarchives.org/OAI/2.0/oai_dc/', 'namespace' => 'http://www.openarchives.org/OAI/2.0/oai_dc/',

View File

@ -56,7 +56,7 @@ if (empty($argc) || $argc != 3) {
} }
list(, $sourceDir, $metadataPrefix) = $argv; list(, $sourceDir, $metadataPrefix) = $argv;
// Check metadataPrefix // Check metadataPrefix
if (empty($config['metadataFormats'][$metadataPrefix])) { if (empty($config['metadataPrefix'][$metadataPrefix])) {
echo "Error: metadataPrefix $metadataPrefix not defined in oai2config.php\n"; echo "Error: metadataPrefix $metadataPrefix not defined in oai2config.php\n";
exit; exit;
} }