38 if (isset($DIC[
'ilDB'])) {
39 $this->db = $DIC[
'ilDB'];
42 if (isset($DIC[
'lng'])) {
43 $this->
lng = $DIC[
'lng'];
46 if (isset($DIC[
'ilDB'])) {
47 $this->log = $DIC[
'ilLog'];
53 return "user_check_accounts";
58 return $this->
lng->txt(
"check_user_accounts");
63 return $this->
lng->txt(
"check_user_accounts_desc");
68 return CronJobScheduleType::SCHEDULE_TYPE_DAILY;
91 $two_weeks_in_seconds = $now + (60 * 60 * 24 * 14);
94 $query =
"SELECT usr_id, login, time_limit_until " .
96 "WHERE time_limit_message = '0' " .
97 "AND time_limit_unlimited = '0' " .
98 "AND time_limit_from < " . $this->db->quote($now,
"integer") .
" " .
99 "AND time_limit_until > " . $this->db->quote($now,
"integer") .
" " .
100 "AND time_limit_until < " . $this->db->quote($two_weeks_in_seconds,
"integer");
102 $res = $this->db->query($query);
104 while ($row = $this->db->fetchObject(
$res)) {
105 $expires = $row->time_limit_until;
106 $login = $row->login;
107 $usr_id = $row->usr_id;
114 $body = $salutation .
"\n\n";
116 $lng->
txt(
'account_expires_body'),
119 date(
'Y-m-d H:i', $expires)
130 $lng->
txt(
'account_expires_subject'),
136 $query =
"UPDATE usr_data SET time_limit_message = '1' WHERE usr_id = '" . $usr_id .
"'";
137 $this->db->query($query);
140 $this->log->write(
'Cron: (checkUserAccounts()) sent message to ' . $login .
'.');
147 if ($this->counter) {
151 $result->setStatus($status);
159 string $module =
'common' 168 $query =
'SELECT usr_id FROM usr_data ' 169 .
'WHERE (reg_hash IS NOT NULL AND reg_hash != %s)' 171 .
'AND create_date < %s';
172 $res = $this->db->queryF(
174 [
'text',
'integer',
'timestamp'],
175 [
'', 0, date(
'Y-m-d H:i:s', time() - $registration_settings->getRegistrationHashLifetime())]
177 while ($row = $this->db->fetchAssoc(
$res)) {
180 $this->log->write(
'Cron: Deleted ' . $user->getLogin() .
' [' . $user->getId() .
'] ' . __METHOD__);
txt(string $language, string $key, string $module='common')
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
Component logger with individual log levels by component id.
loadLanguageModule(string $a_module)
Load language module.
checkNotConfirmedUserAccounts()
static _getLanguageOfUser(int $a_usr_id)
Get language object of user.
final const STATUS_NO_ACTION
static getSalutation(int $a_usr_id, ?ilLanguage $a_language=null)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
Class ilObjAuthSettingsGUI.
This cron send notifications about expiring user accounts.
static _getAutoGeneratedMessageString(ilLanguage $lang=null)
static _lookupEntry(string $a_lang_key, string $a_mod, string $a_id)
static _lookupEmail(int $a_user_id)
getDefaultScheduleValue()