Skip to content
Open
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
11 changes: 9 additions & 2 deletions components/ILIAS/Authentication/Authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function offsetGet(mixed $offset): mixed
}
public function offsetSet(mixed $offset, mixed $value): void
{
if (!is_string($offset)) {
if (!\is_string($offset)) {
throw new \InvalidArgumentException('Offset needs to be of type string.');
}
\ilSession::set($offset, $value);
Expand All @@ -67,7 +67,14 @@ public function offsetUnset(mixed $offset): void
new Component\Resource\Endpoint($this, 'sessioncheck.php');
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\ComponentJS($this, 'js/dist/SessionReminder.min.js');
$contribute[User\Settings\UserSettings::class] = fn() =>
$contribute[User\Settings\UserSettings::class] = static fn() =>
new Authentication\UserSettings\Settings();

$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
new \ilAuthDestroyExpiredSessionsCron(
self::class,
$use[\ILIAS\Language\Language::class],
$use[\ILIAS\Logging\LoggerFactory::class]
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,13 @@
declare(strict_types=1);

use ILIAS\Cron\Job\JobResult;
use ILIAS\Cron\CronJob;
use ILIAS\Cron\AbstractCronJob;

class ilAuthDestroyExpiredSessionsCron extends CronJob
class ilAuthDestroyExpiredSessionsCron extends AbstractCronJob
{
protected ilLanguage $lng;

public function __construct()
public function init(): void
{
global $DIC;

$this->lng = $DIC->language();
$this->lng->loadLanguageModule('auth');
$this->language->loadLanguageModule('auth');
}

public function getId(): string
Expand All @@ -40,12 +35,12 @@ public function getId(): string

public function getTitle(): string
{
return $this->lng->txt('auth_cron_destroy_expired_sessions');
return $this->language->txt('auth_cron_destroy_expired_sessions');
}

public function getDescription(): string
{
return $this->lng->txt('auth_cron_destroy_expired_sessions_desc');
return $this->language->txt('auth_cron_destroy_expired_sessions_desc');
}

public function hasAutoActivation(): bool
Expand Down
3 changes: 0 additions & 3 deletions components/ILIAS/Authentication/service.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,4 @@
<pluginslot id="authhk" name="AuthenticationHook" />
</pluginslots>
<logging />
<crons>
<cron id="auth_destroy_expired_sessions" class="ilAuthDestroyExpiredSessionsCron" />
</crons>
</service>
13 changes: 13 additions & 0 deletions components/ILIAS/BookingManager/BookingManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,18 @@ public function init(

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

$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
new \ilBookCronNotification(
self::class,
$use[\ILIAS\Language\Language::class],
$use[\ILIAS\Logging\LoggerFactory::class]
);
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
new \ilBookingPrefBookCron(
self::class,
$use[\ILIAS\Language\Language::class],
$use[\ILIAS\Logging\LoggerFactory::class]
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,24 @@

use ILIAS\Cron\Job\Schedule\JobScheduleType;
use ILIAS\Cron\Job\JobResult;
use ILIAS\Cron\CronJob;
use ILIAS\Cron\AbstractCronJob;

/**
* Cron for booking manager notification
* @author Alexander Killing <killing@leifos.de>
*/
class ilBookCronNotification extends CronJob
class ilBookCronNotification extends AbstractCronJob
{
protected \ILIAS\BookingManager\InternalRepoService $repo;
protected ilLanguage $lng;
protected ilLogger $book_log;

public function __construct()
public function init(): void
{
global $DIC;

$this->lng = $DIC->language();
$this->language->loadLanguageModule('book');

$this->book_log = ilLoggerFactory::getLogger("book");
$this->book_log = $this->logger_factory->getComponentLogger('book');
$this->repo = $DIC->bookingManager()
->internal()
->repo();
Expand All @@ -49,18 +48,12 @@ public function getId(): string

public function getTitle(): string
{
$lng = $this->lng;

$lng->loadLanguageModule("book");
return $lng->txt("book_notification");
return $this->language->txt("book_notification");
}

public function getDescription(): string
{
$lng = $this->lng;

$lng->loadLanguageModule("book");
return $lng->txt("book_notification_info");
return $this->language->txt("book_notification_info");
}

public function getDefaultScheduleType(): JobScheduleType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,46 +18,34 @@

use ILIAS\Cron\Job\Schedule\JobScheduleType;
use ILIAS\Cron\Job\JobResult;
use ILIAS\Cron\CronJob;
use ILIAS\Cron\AbstractCronJob;

/**
* Cron for booking pools
* - Automatic booking for overdue pools with booking by preferences
*
* @author Alexander Killing <killing@leifos.de>
*/
class ilBookingPrefBookCron extends CronJob
class ilBookingPrefBookCron extends AbstractCronJob
{
protected ilLanguage $lng;

public function __construct()
public function getId(): string
{
global $DIC;

$this->lng = $DIC->language();
return "book_pref_book";
}

public function getId(): string
public function init(): void
{
return "book_pref_book";
$this->language->loadLanguageModule('book');
}

public function getTitle(): string
{
$lng = $this->lng;

$lng->loadLanguageModule("book");

return $lng->txt("book_pref_book_cron");
return $this->language->txt("book_pref_book_cron");
}

public function getDescription(): string
{
$lng = $this->lng;

$lng->loadLanguageModule("book");

return $lng->txt("book_pref_book_cron_info");
return $this->language->txt("book_pref_book_cron_info");
}

public function getDefaultScheduleType(): JobScheduleType
Expand Down
4 changes: 0 additions & 4 deletions components/ILIAS/BookingManager/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,5 @@
<web_access_checker>
<secure_path path="ilBookingManager" checking-class="ilObjBookingPoolAccess"/>
</web_access_checker>
<crons>
<cron id="book_notification" class="ilBookCronNotification" />
<cron id="book_pref_book" class="ilBookingPrefBookCron" />
</crons>
<logging />
</module>
6 changes: 6 additions & 0 deletions components/ILIAS/COPage/COPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,11 @@ public function getTarget(): string
}
};

$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
new \ilCleanCOPageHistoryCronjob(
self::class,
$use[\ILIAS\Language\Language::class],
$use[\ILIAS\Logging\LoggerFactory::class]
);
}
}
22 changes: 8 additions & 14 deletions components/ILIAS/COPage/Cron/class.ilCleanCOPageHistoryCronjob.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@
use ILIAS\COPage\History\HistoryManager;
use ILIAS\Cron\Job\Schedule\JobScheduleType;
use ILIAS\Cron\Job\JobResult;
use ILIAS\Cron\CronJob;
use ILIAS\Cron\AbstractCronJob;

/**
* @author Alexander Killing <killing@leifos.de>
*/
class ilCleanCOPageHistoryCronjob extends CronJob
class ilCleanCOPageHistoryCronjob extends AbstractCronJob
{
protected HistoryManager $history_manager;
protected ilSetting $settings;
protected ilLanguage $lng;

public function __construct()
public function init(): void
{
global $DIC;

$this->lng = $DIC->language();
$this->language->loadLanguageModule("copg");

$this->settings = $DIC->settings();
$this->history_manager = $DIC
->copage()
Expand All @@ -52,18 +52,12 @@ public function getId(): string

public function getTitle(): string
{
$lng = $this->lng;

$lng->loadLanguageModule("copg");
return $lng->txt("copg_history_cleanup_cron");
return $this->language->txt("copg_history_cleanup_cron");
}

public function getDescription(): string
{
$lng = $this->lng;

$lng->loadLanguageModule("copg");
return $lng->txt("copg_history_cleanup_cron_info");
return $this->language->txt("copg_history_cleanup_cron_info");
}

public function getDefaultScheduleType(): JobScheduleType
Expand Down Expand Up @@ -117,7 +111,7 @@ public function run(): JobResult

public function addCustomSettingsToForm(ilPropertyFormGUI $a_form): void
{
$lng = $this->lng;
$lng = $this->language;
$lng->loadLanguageModule("copg");

$ti = new ilNumberInputGUI(
Expand Down
3 changes: 0 additions & 3 deletions components/ILIAS/COPage/service.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@
<pageobject parent_type="stys" class_name="ilPageLayoutPage" directory="Layout/classes"/>
</copage>
<logging />
<crons>
<cron id="copg_history_cleanup" class="ilCleanCOPageHistoryCronjob" path="Services/COPage/Cron" />
</crons>
<objects>
<object id="adve" class_name="AdvancedEditing" dir="classes"
checkbox="0" inherit="0" translate="sys" rbac="1" system="1" administration="1">
Expand Down
13 changes: 13 additions & 0 deletions components/ILIAS/Calendar/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,18 @@ public function init(
$contribute[Component\Resource\PublicAsset::class] = fn() =>
new Component\Resource\NodeModule("eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js");
*/

$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
new \ilCalendarCronRemoteReader(
self::class,
$use[\ILIAS\Language\Language::class],
$use[\ILIAS\Logging\LoggerFactory::class]
);
$contribute[\ILIAS\Cron\CronJob::class] = static fn() =>
new \ilConsultationHourCron(
self::class,
$use[\ILIAS\Language\Language::class],
$use[\ILIAS\Logging\LoggerFactory::class]
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@

use ILIAS\Cron\Job\Schedule\JobScheduleType;
use ILIAS\Cron\Job\JobResult;
use ILIAS\Cron\CronJob;
use ILIAS\Cron\AbstractCronJob;

/**
* Reminders for consultation hours
* @author Stefan Meyer <smeyer.ilias@gmx.de>
*/
class ilConsultationHourCron extends CronJob
class ilConsultationHourCron extends AbstractCronJob
{
protected ilLanguage $lng;
protected ilDBInterface $db;
protected ilSetting $setting;

public function __construct()

public function init(): void
{
global $DIC;

$this->lng = $DIC->language();
$this->lng->loadLanguageModule('dateplaner');
$this->language->loadLanguageModule('dateplaner');

$this->db = $DIC->database();
$this->setting = $DIC->settings();
}
Expand All @@ -49,12 +49,12 @@ public function getId(): string

public function getTitle(): string
{
return $this->lng->txt("cal_ch_cron_reminder");
return $this->language->txt("cal_ch_cron_reminder");
}

public function getDescription(): string
{
return $this->lng->txt("cal_ch_cron_reminder_info");
return $this->language->txt("cal_ch_cron_reminder_info");
}

public function getDefaultScheduleType(): JobScheduleType
Expand Down Expand Up @@ -124,7 +124,7 @@ public function run(): JobResult

public function addCustomSettingsToForm(ilPropertyFormGUI $a_form): void
{
$consultation_days = new ilNumberInputGUI($this->lng->txt('cal_ch_cron_reminder_days'), 'ch_reminder_days');
$consultation_days = new ilNumberInputGUI($this->language->txt('cal_ch_cron_reminder_days'), 'ch_reminder_days');
$consultation_days->setMinValue(1);
$consultation_days->setMaxLength(2);
$consultation_days->setSize(2);
Expand Down
Loading
Loading