Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Maximilian Görmar
uri.hab.de
Commits
4edd1877
Commit
4edd1877
authored
May 31, 2019
by
David Maus
Browse files
Gracyfully fail on missing records
parent
83ea25f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
public/instance/proxy/opac-de-23/record/index.php
View file @
4edd1877
...
@@ -24,13 +24,22 @@ function terminate (Request $request, Response $response) {
...
@@ -24,13 +24,22 @@ function terminate (Request $request, Response $response) {
}
}
function
load
(
$ident
)
{
function
load
(
$ident
)
{
$content
=
@
file_get_contents
(
sprintf
(
PSI_TEMPLATE
,
$ident
));
$context
=
stream_context_create
([
'http'
=>
[
'timeout'
=>
0.5
]]);
$content
=
@
file_get_contents
(
sprintf
(
PSI_TEMPLATE
,
$ident
),
false
,
$context
);
if
(
$content
)
{
if
(
$content
)
{
$content
=
normalizer_normalize
(
$content
);
$content
=
normalizer_normalize
(
$content
);
$reader
=
new
PicaNormReader
();
}
else
{
$reader
->
open
(
$content
);
$context
=
<<<CONTENT
return
$reader
->
read
();
<record xmlns="info:srw/schema/5/picaXML-v1.0">
<field tag="003@">
<subfield code="0">$ident</subfield>
</field>
</record>
CONTENT;
}
}
$reader
=
new
PicaNormReader
();
$reader
->
open
(
$content
);
return
$reader
->
read
();
}
}
function
transform
(
$sourceUri
,
$templateUri
)
{
function
transform
(
$sourceUri
,
$templateUri
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment