ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilUserCronCheckAccounts Class Reference
+ Inheritance diagram for ilUserCronCheckAccounts:
+ Collaboration diagram for ilUserCronCheckAccounts:

Public Member Functions

 getId ()
 Get id. More...
 
 getTitle ()
 Get title. More...
 
 getDescription ()
 Get description. More...
 
 getDefaultScheduleType ()
 Get schedule type. More...
 
 getDefaultScheduleValue ()
 Get schedule value. More...
 
 hasAutoActivation ()
 Is to be activated on "installation". More...
 
 hasFlexibleSchedule ()
 Can the schedule be configured? More...
 
 run ()
 Run job. More...
 
- Public Member Functions inherited from ilCronJob
 isActive ($a_ts_last_run, $a_schedule_type, $a_schedule_value, $a_manual=false)
 Is job currently active? More...
 
 getScheduleType ()
 Get current schedule type (if flexible) More...
 
 getScheduleValue ()
 Get current schedule value (if flexible) More...
 
 setSchedule ($a_type, $a_value)
 Update current schedule (if flexible) More...
 
 getValidScheduleTypes ()
 Get all available schedule types. More...
 
 getTitle ()
 Get title. More...
 
 getDescription ()
 Get description. More...
 
 isManuallyExecutable ()
 Defines whether or not a cron job can be started manually. More...
 
 hasCustomSettings ()
 Has cron job any custom setting which can be edited? More...
 
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 Add custom settings to form. More...
 
 saveCustomSettings (ilPropertyFormGUI $a_form)
 Save custom settings. More...
 
 addToExternalSettingsForm ($a_form_id, array &$a_fields, $a_is_active)
 Add external settings to form. More...
 
 activationWasToggled ($a_currently_active)
 Cron job status was changed. More...
 
 getId ()
 Get id. More...
 
 hasAutoActivation ()
 Is to be activated on "installation". More...
 
 hasFlexibleSchedule ()
 Can the schedule be configured? More...
 
 getDefaultScheduleType ()
 Get schedule type. More...
 
 getDefaultScheduleValue ()
 Get schedule value. More...
 
 run ()
 Run job. More...
 

Protected Member Functions

 txt ($language, $key, $module='common')
 
 checkNotConfirmedUserAccounts ()
 
- Protected Member Functions inherited from ilCronJob
 checkSchedule ($a_ts_last_run, $a_schedule_type, $a_schedule_value)
 

Protected Attributes

 $counter = 0
 

Additional Inherited Members

- Data Fields inherited from ilCronJob
const SCHEDULE_TYPE_DAILY = 1
 
const SCHEDULE_TYPE_IN_MINUTES = 2
 
const SCHEDULE_TYPE_IN_HOURS = 3
 
const SCHEDULE_TYPE_IN_DAYS = 4
 
const SCHEDULE_TYPE_WEEKLY = 5
 
const SCHEDULE_TYPE_MONTHLY = 6
 
const SCHEDULE_TYPE_QUARTERLY = 7
 
const SCHEDULE_TYPE_YEARLY = 8
 

Detailed Description

Definition at line 14 of file class.ilUserCronCheckAccounts.php.

Member Function Documentation

◆ checkNotConfirmedUserAccounts()

ilUserCronCheckAccounts::checkNotConfirmedUserAccounts ( )
protected

Definition at line 126 of file class.ilUserCronCheckAccounts.php.

127 {
128 global $ilDB, $ilLog;
129
130 require_once 'Services/Registration/classes/class.ilRegistrationSettings.php';
131 $oRegSettigs = new ilRegistrationSettings();
132
133 $query = 'SELECT usr_id FROM usr_data '
134 . 'WHERE reg_hash IS NOT NULL '
135 . 'AND active = %s '
136 . 'AND create_date < %s';
137 $res = $ilDB->queryF(
138 $query,
139 array('integer', 'timestamp'),
140 array(0, date('Y-m-d H:i:s', time() - (int)$oRegSettigs->getRegistrationHashLifetime()))
141 );
142 while($row = $ilDB->fetchAssoc($res))
143 {
144 $oUser = ilObjectFactory::getInstanceByObjId((int)$row['usr_id']);
145 $oUser->delete();
146 $ilLog->write('Cron: Deleted '.$oUser->getLogin().' ['.$oUser->getId().'] '.__METHOD__);
147
148 $this->counter++;
149 }
150 }
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Class ilObjAuthSettingsGUI.
global $ilDB

References $ilDB, $ilLog, $query, $res, $row, and ilObjectFactory\getInstanceByObjId().

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDefaultScheduleType()

ilUserCronCheckAccounts::getDefaultScheduleType ( )

Get schedule type.

Returns
int

Reimplemented from ilCronJob.

Definition at line 37 of file class.ilUserCronCheckAccounts.php.

38 {
40 }
const SCHEDULE_TYPE_DAILY

References ilCronJob\SCHEDULE_TYPE_DAILY.

◆ getDefaultScheduleValue()

ilUserCronCheckAccounts::getDefaultScheduleValue ( )

Get schedule value.

Returns
int|array

Reimplemented from ilCronJob.

