Skip to content

Commit 2bc5a91

Browse files
authored
Minor improvements to UpgradeController. (vufind-org#3801)
1 parent 6fc6df2 commit 2bc5a91

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

module/VuFind/src/VuFind/Controller/UpgradeController.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,8 @@ public function fixmetadataAction()
784784
set_time_limit(0);
785785

786786
// Check for problems:
787-
$problems = $this->getDbService(ResourceServiceInterface::class)->findMissingMetadata();
787+
$resourceService = $this->getDbService(ResourceServiceInterface::class);
788+
$problems = $resourceService->findMissingMetadata();
788789

789790
// No problems? We're done here!
790791
if (count($problems) == 0) {
@@ -794,18 +795,22 @@ public function fixmetadataAction()
794795

795796
// Process submit button:
796797
if ($this->formWasSubmitted()) {
797-
$resourceService = $this->getDbService(ResourceServiceInterface::class);
798798
$resourcePopulator = $this->serviceLocator->get(ResourcePopulator::class);
799799
foreach ($problems as $problem) {
800+
$recordId = $problem->getRecordId();
801+
$source = $problem->getSource();
800802
try {
801-
$driver = $this->getRecordLoader()->load($problem->getRecordId(), $problem->getSource());
803+
$driver = $this->getRecordLoader()->load($recordId, $source);
802804
$resourceService->persistEntity(
803805
$resourcePopulator->assignMetadata($problem, $driver)
804806
);
805807
} catch (RecordMissingException $e) {
806808
$this->session->warnings->append(
807-
'Unable to load metadata for record '
808-
. "{$problem->getSource()}:{$problem->getRecordId()}"
809+
"Unable to load metadata for record {$source}:{$recordId}"
810+
);
811+
} catch (\Exception $e) {
812+
$this->session->warnings->append(
813+
"Problem saving metadata updates for record {$source}:{$recordId}"
809814
);
810815
}
811816
}

0 commit comments

Comments
 (0)