Skip to content

Commit

Permalink
Pick #6234 and #6208 from 8 (#6244)
Browse files Browse the repository at this point in the history
* PRG: adjust debug logging for parameter to avoid exhausted memory limit while deleting PRG object(s) in the trash. (37594) (#6208)

* LSO: include check if lso abstract or extro image exists. If not do not execute deletion of file(s). (#37590) (#6234)

---------

authored-by: Luka Stocker <[email protected]>
  • Loading branch information
nhaagen authored Aug 18, 2023
1 parent d47d3d6 commit 063e8e0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
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);

/**
* Storage of images in settings.
*/
Expand Down Expand Up @@ -69,7 +69,9 @@ public function delete_image(string $which, ilLearningSequenceSettings $settings
$delete = $settings->getExtroImage();
$settings = $settings->withExtroImage();
}
$this->deleteFile($delete);
if (!empty($delete)) {
$this->deleteFile($delete);
}
return $settings;
}

Expand Down
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);

class ilStudyProgrammeEvents implements StudyProgrammeEvents
{
protected ilAppEventHandler $app_event_handler;
Expand All @@ -34,7 +34,25 @@ public function __construct(

public function raise(string $event, array $parameter): void
{
$this->logger->debug("PRG raised: " . $event . ' (' . print_r($parameter, true) . ')');
$parameter_formatter = static function ($value) use (&$parameter_formatter) {
if (is_object($value)) {
return get_class($value);
}

if (is_array($value)) {
return array_map(
$parameter_formatter,
$value
);
}

return $value;
};

$this->logger->debug("PRG raised: " . $event . ' (' . var_export(array_map(
$parameter_formatter,
$parameter
), true) . ')');

if (in_array($event, [
self::EVENT_USER_ASSIGNED,
Expand Down

0 comments on commit 063e8e0

Please sign in to comment.