Skip to content

Commit

Permalink
Merge branch 'release-48.16.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Nov 28, 2024
2 parents ecacad2 + 0eb8123 commit c3714d3
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
fail-fast: false
matrix:
operating-system: [ ubuntu-latest ]
php-version: [ '7.4', '8.0', '8.1' ]
php-version: [ '8.1', '8.2', '8.3' ]
include:
- php-version: '8.1'
- php-version: '8.3'
coverage: true

steps:
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@
"oat-sa/lib-test-cat": "2.4.0",
"oat-sa/oatbox-extension-installer": "~1.1||dev-master",
"qtism/qtism": ">=0.28.3",
"oat-sa/generis": ">=15.39.0",
"oat-sa/tao-core": ">=54.25.0",
"oat-sa/generis": ">=16.0.0",
"oat-sa/tao-core": ">=54.26.0",
"oat-sa/extension-tao-item": ">=12.4.0",
"oat-sa/extension-tao-itemqti": ">=30.23.0",
"oat-sa/extension-tao-test": ">=16.3.0",
"oat-sa/extension-tao-delivery": ">=15.0.0",
"oat-sa/extension-tao-outcome": ">=13.0.0",
"league/flysystem": "~1.0",
"league/flysystem": "^3.0",
"slim/slim": "^3.0"
},
"autoload": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

