Skip to content

Commit

Permalink
Merge remote-tracking branch 'ilias/release_8' into 8_veda
Browse files Browse the repository at this point in the history
  • Loading branch information
Foreman committed Aug 22, 2024
2 parents c0413c9 + c7ef24d commit 5cfcfb5
Show file tree
Hide file tree
Showing 358 changed files with 2,293 additions and 21,578 deletions.
50 changes: 31 additions & 19 deletions CI/Copyright-Checker/copyright-checker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,35 @@ function is_copyright_valid() {
local file_extension="${file##*.}"
local offset=1

# since PSR-12 the php files will contain the copyright license as
# document-level comment, which starts on line 3.
if [ "php" = "${file_extension}" ]; then
offset=3
fi
is_ui_example "${file}"
local is_example=${?}

for copyright_line in "${COPYRIGHT_LINES[@]}"; do
local line_to_check="$(sed "${offset}q;d" "${file}")"
if ! [ "${copyright_line}" = "${line_to_check}" ]; then
return 1
if [ 1 -eq ${is_example} ]; then
if [ "php" = ${file_extension} ]; then
offset=3
fi

offset=$((1 + ${offset}))
done
for copyright_line in "${COPYRIGHT_LINES[@]}"; do
local line_to_check="$(sed "${offset}q;d" "${file}")"
if ! [ "${copyright_line}" = "${line_to_check}" ]; then
return 1
fi

offset=$((1 + ${offset}))
done
else
local lines=$(wc -l < "${file}");
while [ ${offset} -lt ${lines} ]
do
local line_to_check="$(echo "$(sed "${offset}q;d" ${file})" | xargs)"
if echo "$line_to_check" | grep -q "^namespace "; then
return 0
fi
if echo "$line_to_check" | grep -q -e '^/\*' -e '^//' -e '^#'; then
return 2
fi
offset=$((1 + ${offset}))
done
fi

return 0
}
Expand Down Expand Up @@ -162,15 +177,12 @@ function perform_copyright_check() {
is_copyright_valid "${file}"
local is_valid="${?}"

is_ui_example "${file}"
local is_example="${?}"

# invert the copyright-check for UI examples, because we
# don't want them to have too much content.
if ([ 0 -eq ${is_example} ] && [ 0 -eq ${is_valid} ]) ||
([ 1 -eq ${is_example} ] && [ 1 -eq ${is_valid} ]); then
if [ 1 -eq ${is_valid} ]; then
printf "copyright is not as expected in %s\n" "${file}"
exit_status=1
elif [ 2 -eq ${is_valid} ]; then
printf "copyright is not allowed in %s\n" "${file}"
exit_status=2
fi
done

Expand Down
7 changes: 7 additions & 0 deletions Modules/Category/Export/class.ilCategoryExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ public function getXmlRepresentation(string $a_entity, string $a_schema_version,
public function getValidSchemaVersions(string $a_entity): array
{
return [
"7.0.0" => [
'namespace' => 'https://www.ilias.de/Modules/Category/cat/7_0',
'xsd_file' => 'ilias_cat_7_0.xsd',
'uses_dataset' => false,
'min' => '7.0',
'max' => ''
],
"4.3.0" => [
"namespace" => "https://www.ilias.de/Modules/Category/cat/4_3",
"xsd_file" => "ilias_cat_4_3.xsd",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protected function getTentativePreconditions(Setup\Environment $environment): ar
return [
new ilIniFilesLoadedObjective(),
new ilDatabaseInitializedObjective(),
new ilFileSystemComponentDataDirectoryCreatedObjective("chatroom")
new ilFileSystemComponentDataDirectoryCreatedObjective('chatroom')
];
}

Expand All @@ -40,10 +40,10 @@ protected function collectFrom(Setup\Environment $environment, Setup\Metrics\Sto
// sub components of the various readers to run. This is a memento to the
// fact, that dependency injection is something we want. Currently, every
// component could just service locate the whole world via the global $DIC.
$DIC = $GLOBALS["DIC"];
$GLOBALS["DIC"] = new DI\Container();
$GLOBALS["DIC"]["ilDB"] = $db;
$GLOBALS["DIC"]["ilBench"] = null;
$DIC = $GLOBALS['DIC'];
$GLOBALS['DIC'] = new DI\Container();
$GLOBALS['DIC']['ilDB'] = $db;
$GLOBALS['DIC']['ilBench'] = null;

$chatAdministrations = ilObject::_getObjectsByType('chta');
$chatAdministration = current($chatAdministrations);
Expand All @@ -53,123 +53,123 @@ protected function collectFrom(Setup\Environment $environment, Setup\Metrics\Sto

if (count($settings) > 0) {
$storage->storeConfigText(
"address",
$settings['address'] ?? "",
"IP-Address/FQN of Chat Server."
'address',
$settings['address'] ?? '',
'IP-Address/FQN of Chat Server.'
);
$storage->storeConfigText(
"port",
(string) ($settings['port'] ?? ""),
"Port of the chat server."
'port',
(string) ($settings['port'] ?? ''),
'Port of the chat server.'
);
$storage->storeConfigText(
"sub_directory",
$settings['sub_directory'] ?? "",
"http(s)://[IP/Domain]/[SUB_DIRECTORY]"
'sub_directory',
$settings['sub_directory'] ?? '',
'http(s)://[IP/Domain]/[SUB_DIRECTORY]'
);

$storage->storeConfigText(
"protocol",
$settings['protocol'] ?? "",
"Protocol used for connection (http/https)."
'protocol',
$settings['protocol'] ?? '',
'Protocol used for connection (http/https).'
);

if ($settings['protocol'] === 'https') {
if (isset($settings['protocol']) && $settings['protocol'] === 'https') {
$cert = new Setup\Metrics\Metric(
Setup\Metrics\Metric::STABILITY_CONFIG,
Setup\Metrics\Metric::TYPE_TEXT,
$settings['cert'] ?? ""
$settings['cert'] ?? ''
);
$key = new Setup\Metrics\Metric(
Setup\Metrics\Metric::STABILITY_CONFIG,
Setup\Metrics\Metric::TYPE_TEXT,
$settings['key'] ?? ""
$settings['key'] ?? ''
);
$dhparam = new Setup\Metrics\Metric(
Setup\Metrics\Metric::STABILITY_CONFIG,
Setup\Metrics\Metric::TYPE_TEXT,
$settings['dhparam'] ?? ""
$settings['dhparam'] ?? ''
);
$https = new Setup\Metrics\Metric(
Setup\Metrics\Metric::STABILITY_CONFIG,
Setup\Metrics\Metric::TYPE_COLLECTION,
[
"cert" => $cert,
"key" => $key,
"dhparam" => $dhparam,
'cert' => $cert,
'key' => $key,
'dhparam' => $dhparam,
],
"Holds parameters for https."
'Holds parameters for https.'
);
$storage->store("https", $https);
$storage->store('https', $https);
}

$storage->storeConfigText(
"log",
'log',
(string) ($settings['log'] ?? ''),
"Absolute server path to the chat server's log file."
);
$storage->storeConfigText(
"log_level",
$settings['log_level'] ?? "",
"Possible values are emerg, alert, crit error, warning, notice, info, debug, silly."
'log_level',
$settings['log_level'] ?? '',
'Possible values are emerg, alert, crit error, warning, notice, info, debug, silly.'
);
$storage->storeConfigText(
"error_log",
$settings['error_log'] ?? "",
'error_log',
$settings['error_log'] ?? '',
"Absolute server path to the chat server's error log file."
);

if ($settings['ilias_proxy']) {
if (isset($settings['ilias_proxy']) && $settings['ilias_proxy']) {
$ilias_url = new Setup\Metrics\Metric(
Setup\Metrics\Metric::STABILITY_CONFIG,
Setup\Metrics\Metric::TYPE_TEXT,
$settings['ilias_url'] ?? ""
$settings['ilias_url'] ?? ''
);
$ilias_proxy = new Setup\Metrics\Metric(
Setup\Metrics\Metric::STABILITY_CONFIG,
Setup\Metrics\Metric::TYPE_COLLECTION,
[
"ilias_url" => $ilias_url
'ilias_url' => $ilias_url
],
"Holds proxy url if ILIAS proxy is enabled."
'Holds proxy url if ILIAS proxy is enabled.'
);
$storage->store("ilias_proxy", $ilias_proxy);
$storage->store('ilias_proxy', $ilias_proxy);
} else {
$storage->storeConfigBool(
"ilias_proxy",
'ilias_proxy',
false,
"Holds proxy url if ILIAS proxy is enabled."
'Holds proxy url if ILIAS proxy is enabled.'
);
}

if ($settings['client_proxy']) {
if (isset($settings['client_proxy']) && $settings['client_proxy']) {
$client_url = new Setup\Metrics\Metric(
Setup\Metrics\Metric::STABILITY_CONFIG,
Setup\Metrics\Metric::TYPE_TEXT,
$settings['client_url'] ?? ""
$settings['client_url'] ?? ''
);
$client_proxy = new Setup\Metrics\Metric(
Setup\Metrics\Metric::STABILITY_CONFIG,
Setup\Metrics\Metric::TYPE_COLLECTION,
[
"client_url" => $client_url
'client_url' => $client_url
],
"Holds proxy url if client proxy is enabled."
'Holds proxy url if client proxy is enabled.'
);
$storage->store("client_proxy", $client_proxy);
$storage->store('client_proxy', $client_proxy);
} else {
$storage->storeConfigBool(
"client_proxy",
'client_proxy',
false,
"Holds proxy url if client proxy is enabled."
'Holds proxy url if client proxy is enabled.'
);
}

if ($settings['deletion_mode']) {
if (isset($settings['deletion_mode']) && $settings['deletion_mode']) {
$deletion_unit = new Setup\Metrics\Metric(
Setup\Metrics\Metric::STABILITY_CONFIG,
Setup\Metrics\Metric::TYPE_TEXT,
$settings['deletion_unit'] ?? ""
$settings['deletion_unit'] ?? ''
);
$deletion_value = new Setup\Metrics\Metric(
Setup\Metrics\Metric::STABILITY_CONFIG,
Expand All @@ -179,22 +179,25 @@ protected function collectFrom(Setup\Environment $environment, Setup\Metrics\Sto
$deletion_time = new Setup\Metrics\Metric(
Setup\Metrics\Metric::STABILITY_CONFIG,
Setup\Metrics\Metric::TYPE_TEXT,
$settings['deletion_time'] ?? ""
$settings['deletion_time'] ?? ''
);
$deletion_mode = new Setup\Metrics\Metric(
Setup\Metrics\Metric::STABILITY_CONFIG,
Setup\Metrics\Metric::TYPE_COLLECTION,
[
"deletion_unit" => $deletion_unit,
"deletion_value" => $deletion_value,
"deletion_time" => $deletion_time,
'deletion_unit' => $deletion_unit,
'deletion_value' => $deletion_value,
'deletion_time' => $deletion_time,
],
"Holds information about deletion process."
'Holds information about deletion process.'
);
$storage->store(
'deletion_mode',
$deletion_mode
);
$storage->store("deletion_mode", $deletion_mode);
}
}

$GLOBALS["DIC"] = $DIC;
$GLOBALS['DIC'] = $DIC;
}
}
17 changes: 0 additions & 17 deletions Modules/CmiXapi/LuceneObjectDefinition.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ObjectDefinition xmlns:xi="http://www.w3.org/2001/XInclude" type="cmix">
<Document type="default">
<!--
<xi:include href="../../Services/Object/LuceneDataSource.xml" />
<xi:include href="../../Services/Tagging/LuceneDataSource.xml" />
<xi:include href="../../Services/MetaData/LuceneDataSource.xml" />
-->
<DataSource type="JDBC" action="append">
<Query>
SELECT title FROM object_data
</Query>
<Param format="list" type="int" value="objId" />
<Field store="YES" index="ANALYZED" column="title" type="text" name="propertyLow" />
</DataSource>
<DataSource type="JDBC" action="append">
<Query>
SELECT description FROM object_data
</Query>
<Param format="list" type="int" value="objId" />
<Field store="YES" index="ANALYZED" column="description" type="text" name="propertyLow" />
</DataSource>
</Document>
</ObjectDefinition>
19 changes: 10 additions & 9 deletions Modules/CmiXapi/classes/XapiProxy/DataService.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -18,6 +16,8 @@
*
*********************************************************************/

declare(strict_types=1);

namespace XapiProxy;

class DataService
Expand Down Expand Up @@ -67,14 +67,15 @@ class ilInitialisation extends \ilInitialisation
/**
* Function; initGlobal($a_name, $a_class, $a_source_file)
* Derive from protected to public...
* @param string $a_class
* @param string|null $a_source_file
* @see \ilInitialisation::initGlobal($a_name, $a_class, $a_source_file)
* @see \ilInitialisation::initGlobal()
*/
// public static function initGlobal(string $a_name, string $a_class, ?string $a_source_file = null) : void
public static function initGlobal($a_name, $a_class, $a_source_file = null): void
{
parent::initGlobal($a_name, $a_class, $a_source_file);
public static function initGlobal(
string $a_name,
$a_class,
?string $a_source_file = null,
?bool $destroy_existing = false
): void {
parent::initGlobal($a_name, $a_class, $a_source_file, $destroy_existing);
}

/**
Expand Down
7 changes: 5 additions & 2 deletions Modules/CmiXapi/classes/class.ilCmiXapiLaunchGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@ class ilCmiXapiLaunchGUI

private ilCtrlInterface $ctrl;

public function __construct(ilObjCmiXapi $object)
protected ?int $launchedByRefId;

public function __construct(ilObjCmiXapi $object, ?int $launchedByRefId = null)
{
$this->object = $object;
$this->launchedByRefId = $launchedByRefId;
}

public function executeCommand(): void
Expand Down Expand Up @@ -309,7 +312,7 @@ protected function CMI5preLaunch(string $token): array
$defaultStatementsUrl = $defaultLrs . "/statements";

// launchedStatement
$launchData = json_encode($this->object->getLaunchData($this->cmixUser, $lang));
$launchData = json_encode($this->object->getLaunchData($this->cmixUser, $lang, $this->launchedByRefId));
$launchedStatement = $this->object->getLaunchedStatement($this->cmixUser);
$launchedStatementParams = [];
$launchedStatementParams['statementId'] = $launchedStatement['id'];
Expand Down
Loading

0 comments on commit 5cfcfb5

Please sign in to comment.