chore: override plain record list with set scope
This commit is contained in:
parent
2f7590564c
commit
3ea5371979
22
index.php
22
index.php
|
@ -116,16 +116,28 @@ $oai2 = new Server(
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'ListRecords' => function ($metadataPrefix, $from = null, $until = null, $count = false, $deliveredRecords = 0, $maxItems = 100, $set = null) {
|
'ListRecords' => function ($metadataPrefix, $from = null, $until = null, $count = false, $deliveredRecords = 0, $maxItems = 100, $set = null) {
|
||||||
global $records, $deleted, $timestamps;
|
global $records, $deleted, $timestamps, $setsrecords;
|
||||||
$resultSet = [];
|
$resultSet = [];
|
||||||
foreach ($timestamps[$metadataPrefix] as $timestamp => $identifiers) {
|
|
||||||
|
$currTimestamps = $timestamps;
|
||||||
|
$activeRecords = $records;
|
||||||
|
$deletedRecords = $deleted;
|
||||||
|
|
||||||
|
// override with SET records.
|
||||||
|
if (isset($set)) {
|
||||||
|
$activeRecords = $setsrecords[$set]['records'];
|
||||||
|
$currTimestamps = $setsrecords[$set]['timestamps'];
|
||||||
|
$deletedRecords = $setsrecords[$set]['deleted'];
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($currTimestamps[$metadataPrefix] as $timestamp => $identifiers) {
|
||||||
if ((is_null($from) || $timestamp >= $from) && (is_null($until) || $timestamp <= $until)) {
|
if ((is_null($from) || $timestamp >= $from) && (is_null($until) || $timestamp <= $until)) {
|
||||||
foreach ($identifiers as $identifier) {
|
foreach ($identifiers as $identifier) {
|
||||||
$resultSet[] = [
|
$resultSet[] = [
|
||||||
'identifier' => $identifier,
|
'identifier' => $identifier,
|
||||||
'timestamp' => filemtime($records[$metadataPrefix][$identifier]),
|
'timestamp' => filemtime($activeRecords[$metadataPrefix][$identifier]),
|
||||||
'deleted' => $deleted[$metadataPrefix][$identifier],
|
'deleted' => $deletedRecords[$metadataPrefix][$identifier],
|
||||||
'metadata' => $records[$metadataPrefix][$identifier]
|
'metadata' => $activeRecords[$metadataPrefix][$identifier]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue