ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilUserCronCheckAccounts Class Reference
+ Inheritance diagram for ilUserCronCheckAccounts:
+ Collaboration diagram for ilUserCronCheckAccounts:

Public Member Functions

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

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

ilUserCronCheckAccounts::checkNotConfirmedUserAccounts ( )
protected

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

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

Referenced by run().

{
global $ilDB, $ilLog;
require_once 'Services/Registration/classes/class.ilRegistrationSettings.php';
$oRegSettigs = new ilRegistrationSettings();
$query = 'SELECT usr_id FROM usr_data '
. 'WHERE reg_hash IS NOT NULL '
. 'AND active = %s '
. 'AND create_date < %s';
$res = $ilDB->queryF(
array('integer', 'timestamp'),
array(0, date('Y-m-d H:i:s', time() - (int)$oRegSettigs->getRegistrationHashLifetime()))
);
while($row = $ilDB->fetchAssoc($res))
{
$oUser = ilObjectFactory::getInstanceByObjId((int)$row['usr_id']);
$oUser->delete();
$ilLog->write('Cron: Deleted '.$oUser->getLogin().' ['.$oUser->getId().'] '.__METHOD__);
$this->counter++;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilUserCronCheckAccounts::getDefaultScheduleType ( )

Get schedule type.

Returns
int

Reimplemented from ilCronJob.

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

References ilCronJob\SCHEDULE_TYPE_DAILY.

ilUserCronCheckAccounts::getDefaultScheduleValue ( )

Get schedule value.

Returns
int|array

Reimplemented from ilCronJob.

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

{
return;
}
ilUserCronCheckAccounts::getDescription ( )

Get description.

Returns
string

Reimplemented from ilCronJob.

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

References $lng.

{
global $lng;
return $lng->txt("check_user_accounts_desc");
}
ilUserCronCheckAccounts::getId ( )

Get id.

Returns
string

Reimplemented from ilCronJob.

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

{
return "user_check_accounts";
}
ilUserCronCheckAccounts::getTitle ( )

Get title.

Returns
string

Reimplemented from ilCronJob.

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

References $lng.

{
global $lng;
return $lng->txt("check_user_accounts");
}
ilUserCronCheckAccounts::hasAutoActivation ( )

Is to be activated on "installation".

Returns
boolean

Reimplemented from ilCronJob.

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

{
return false;
}
ilUserCronCheckAccounts::hasFlexibleSchedule ( )

Can the schedule be configured?

Returns
boolean

Reimplemented from ilCronJob.

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

{
return false;
}
ilUserCronCheckAccounts::run ( )

Run job.

Returns
ilCronJobResult

Reimplemented from ilCronJob.

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

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

{
global $ilDB, $ilLog, $lng;
$now = time();
$two_weeks_in_seconds = $now + (60 * 60 * 24 * 14); // #14630
// all users who are currently active and expire in the next 2 weeks
$query = "SELECT * FROM usr_data,usr_pref ".
"WHERE time_limit_message = '0' ".
"AND time_limit_unlimited = '0' ".
"AND time_limit_from < ".$ilDB->quote($now, "integer")." ".
"AND time_limit_until > ".$ilDB->quote($now, "integer")." ".
"AND time_limit_until < ".$ilDB->quote($two_weeks_in_seconds, "integer")." ".
"AND usr_data.usr_id = usr_pref.usr_id ".
"AND keyword = ".$ilDB->quote("language", "text");
$res = $ilDB->query($query);
while($row = $ilDB->fetchObject($res))
{
include_once 'Services/Mail/classes/class.ilMimeMail.php';
$data['expires'] = $row->time_limit_until;
$data['email'] = $row->email;
$data['login'] = $row->login;
$data['usr_id'] = $row->usr_id;
$data['language'] = $row->value;
$data['owner'] = $row->time_limit_owner;
// Send mail
$mail =& new ilMimeMail();
$mail->From('noreply');
$mail->To($data['email']);
$mail->Subject($this->txt($data['language'],'account_expires_subject'), true);
$mail->Body($this->txt($data['language'],'account_expires_body')." ".strftime('%Y-%m-%d %R',$data['expires']));
$mail->send();
// set status 'mail sent'
$query = "UPDATE usr_data SET time_limit_message = '1' WHERE usr_id = '".$data['usr_id']."'";
$ilDB->query($query);
// Send log message
$ilLog->write('Cron: (checkUserAccounts()) sent message to '.$data['login'].'.');
$this->counter++;
}
if($this->counter)
{
}
$result->setStatus($status);
return $result;
}

+ Here is the call graph for this function:

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

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

References ilLanguage\_lookupEntry().

Referenced by run().

{
include_once 'Services/Language/classes/class.ilLanguage.php';
return ilLanguage::_lookupEntry($language, $module, $key);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilUserCronCheckAccounts::$counter = 0
protected

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


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