Definition at line 42 of file class.ilUserCronCheckAccounts.php.

43 {
44 return;
45 }

◆ getDescription()

ilUserCronCheckAccounts::getDescription ( )

Get description.

Returns
string

Reimplemented from ilCronJob.

Definition at line 30 of file class.ilUserCronCheckAccounts.php.

31 {
32 global $lng;
33
34 return $lng->txt("check_user_accounts_desc");
35 }
global $lng
Definition: privfeed.php:40

References $lng.

◆ getId()

ilUserCronCheckAccounts::getId ( )

Get id.

Returns
string

Reimplemented from ilCronJob.

Definition at line 18 of file class.ilUserCronCheckAccounts.php.

19 {
20 return "user_check_accounts";
21 }

◆ getTitle()

ilUserCronCheckAccounts::getTitle ( )

Get title.

Returns
string

Reimplemented from ilCronJob.

Definition at line 23 of file class.ilUserCronCheckAccounts.php.

24 {
25 global $lng;
26
27 return $lng->txt("check_user_accounts");
28 }

References $lng.

◆ hasAutoActivation()

ilUserCronCheckAccounts::hasAutoActivation ( )

Is to be activated on "installation".

Returns
boolean

Reimplemented from ilCronJob.

Definition at line 47 of file class.ilUserCronCheckAccounts.php.

48 {
49 return false;
50 }

◆ hasFlexibleSchedule()

ilUserCronCheckAccounts::hasFlexibleSchedule ( )

Can the schedule be configured?

Returns
boolean

Reimplemented from ilCronJob.

Definition at line 52 of file class.ilUserCronCheckAccounts.php.

53 {
54 return false;
55 }

◆ run()

ilUserCronCheckAccounts::run ( )

Run job.

Returns
ilCronJobResult

Reimplemented from ilCronJob.

Definition at line 57 of file class.ilUserCronCheckAccounts.php.

58 {
59 global $ilDB, $ilLog, $lng;
60
62
63 $now = time();
64 $two_weeks_in_seconds = $now + (60 * 60 * 24 * 14); // #14630
65
66 // all users who are currently active and expire in the next 2 weeks
67 $query = "SELECT * FROM usr_data,usr_pref ".
68 "WHERE time_limit_message = '0' ".
69 "AND time_limit_unlimited = '0' ".
70 "AND time_limit_from < ".$ilDB->quote($now, "integer")." ".
71 "AND time_limit_until > ".$ilDB->quote($now, "integer")." ".
72 "AND time_limit_until < ".$ilDB->quote($two_weeks_in_seconds, "integer")." ".
73 "AND usr_data.usr_id = usr_pref.usr_id ".
74 "AND keyword = ".$ilDB->quote("language", "text");
75
76 $res = $ilDB->query($query);
77
78 while($row = $ilDB->fetchObject($res))
79 {
80 include_once 'Services/Mail/classes/class.ilMimeMail.php';
81
82 $data['expires'] = $row->time_limit_until;
83 $data['email'] = $row->email;
84 $data['login'] = $row->login;
85 $data['usr_id'] = $row->usr_id;
86 $data['language'] = $row->value;
87 $data['owner'] = $row->time_limit_owner;
88
89 // Send mail
90 $mail =& new ilMimeMail();
91
92 $mail->From('noreply');
93 $mail->To($data['email']);
94 $mail->Subject($this->txt($data['language'],'account_expires_subject'), true);
95 $mail->Body($this->txt($data['language'],'account_expires_body')." ".strftime('%Y-%m-%d %R',$data['expires']));
96 $mail->send();
97
98 // set status 'mail sent'
99 $query = "UPDATE usr_data SET time_limit_message = '1' WHERE usr_id = '".$data['usr_id']."'";
100 $ilDB->query($query);
101
102 // Send log message
103 $ilLog->write('Cron: (checkUserAccounts()) sent message to '.$data['login'].'.');
104
105 $this->counter++;
106 }
107
109
110 if($this->counter)
111 {
113 }
114 $result = new ilCronJobResult();
115 $result->setStatus($status);
116 return $result;
117 }
$result
Cron job result data container.
this class encapsulates the PHP mail() function.
txt($language, $key, $module='common')
$data

References $data, $ilDB, $ilLog, $lng, $query, $res, $result, $row, checkNotConfirmedUserAccounts(), ilCronJobResult\STATUS_NO_ACTION, ilCronJobResult\STATUS_OK, and txt().

+ Here is the call graph for this function:

◆ txt()

ilUserCronCheckAccounts::txt (   $language,
  $key,
  $module = 'common' 
)
protected

Definition at line 120 of file class.ilUserCronCheckAccounts.php.

121 {
122 include_once 'Services/Language/classes/class.ilLanguage.php';
123 return ilLanguage::_lookupEntry($language, $module, $key);
124 }
static _lookupEntry($a_lang_key, $a_mod, $a_id)

References ilLanguage\_lookupEntry().

Referenced by run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $counter

ilUserCronCheckAccounts::$counter = 0
protected

Definition at line 16 of file class.ilUserCronCheckAccounts.php.


The documentation for this class was generated from the following file: