Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: oat-sa/generis
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v15.34.0
Choose a base ref
...
head repository: oat-sa/generis
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 988 additions and 607 deletions.
  1. +2 −2 .github/workflows/continuous-integration.yaml
  2. +9 −10 .github/workflows/sonar.yml
  3. +5 −0 common/class.Utils.php
  4. +24 −1 common/oatbox/event/EventManager.php
  5. +20 −15 common/oatbox/filesystem/Directory.php
  6. +76 −135 common/oatbox/filesystem/File.php
  7. +8 −9 common/oatbox/filesystem/FileSystem.php
  8. +3 −1 common/oatbox/filesystem/FileSystemHandler.php
  9. +34 −17 common/oatbox/filesystem/FileSystemService.php
  10. +10 −0 common/oatbox/filesystem/FilesystemException.php
  11. +9 −0 common/oatbox/filesystem/FilesystemInterface.php
  12. +119 −155 common/oatbox/filesystem/utils/FileSystemWrapperTrait.php
  13. +68 −85 common/oatbox/filesystem/utils/FlyWrapperTrait.php
  14. +0 −66 common/oatbox/filesystem/wrapper/GoogleStorageWrapper.php
  15. +3 −3 common/oatbox/install/Installer.php
  16. +4 −0 common/oatbox/service/ServiceManager.php
  17. +11 −1 common/oatbox/task/AbstractTaskAction.php
  18. +16 −18 common/persistence/class.PhpFileDriver.php
  19. +64 −18 common/persistence/class.PhpRedisDriver.php
  20. +12 −5 composer.json
  21. +10 −8 core/DependencyInjection/BaseContainer.php
  22. +3 −0 core/GenerisRdf.php
  23. +19 −9 core/kernel/classes/class.Resource.php
  24. +56 −1 core/kernel/persistence/smoothsql/class.Class.php
  25. +9 −2 core/kernel/persistence/smoothsql/search/ComplexSearchService.php
  26. +27 −10 core/kernel/persistence/starsql/class.Resource.php
  27. +11 −0 core/kernel/persistence/starsql/search/Command/RegexCommand.php
  28. +1 −1 core/kernel/persistence/starsql/search/GateWay.php
  29. +10 −15 core/kernel/persistence/starsql/search/QuerySerializer.php
  30. +2 −2 core/kernel/uri/Bin2HexUriProvider.php
  31. +24 −0 core/ontology/generis.rdf
  32. +2 −0 helpers/PropertyCache.php
  33. +0 −6 migrations/Version202009081435472348_generis.php
  34. +59 −0 migrations/Version202412031536512348_generis.php
  35. +5 −5 scripts/update/Updater.php
  36. +2 −2 test/FileSystemMockTrait.php
  37. +0 −1 test/integration/common/filesystem/DirectoryFilesystemTest.php
  38. +48 −0 test/integration/model/persistence/starsql/ClassTest.php
  39. +4 −4 test/unit/ConfigurationTest.php
  40. +153 −0 test/unit/common/persistence/PhpRedisDriverTest.php
  41. +46 −0 test/unit/core/kernel/uri/Bin2HexUriProviderTest.php
4 changes: 2 additions & 2 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
@@ -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:
19 changes: 9 additions & 10 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
name: Sonarqube_CI
on:

pull_request:
types:
- labeled

push:
branches:
- master
- main
- develop

pull_request:
types: [opened, synchronize, reopened]
branches:
- '**'
workflow_dispatch:
- release-*

jobs:
build:
name: Sonarqube_CI
if: ${{ github.event.label.name == 'sonar_check' || github.event_name == 'push' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
@@ -26,16 +25,16 @@ jobs:
uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
SONAR_HOST_URL: 'https://sonarqube.taotesting.info/sonarqube/'

# Job will fail when the Quality Gate is red
- name: Sonarqube quality gate check
id: sonarqube-quality-gate-check
id: sonarqube-quality-gate-check
uses: sonarsource/sonarqube-quality-gate-action@master
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}


- name: "Example show SonarQube Quality Gate Status value"
run: echo "The Quality Gate status is ${{ steps.sonarqube-quality-gate-check.outputs.quality-gate-status }}"
run: echo "The Quality Gate status is ${{ steps.sonarqube-quality-gate-check.outputs.quality-gate-status }}"
5 changes: 5 additions & 0 deletions common/class.Utils.php
Original file line number Diff line number Diff line change
@@ -207,4 +207,9 @@ public static function toHumanReadablePhpString($value, $indentation = 0)

return (string) $returnValue;
}

public static function getResourceId(string $uri): string
{
return substr($uri, strpos($uri, '#') + 1);
}
}
25 changes: 24 additions & 1 deletion common/oatbox/event/EventManager.php
Original file line number Diff line number Diff line change
@@ -21,8 +21,10 @@

namespace oat\oatbox\event;

use common_Logger;
use oat\oatbox\service\ConfigurableService;
use oat\oatbox\service\ServiceNotFoundException;
use Throwable;

/**
* The simple placeholder ServiceManager
@@ -52,9 +54,18 @@ public function trigger($event, $params = [])
$event = is_object($event) ? $event : new GenericEvent($event, $params);

foreach ($this->getListeners($event) as $callback) {
$callbackName = $callback;

if (is_array($callback) && count($callback) == 2) {
list($key, $function) = $callback;
[$key, $function] = $callback;

if (is_object($key)) {
$callbackName = sprintf('%s::%s', get_class($key), $function);
}

if (is_string($key)) {
$callbackName = sprintf('%s::%s', $key, $function);

try {
$service = $container->get($key);
$callback = [$service, $function];
@@ -64,6 +75,18 @@ public function trigger($event, $params = [])
}
}

if (!is_callable($callback)) {
common_Logger::w(
sprintf(
'Event manager cannot call %s because it is not a callable. '
. 'Notice, that classes registered in DI container cannot be executed during the installation',
$callbackName
)
);

continue;
}

call_user_func($callback, $event);
}
}
35 changes: 20 additions & 15 deletions common/oatbox/filesystem/Directory.php
Original file line number Diff line number Diff line change
@@ -21,8 +21,6 @@

namespace oat\oatbox\filesystem;

use League\Flysystem\FileExistsException;

class Directory extends FileSystemHandler implements \IteratorAggregate
{
public const ITERATOR_RECURSIVE = '1';
@@ -87,14 +85,13 @@ public function getFlyIterator($flags = null)
$contents = $this->getFileSystem()->listContents($this->getPrefix(), $recursive);

if (!empty($contents)) {
$dirPath = $this->getFileSystem()->get($this->getPrefix())->getPath();
foreach ($contents as $content) {
if ($withDirectories && $content['type'] == 'dir') {
$iterator[] = $this->getDirectory(str_replace($dirPath, '', $content['path']));
$iterator[] = $this->getDirectory($this->stripDirectoryPath($content['path']));
}

if ($withFiles && $content['type'] == 'file') {
$iterator[] = $this->getFile(str_replace($dirPath, '', $content['path']));
$iterator[] = $this->getFile($this->stripDirectoryPath($content['path']));
}
}
}
@@ -127,7 +124,7 @@ public function getRelPath($content)
*/
public function exists()
{
return $this->getFileSystem()->has($this->getPrefix());
return $this->getFileSystem()->directoryExists($this->getPrefix());
}

/**
@@ -137,7 +134,14 @@ public function exists()
*/
public function deleteSelf()
{
return $this->getFileSystem()->deleteDir($this->getPrefix());
try {
$this->getFileSystem()->deleteDirectory($this->getPrefix());
return true;
} catch (FilesystemException $e) {
$this->logWarning($e->getMessage());
}

return false;
}

/**
@@ -185,15 +189,10 @@ public function rename($path)

foreach ($filePaths as $renaming) {
try {
if ($this->getFileSystem()->rename($renaming['source'], $renaming['destination']) === false) {
throw new \common_exception_FileSystemError(
"Unable to rename '" . $renaming['source'] . "' into '" . $renaming['destination'] . "'."
);
}
} catch (FileExistsException $e) {
$this->getFileSystem()->move($renaming['source'], $renaming['destination']);
} catch (FilesystemException $e) {
throw new \common_exception_FileSystemError(
"Unable to rename '" . $renaming['source'] . "' into '" . $renaming['destination']
. "'. File already exists."
"Unable to rename '" . $renaming['source'] . "' into '" . $renaming['destination'] . "'."
);
}
}
@@ -206,4 +205,10 @@ public function rename($path)

return true;
}

private function stripDirectoryPath(string $path): string
{
$strippedPath = str_replace($this->getPrefix(), '', $path);
return str_replace($this->getFileSystemId(), '', $strippedPath);
}
}
Loading