-
Notifications
You must be signed in to change notification settings - Fork 1
Update for PHP8 #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: vufind10
Are you sure you want to change the base?
Conversation
sebastian-meyer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ein paar Kommentare zur Erläuterung:
| } elseif ($subField == 'description') { | ||
| $descriptions[] = $subFieldSpec; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hier werden zwar $descriptions gesammelt, diese werden aber nie in $solrMarcSpecs[$item][$marcField]['description'] gespeichert (und auch im Template nicht erwartet). Der Code wurde hier deshalb entfernt.
| /** | ||
| * Return an XML representation of the record using the specified format. | ||
| * Return false if the format is unsupported. | ||
| * | ||
| * @param string $format Name of format to use (corresponds with OAI-PMH | ||
| * metadataPrefix parameter). | ||
| * @param string $baseUrl Base URL of host containing VuFind (optional; | ||
| * may be used to inject record URLs into XML when appropriate). | ||
| * @param RecordLink $recordLink Record link helper (optional; may be used to | ||
| * inject record URLs into XML when appropriate). | ||
| * | ||
| * @return mixed XML, or false if format unsupported. | ||
| */ | ||
| public function getXML($format, $baseUrl = null, $recordLink = null) | ||
| { | ||
| // Special case for MARC: | ||
| if ($format == 'marc21') { | ||
| $xml = $this->getMarcReader()->toXML(); | ||
| $xml = str_replace( | ||
| [chr(27), chr(28), chr(29), chr(30), chr(31)], ' ', $xml | ||
| ); | ||
| $xml = simplexml_load_string($xml); | ||
| if (!$xml || !isset($xml->record)) { | ||
| return false; | ||
| } | ||
|
|
||
| // Set up proper namespacing and extract just the <record> tag: | ||
| $xml->record->addAttribute('xmlns', "http://www.loc.gov/MARC21/slim"); | ||
| $xml->record->addAttribute( | ||
| 'xsi:schemaLocation', | ||
| 'http://www.loc.gov/MARC21/slim ' . | ||
| 'http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd', | ||
| 'http://www.w3.org/2001/XMLSchema-instance' | ||
| ); | ||
| $xml->record->addAttribute('type', 'Bibliographic'); | ||
| return $xml->record->asXML(); | ||
| } | ||
|
|
||
| // Try the parent method: | ||
| return parent::getXML($format, $baseUrl, $recordLink); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Diese Funktion ist nicht mehr kompatibel mit der Basis-Funktion in \VuFind\RecordDriver\Feature\MarcAdvancedTrait, enthält aber auch keine notwendigen Anpassungen gegenüber dieser. Sie wurde deshalb entfernt. Die Funktionalität ist durch oben genannten Trait weiterhin gegeben.
VuFind 10 erfordert PHP 8.1+. Seit Version 8 erlaubt PHP keine Zugriffe mehr auf unbelegte Array-Keys und das dynamische Generieren von Objekt-Properties muss von Klassen explizit erlaubt werden. Dies erfordert einige Anpassungen am
RecordDriver, die von diesem Pull-Request bereitgestellt werden.Die Entwicklung fand im Rahmen eines Projekt an der HAAB Weimar statt. Dort läuft VuFind 10 mit diesem Modul produktiv: https://portal.haab.klassik-stiftung.de