From 577db2465f917b0d5a1d820fd06751ec7e3ab9f2 Mon Sep 17 00:00:00 2001 From: Sergei Mikhailov Date: Tue, 1 Oct 2024 15:58:53 +0200 Subject: [PATCH] fix: this PR fixes the import of test packages (.zip files) that have no metadata --- models/classes/class.QtiTestService.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/models/classes/class.QtiTestService.php b/models/classes/class.QtiTestService.php index e24ad3d4d..9e9e36cd9 100644 --- a/models/classes/class.QtiTestService.php +++ b/models/classes/class.QtiTestService.php @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright (c) 2013-2023 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); + * Copyright (c) 2013-2024 (original work) Open Assessment Technologies SA; */ use League\Flysystem\FileExistsException; @@ -497,7 +497,7 @@ public function clearRelatedResources(common_report_Report $report): void // 2. Restore overwritten item contents. foreach ($data->overwrittenItems as $overwrittenItemId => $backupName) { - common_Logger::d("Restoring content for item '${overwrittenItemId}'..."); + common_Logger::d("Restoring content for item '{$overwrittenItemId}'..."); @Service::singleton()->restoreContentByRdfItem( new core_kernel_classes_Resource($overwrittenItemId), $backupName @@ -776,7 +776,7 @@ protected function importTest( // If items did not produce errors, we import the test definition. if ($itemError === false) { - common_Logger::i("Importing test with manifest identifier '${qtiTestResourceIdentifier}'..."); + common_Logger::i("Importing test with manifest identifier '{$qtiTestResourceIdentifier}'..."); // Second step is to take care of the test definition and the related media (auxiliary files). @@ -805,7 +805,7 @@ protected function importTest( if ($this->getServiceManager()->getContainer()->has(MappedMetadataInjector::class)) { $this->getServiceManager()->getContainer()->get(MappedMetadataInjector::class)->inject( $mappedProperties['testProperties'] ?? [], - $metadataValues[$qtiTestResourceIdentifier], + $metadataValues[$qtiTestResourceIdentifier] ?? [], $testResource ); } @@ -1447,7 +1447,6 @@ protected function getMetadataImporter() private function getMetaMetadataExtractor(): MetaMetadataExtractor { return $this->getPsrContainer()->get(MetaMetadataExtractor::class); - return $this->getServiceManager()->getContainer()->get(MetaMetadataExtractor::class); } private function getSecureResourceService(): SecureResourceServiceInterface