Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions components/ILIAS/Authentication/Authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,32 @@ public function init(
array | \ArrayAccess &$pull,
array | \ArrayAccess &$internal,
): void {
// currently this is will be a session storage because we cannot store
// data on the client, see https://mantis.ilias.de/view.php?id=38503.
// @todo: this should be implemented by some proper key-value storage (or service).
$implement[UI\Component\Table\Storage::class] = static fn() =>
new class () implements UI\Component\Table\Storage {
public function offsetExists(mixed $offset): bool
{
return \ilSession::has($offset);
}
public function offsetGet(mixed $offset): mixed
{
return \ilSession::get($offset);
}
public function offsetSet(mixed $offset, mixed $value): void
{
if (!is_string($offset)) {
throw new \InvalidArgumentException('Offset needs to be of type string.');
}
\ilSession::set($offset, $value);
}
public function offsetUnset(mixed $offset): void
{
\ilSession::clear($offset);
}
};

$contribute[\ILIAS\Setup\Agent::class] = static fn() =>
new \ilAuthenticationSetupAgent(
$pull[\ILIAS\Refinery\Factory::class]
Expand Down
2 changes: 1 addition & 1 deletion components/ILIAS/DataProtection/classes/Consumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ final class Consumer implements ConsumerInterface

public function __construct(?Container $container = null)
{
$this->container = $container ?? $GLOBALS['DIC'];
$this->container = $container ?? $GLOBALS['DIC'] ?? new Container();
}

public function id(): string
Expand Down
5 changes: 5 additions & 0 deletions components/ILIAS/FileServices/FileServices.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public function init(
array | \ArrayAccess &$pull,
array | \ArrayAccess &$internal,
): void {
$implement[UI\Component\Input\Field\PhpUploadLimit::class] = static fn() =>
new FileServices\FileServicesLegacyInitialisationAdapter();
$implement[UI\Component\Input\Field\GlobalUploadLimit::class] = static fn() =>
new FileServices\FileServicesLegacyInitialisationAdapter();

$contribute[\ILIAS\Setup\Agent::class] = static fn() =>
new \ilFileServicesSetupAgent(
$pull[\ILIAS\Refinery\Factory::class]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
*
* ILIAS is licensed with the GPL-3.0,
* see https://www.gnu.org/licenses/gpl-3.0.en.html
* You should have received a copy of said license along with the
* source code, too.
*
* If this is not the case or you just want to try ILIAS, you'll find
* us at:
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*/

declare(strict_types=1);

namespace ILIAS\FileServices;

use ILIAS\UI\Component\Input\Field\GlobalUploadLimit;
use ILIAS\UI\Component\Input\Field\PhpUploadLimit;

/**
* @author Thibeau Fuhrer <thibeau@sr.solutions>
*/
class FileServicesLegacyInitialisationAdapter implements PhpUploadLimit, GlobalUploadLimit
{
public function getPhpUploadLimitInBytes(): int
{
return (int) \ilFileUtils::getPhpUploadSizeLimitInBytes();
}

public function getGlobalUploadLimitInBytes(): ?int
{
global $DIC;
if ($DIC->offsetExists('upload_policy_resolver')) {
/** @var $DIC array{upload_policy_resolver: \UploadPolicyResolver} */
return $DIC['upload_policy_resolver']->getUserUploadSizeLimitInBytes();
}
return null;
}
}
3 changes: 3 additions & 0 deletions components/ILIAS/Help/Help.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public function init(
array | \ArrayAccess &$pull,
array | \ArrayAccess &$internal,
): void {
$implement[UI\HelpTextRetriever::class] = static fn() =>
new \ilHelpUITextRetriever();

$contribute[\ILIAS\Setup\Agent::class] = static fn() =>
new \ILIAS\Help\Setup\Agent(
$pull[\ILIAS\Refinery\Factory::class]
Expand Down
55 changes: 55 additions & 0 deletions components/ILIAS/Init/Init.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,60 @@ public function init(

$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\OfComponent($this, ".htaccess", ".");

$contribute[Component\EntryPoint::class] = static fn() =>
new Init\AllModernComponents(
$pull[\ILIAS\Refinery\Factory::class],
$pull[\ILIAS\Data\Factory::class],
$use[\ILIAS\UI\Factory::class],
$use[\ILIAS\UI\Renderer::class],
$pull[\ILIAS\UI\Implementation\Component\Counter\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Button\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Listing\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Image\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Panel\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Modal\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Dropzone\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Popover\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Divider\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Link\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Dropdown\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Item\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\ViewControl\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Chart\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Input\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Table\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\MessageBox\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Card\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Layout\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\MainControls\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Tree\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Menu\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Symbol\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Toast\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Legacy\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Launcher\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Entity\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Panel\Listing\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Modal\InterruptiveItem\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Chart\ProgressMeter\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Chart\Bar\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Input\ViewControl\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Input\Container\ViewControl\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Table\Column\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Table\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\MainControls\Slate\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Symbol\Icon\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Symbol\Glyph\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Symbol\Avatar\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Input\Container\Form\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Input\Container\Filter\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Input\Field\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Prompt\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Prompt\State\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Progress\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Progress\State\Factory::class],
$pull[\ILIAS\UI\Implementation\Component\Progress\State\Bar\Factory::class],
);
}
}
43 changes: 8 additions & 35 deletions components/ILIAS/Init/classes/class.ilInitialisation.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@
$GLOBALS['ilGlobalStartTime'] = microtime();
}

global $DIC;
if (null === $DIC) {
// Don't remove this, intellisense autocompletion does not work in PhpStorm without a top level assignment
$DIC = new Container();
}

/**
* ILIAS Initialisation Utility Class
* perform basic setup: init database handler, load configuration file,
Expand Down Expand Up @@ -414,7 +408,7 @@ protected static function buildHTTPPath(): bool
$ilias_http_path = preg_replace('/goto.php$/', '', $ilias_http_path);
$ilias_http_path = preg_replace('/go\/.*$/', '', $ilias_http_path);

$f = new \ILIAS\Data\Factory();
$f = $GLOBALS["DIC"][\ILIAS\Data\Factory::class];
$uri = $f->uri(ilFileUtils::removeTrailingPathSeparators($ilias_http_path));

$base_URI = $uri->getBaseURI();
Expand All @@ -432,7 +426,7 @@ protected static function determineClient(): void
return;
}
global $DIC;
$df = new \ILIAS\Data\Factory();
$df = $DIC[\ILIAS\Data\Factory::class];

// check whether ini file object exists
if (!$DIC->isDependencyAvailable('iliasIni')) {
Expand Down Expand Up @@ -782,7 +776,7 @@ protected static function initCron(\ILIAS\DI\Container $c): void
$c->database(),
$c->settings(),
$c->logger()->cron(),
(new \ILIAS\Data\Factory())->clock()
$c[\ILIAS\Data\Factory::class]->clock(),
);
};
}
Expand Down Expand Up @@ -1074,9 +1068,6 @@ protected static function initLanguage(bool $a_use_user_language = true): void
$DIC->offsetUnset('lng');
}
self::initGlobal('lng', ilLanguage::getGlobalInstance());
//re-init refinery with the user's language
unset($DIC['refinery']);
self::initRefinery($DIC);
} else {
self::initGlobal('lng', ilLanguage::getFallbackInstance());
}
Expand Down Expand Up @@ -1200,7 +1191,6 @@ public static function initILIAS(): void
return;
}

$GLOBALS["DIC"] = new Container();
$GLOBALS["DIC"]["ilLoggerFactory"] = function ($c) {
return ilLoggerFactory::getInstance();
};
Expand Down Expand Up @@ -1284,7 +1274,7 @@ protected static function initCore(): void
// breaks CAS: must be included after CAS context isset in AuthUtils

self::requireCommonIncludes();
$GLOBALS["DIC"]["ilias.version"] = (new ILIAS\Data\Factory())->version(ILIAS_VERSION_NUMERIC);
$GLOBALS["DIC"]["ilias.version"] = $GLOBALS["DIC"][\ILIAS\Data\Factory::class]->version(ILIAS_VERSION_NUMERIC);

// error handler
self::initGlobal(
Expand Down Expand Up @@ -1401,8 +1391,6 @@ protected static function initClient(): void
self::setSessionCookieParams();
self::setClientIdCookie();

self::initRefinery($DIC);

(new InitCtrlService())->init($DIC);

// Init GlobalScreen
Expand Down Expand Up @@ -1547,13 +1535,11 @@ private static function initGlobalScreen(\ILIAS\DI\Container $c): void
}

/**
* init the ILIAS UI framework.
* @deprecated this mechanism will be removed as part of the component revision and
* the refactoring to the new bootstrap mechanism.
*/
public static function initUIFramework(\ILIAS\DI\Container $c): void
public static function applyPluginManipulationsToUiFramework(\ILIAS\DI\Container $c): void
{
$init_ui = new InitUIFramework();
$init_ui->init($c);

$component_repository = $c["component.repository"];
$component_factory = $c["component.factory"];
foreach ($component_repository->getPlugins() as $pl) {
Expand All @@ -1571,19 +1557,6 @@ public static function initUIFramework(\ILIAS\DI\Container $c): void
}
}

/**
* @param \ILIAS\DI\Container $container
*/
protected static function initRefinery(\ILIAS\DI\Container $container): void
{
$container['refinery'] = function ($container) {
$dataFactory = new \ILIAS\Data\Factory();
$language = $container['lng'];

return new \ILIAS\Refinery\Factory($dataFactory, $language);
};
}

/**
* @param Container $container
*/
Expand Down Expand Up @@ -1628,7 +1601,7 @@ protected static function initHTML(): void
self::initUploadPolicies($DIC);
}

self::initUIFramework($GLOBALS["DIC"]);
self::applyPluginManipulationsToUiFramework($GLOBALS["DIC"]);
$tpl = new ilGlobalPageTemplate($DIC->globalScreen(), $DIC->ui(), $DIC->http());
self::initGlobal("tpl", $tpl);

Expand Down
22 changes: 22 additions & 0 deletions components/ILIAS/Init/resources/dependency_resolution.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
*
* ILIAS is licensed with the GPL-3.0,
* see https://www.gnu.org/licenses/gpl-3.0.en.html
* You should have received a copy of said license along with the
* source code, too.
*
* If this is not the case or you just want to try ILIAS, you'll find
* us at:
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*/

return [
"*" => [
\ILIAS\Language\Language::class => \ILIAS\Language\LanguageLegacyInitialisationAdapter::class,
],
];
3 changes: 2 additions & 1 deletion components/ILIAS/Init/resources/error.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

try {
require_once '../vendor/composer/vendor/autoload.php';
ilInitialisation::initILIAS();
require_once __DIR__ . '/../artifacts/bootstrap_default.php';
entry_point('ILIAS Legacy Initialisation Adapter');
$DIC->globalScreen()->tool()->context()->claim()->external();
$local_tpl = new ilGlobalTemplate("tpl.main.html", true, true);
$local_tpl->addBlockFile("CONTENT", "content", "tpl.error.html");
Expand Down
4 changes: 2 additions & 2 deletions components/ILIAS/Init/resources/ilias.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
}

require_once '../vendor/composer/vendor/autoload.php';

ilInitialisation::initILIAS();
require_once __DIR__ . '/../artifacts/bootstrap_default.php';
entry_point('ILIAS Legacy Initialisation Adapter');

/** @var $DIC \ILIAS\DI\Container */
global $DIC;
Expand Down
8 changes: 5 additions & 3 deletions components/ILIAS/Init/resources/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@
}
// END WebDAV: Block WebDAV Requests from Microsoft WebDAV MiniRedir client.

ilInitialisation::initILIAS();
require_once __DIR__ . '/../artifacts/bootstrap_default.php';
entry_point('ILIAS Legacy Initialisation Adapter');

$ilCtrl->callBaseClass(ilStartUpGUI::class);
$ilBench->save();
global $DIC;
$DIC->ctrl()->callBaseClass(ilStartUpGUI::class);
$DIC['ilBench']->save();
9 changes: 5 additions & 4 deletions components/ILIAS/Init/resources/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
}

require_once '../vendor/composer/vendor/autoload.php';
require_once __DIR__ . '/../artifacts/bootstrap_default.php';
entry_point('ILIAS Legacy Initialisation Adapter');

ilInitialisation::initILIAS();

global $DIC;
ilStartUpGUI::setForcedCommand('showLoginPageOrStartupPage');
$ilCtrl->callBaseClass(ilStartUpGUI::class);
$ilBench->save();
$DIC->ctrl()->callBaseClass(ilStartUpGUI::class);
$DIC['ilBench']->save();
exit();
9 changes: 5 additions & 4 deletions components/ILIAS/Init/resources/logout.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
}

require_once '../vendor/composer/vendor/autoload.php';
require_once __DIR__ . '/../artifacts/bootstrap_default.php';
entry_point('ILIAS Legacy Initialisation Adapter');

ilInitialisation::initILIAS();

global $DIC;
ilStartUpGUI::setForcedCommand('doLogout');
$ilCtrl->callBaseClass(ilStartUpGUI::class);
$ilBench->save();
$DIC->ctrl()->callBaseClass(ilStartUpGUI::class);
$DIC['ilBench']->save();
exit();
9 changes: 5 additions & 4 deletions components/ILIAS/Init/resources/pwassist.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
}

require_once '../vendor/composer/vendor/autoload.php';
require_once __DIR__ . '/../artifacts/bootstrap_default.php';
entry_point('ILIAS Legacy Initialisation Adapter');

ilInitialisation::initILIAS();

global $DIC;
ilStartUpGUI::setForcedCommand('jumpToPasswordAssistance');
$ilCtrl->callBaseClass(ilStartUpGUI::class);
$ilBench->save();
$DIC->ctrl()->callBaseClass(ilStartUpGUI::class);
$DIC['ilBench']->save();
exit();
Loading