- throw OaiModelException if no metadata prefix is defined (ListRecords)

- composer updates
- new version of manual
This commit is contained in:
Arno Kaimbacher 2020-07-28 09:22:28 +02:00
parent 9d736aa2b7
commit 385ae20a1b
3 changed files with 24 additions and 15 deletions

View File

@ -378,10 +378,10 @@ class RequestController extends Controller
$reldocIds = array(); $reldocIds = array();
$metadataPrefix = null; $metadataPrefix = null;
if (true === array_key_exists('metadataPrefix', $oaiRequest)) { // if (true === array_key_exists('metadataPrefix', $oaiRequest)) {
$metadataPrefix = $oaiRequest['metadataPrefix']; // $metadataPrefix = $oaiRequest['metadataPrefix'];
} // }
$this->proc->setParameter('', 'oai_metadataPrefix', $metadataPrefix); // $this->proc->setParameter('', 'oai_metadataPrefix', $metadataPrefix);
$tokenWorker = new ResumptionTokens(); $tokenWorker = new ResumptionTokens();
$tokenWorker->setResumptionPath($tokenTempPath); $tokenWorker->setResumptionPath($tokenTempPath);
@ -405,6 +405,16 @@ class RequestController extends Controller
// else no resumptionToken is given // else no resumptionToken is given
} else { } else {
// no resumptionToken is given // no resumptionToken is given
if (true === array_key_exists('metadataPrefix', $oaiRequest)) {
$metadataPrefix = $oaiRequest['metadataPrefix'];
} else {
throw new OaiModelException(
'The prefix of the metadata argument is unknown.',
OaiModelError::BADARGUMENT
);
}
$this->proc->setParameter('', 'oai_metadataPrefix', $metadataPrefix);
$finder = Dataset::query(); $finder = Dataset::query();
// add server state restrictions // add server state restrictions
$finder->whereIn('server_state', $this->deliveringDocumentStates); $finder->whereIn('server_state', $this->deliveringDocumentStates);
@ -492,7 +502,6 @@ class RequestController extends Controller
} }
} }
$totalIds = $finder->count(); $totalIds = $finder->count();
$reldocIds = $finder->orderBy('publish_id')->pluck('publish_id')->toArray(); $reldocIds = $finder->orderBy('publish_id')->pluck('publish_id')->toArray();
} }

20
composer.lock generated
View File

@ -746,16 +746,16 @@
}, },
{ {
"name": "laravel/framework", "name": "laravel/framework",
"version": "v6.18.26", "version": "v6.18.31",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/framework.git", "url": "https://github.com/laravel/framework.git",
"reference": "d11b6168c65251ffa81ae0dfaf017ad2f30013da" "reference": "a731824421f9ebc586728ea9c7cff231a249aaa9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/d11b6168c65251ffa81ae0dfaf017ad2f30013da", "url": "https://api.github.com/repos/laravel/framework/zipball/a731824421f9ebc586728ea9c7cff231a249aaa9",
"reference": "d11b6168c65251ffa81ae0dfaf017ad2f30013da", "reference": "a731824421f9ebc586728ea9c7cff231a249aaa9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -890,7 +890,7 @@
"framework", "framework",
"laravel" "laravel"
], ],
"time": "2020-07-21T14:25:39+00:00" "time": "2020-07-27T18:23:18+00:00"
}, },
{ {
"name": "laravel/tinker", "name": "laravel/tinker",
@ -1364,16 +1364,16 @@
}, },
{ {
"name": "nesbot/carbon", "name": "nesbot/carbon",
"version": "2.36.1", "version": "2.37.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/briannesbitt/Carbon.git", "url": "https://github.com/briannesbitt/Carbon.git",
"reference": "ee7378a36cc62952100e718bcc58be4c7210e55f" "reference": "1f61206de973d67f36ce50f041c792ddac663c3e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/ee7378a36cc62952100e718bcc58be4c7210e55f", "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/1f61206de973d67f36ce50f041c792ddac663c3e",
"reference": "ee7378a36cc62952100e718bcc58be4c7210e55f", "reference": "1f61206de973d67f36ce50f041c792ddac663c3e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1449,7 +1449,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2020-07-04T12:29:56+00:00" "time": "2020-07-28T06:04:54+00:00"
}, },
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",

Binary file not shown.