use common_exception_NoContent;
use common_exception_NotFound;
use League\Flysystem\FileNotFoundException;
use oat\oatbox\filesystem\FilesystemException;
use oat\tao\model\state\StateMigration;
use oat\tao\model\taskQueue\QueueDispatcherInterface;
use oat\taoDelivery\model\execution\DeliveryExecution;
Expand Down Expand Up @@ -92,7 +92,7 @@ private function restoreTestSessionState(string $userId, string $sessionId)
try {
$this->stateMigration->restore($userId, $sessionId);
$this->dispatchBackupRemoval($userId, $sessionId, 'Test Session');
} catch (FileNotFoundException $e) {
} catch (FilesystemException $e) {
throw new RestorationImpossibleException(
sprintf('[%s] impossible to reach archived test session', $sessionId)
);
Expand All @@ -105,7 +105,7 @@ private function restoreExtendedState(string $userId, string $sessionId): void
try {
$this->stateMigration->restore($userId, $extendedStorageId);
$this->dispatchBackupRemoval($userId, $extendedStorageId, 'Extended');
} catch (FileNotFoundException $e) {
} catch (FilesystemException $e) {
$this->logger->debug(
sprintf(
'[%s] Extended state restoration impossible for user %s',
Expand All @@ -122,7 +122,7 @@ private function restoreTimeLineState(string $userId, string $sessionId): void
try {
$this->stateMigration->restore($userId, $qtiItemStorageId);
$this->dispatchBackupRemoval($userId, $qtiItemStorageId, 'TimeLine');
} catch (FileNotFoundException $e) {
} catch (FilesystemException $e) {
$this->logger->debug(
sprintf(
'[%s] TimeLine state restoration impossible for user %s',
Expand Down Expand Up @@ -184,7 +184,7 @@ private function restoreItemState(string $userId, string $callId)
try {
$this->stateMigration->restore($userId, $callId);
$this->dispatchBackupRemoval($userId, $callId, 'Test Item');
} catch (FileNotFoundException $e) {
} catch (FilesystemException $e) {
$this->logger->debug(
sprintf(
'[%s] Test Item state restoration impossible for user %s',
Expand Down
11 changes: 2 additions & 9 deletions models/classes/class.QtiTestCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
use qtism\data\content\StylesheetCollection;
use qtism\common\utils\Url;
use oat\taoQtiItem\model\qti\Service;
use League\Flysystem\FileExistsException;
use oat\oatbox\filesystem\Directory;
use oat\taoQtiTest\models\TestCategoryRulesService;
use oat\taoQtiTest\models\QtiTestCompilerIndex;
Expand Down Expand Up @@ -793,14 +792,8 @@ protected function copyPublicResources()

if (in_array($mime, self::getPublicMimeTypes()) === true && $pathinfo['extension'] !== 'php') {
$publicPathFile = $testDefinitionDir->getRelPath($file);
try {
common_Logger::d('Public ' . $file->getPrefix() . '(' . $mime . ') to ' . $publicPathFile);
$publicCompiledDocDir->getFile($publicPathFile)->write($file->readStream());
} catch (FileExistsException $e) {
common_Logger::w(
'File ' . $publicPathFile . ' copied twice to public test folder during compilation'
);
}
common_Logger::d('Public ' . $file->getPrefix() . '(' . $mime . ') to ' . $publicPathFile);
$publicCompiledDocDir->getFile($publicPathFile)->write($file->readStream());
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions models/classes/class.QtiTestService.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
* Copyright (c) 2013-2024 (original work) Open Assessment Technologies SA;
*/

use League\Flysystem\FileExistsException;
use oat\generis\model\data\event\ResourceCreated;
use oat\oatbox\filesystem\Directory;
use oat\oatbox\filesystem\File;
Expand Down Expand Up @@ -1276,7 +1275,6 @@ private function saveDoc(core_kernel_classes_Resource $test, XmlDocument $doc)
* @param boolean $preventOverride Prevent data to be overriden Default is (boolean) true.
*
* @return Directory the content directory
* @throws FileExistsException
* @throws XmlStorageException
* @throws common_Exception
* @throws common_exception_Error
Expand Down
2 changes: 1 addition & 1 deletion models/classes/files/QtiFlysystemFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function getMimeType()

public function hasFilename()
{
return $this->getFileSystem()->has($this->getPrefix() . self::FILENAME_MD_PREFIX);
return $this->getFileSystem()->fileExists($this->getPrefix() . self::FILENAME_MD_PREFIX);
}

public function getFilename()
Expand Down
4 changes: 2 additions & 2 deletions models/classes/runner/QtiRunnerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
use common_persistence_KeyValuePersistence;
use common_session_SessionManager;
use Exception;
use League\Flysystem\FileNotFoundException;
use oat\libCat\result\ItemResult;
use oat\libCat\result\ResultVariable;
use oat\oatbox\event\EventManager;
use oat\oatbox\filesystem\FilesystemException;
use oat\oatbox\service\ConfigurableService;
use oat\oatbox\service\exception\InvalidServiceManagerException;
use oat\tao\model\featureFlag\FeatureFlagChecker;
Expand Down Expand Up @@ -187,7 +187,7 @@ private function loadItemData($itemRef, $path)

$this->dataCache[$cacheKey] = $jsonContent;
return $this->dataCache[$cacheKey];
} catch (FileNotFoundException $e) {
} catch (FilesystemException $e) {
throw new tao_models_classes_FileNotFoundException(
$path . ' for item reference ' . $itemRef
);
Expand Down
4 changes: 2 additions & 2 deletions scripts/cli/exportMultipleQtiTestsToDir.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private function exportTest($testUri)
$zip->close();
$zipArchiveHandler = fopen($file, 'r');
$fileName = $this->getFileName($testUri);
$this->fileSystem->put($fileName, $zipArchiveHandler);
$this->fileSystem->write($fileName, $zipArchiveHandler);
fclose($zipArchiveHandler);
$expReport->add(common_report_Report::createInfo($this->fileSystem->getId() . '/' . $fileName));
$report = $expReport;
Expand All @@ -183,7 +183,7 @@ protected function getFileName($testUri)
{
$i = 0;
$fileName = \tao_helpers_File::getSafeFileName($testUri . '.zip');
while ($this->fileSystem->has($fileName)) {
while ($this->fileSystem->fileExists($fileName)) {
$i++;
$fileName = \tao_helpers_File::getSafeFileName($testUri . '_' . $i . '.zip');
}
Expand Down
2 changes: 1 addition & 1 deletion test/integration/files/QtiFlysystemFileManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function tearDown(): void
public function cleanUp()
{
foreach ($this->filesystem->listContents('/', true) as $file) {
$basename = $file['basename'];
$basename = basename($file['path']);
if (strpos($basename, 'unittest') !== false) {
$this->filesystem->delete($file['path']);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

declare(strict_types=1);

use League\Flysystem\FileNotFoundException;
use oat\oatbox\extension\AbstractAction;
use oat\oatbox\filesystem\FilesystemException;
use oat\tao\model\state\StateMigration;
use oat\tao\model\taskQueue\QueueDispatcher;
use oat\taoDelivery\model\execution\DeliveryExecution;
Expand Down Expand Up @@ -83,7 +83,7 @@ public function testImpossibleTestSessionStateRestoration(): void
$deliveryExecution->expects(self::once())->method('getUserIdentifier')
->willReturn(Uuid::uuid4()->toString());
$this->stateMigrationMock->expects(self::once())->method('restore')
->willThrowException(new FileNotFoundException(''));
->willThrowException(new FilesystemException(''));

$this->expectException(RestorationImpossibleException::class);
$this->subject->restore($deliveryExecution);
Expand Down

0 comments on commit c3714d3

Please sign in to comment.