ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCronDeleteInactiveUserAccounts Class Reference
+ Collaboration diagram for ilCronDeleteInactiveUserAccounts:

Public Member Functions

 __construct ()
 run ()

Static Public Member Functions

static getPossibleIntervalsArray ()
static getDefaultIntervalKey ()

Data Fields

const INTERVAL_DAILY = '1'
const INTERVAL_WEEKLY = '2'
const INTERVAL_MONTHLY = '3'
const INTERVAL_QUARTERLY = '4'
const DEFAULT_INACTIVITY_PERIOD = 365

Private Member Functions

 getCurrentIntervalPeriod ()

Private Attributes

 $interval = null
 $include_roles = null
 $inactivity_period = null
 $enabled = false

Detailed Description

Definition at line 34 of file class.ilCronDeleteInactiveUserAccounts.php.

Constructor & Destructor Documentation

ilCronDeleteInactiveUserAccounts::__construct ( )

Definition at line 51 of file class.ilCronDeleteInactiveUserAccounts.php.

References $ilSetting, and getCurrentIntervalPeriod().

{
global $ilSetting;
$this->interval = $ilSetting->get(
'cron_inactive_user_delete_interval',
self::getDefaultIntervalKey()
);
$this->include_roles = $ilSetting->get(
'cron_inactive_user_delete_include_roles', null
);
if($this->include_roles === null) $this->include_roles = array();
else $this->include_roles = explode(',', $this->include_roles);
$this->inactivity_period = $ilSetting->get(
'cron_inactive_user_delete_period',
self::DEFAULT_INACTIVITY_PERIOD
);
$last_run = (int)$ilSetting->get('cron_inactive_user_delete_last_run', 0);
if( !$last_run || (time() - $last_run) > $this->getCurrentIntervalPeriod() )
{
$this->enabled = true;
$ilSetting->set('cron_inactive_user_delete_last_run', time());
}
}

+ Here is the call graph for this function:

Member Function Documentation

ilCronDeleteInactiveUserAccounts::getCurrentIntervalPeriod ( )
private

Definition at line 110 of file class.ilCronDeleteInactiveUserAccounts.php.

Referenced by __construct().

{
$period = 60 * 60;
switch( $this->interval )
{
case self::INTERVAL_QUARTERLY: $period *= 3;
case self::INTERVAL_MONTHLY: $period *= 30;
case self::INTERVAL_WEEKLY: $period *= 7;
case self::INTERVAL_DAILY: $period *= 24;
}
return $period;
}

+ Here is the caller graph for this function:

static ilCronDeleteInactiveUserAccounts::getDefaultIntervalKey ( )
static

Definition at line 137 of file class.ilCronDeleteInactiveUserAccounts.php.

References INTERVAL_DAILY.

Referenced by ilObjSystemFolderGUI\initCronJobsForm().

{
}

+ Here is the caller graph for this function:

static ilCronDeleteInactiveUserAccounts::getPossibleIntervalsArray ( )
static

Definition at line 125 of file class.ilCronDeleteInactiveUserAccounts.php.

References $lng.

Referenced by ilObjSystemFolderGUI\initCronJobsForm().

{
global $lng;
return array(
self::INTERVAL_DAILY => $lng->txt("daily"),
self::INTERVAL_WEEKLY => $lng->txt("weekly"),
self::INTERVAL_MONTHLY => $lng->txt("monthly"),
self::INTERVAL_QUARTERLY => $lng->txt("quarterly")
);
}

+ Here is the caller graph for this function:

ilCronDeleteInactiveUserAccounts::run ( )

Definition at line 81 of file class.ilCronDeleteInactiveUserAccounts.php.

References $usr_id, ilObjUser\_getUserIdsByInactivityPeriod(), and ilObjectFactory\getInstanceByObjId().

{
if( !$this->enabled ) return;
global $rbacreview;
$usr_ids = ilObjUser::_getUserIdsByInactivityPeriod($this->inactivity_period);
foreach($usr_ids as $usr_id)
{
if($usr_id == ANONYMOUS_USER_ID || $usr_id == SYSTEM_USER_ID) continue;
$continue = true;
foreach($this->include_roles as $role_id)
{
if( $rbacreview->isAssigned($usr_id, $role_id) )
{
$continue = false;
break;
}
}
if($continue) continue;
$user->delete();
}
}

+ Here is the call graph for this function:

Field Documentation

ilCronDeleteInactiveUserAccounts::$enabled = false
private

Definition at line 49 of file class.ilCronDeleteInactiveUserAccounts.php.

ilCronDeleteInactiveUserAccounts::$inactivity_period = null
private

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

ilCronDeleteInactiveUserAccounts::$include_roles = null
private

Definition at line 45 of file class.ilCronDeleteInactiveUserAccounts.php.

ilCronDeleteInactiveUserAccounts::$interval = null
private

Definition at line 43 of file class.ilCronDeleteInactiveUserAccounts.php.

const ilCronDeleteInactiveUserAccounts::DEFAULT_INACTIVITY_PERIOD = 365
const ilCronDeleteInactiveUserAccounts::INTERVAL_DAILY = '1'

Definition at line 36 of file class.ilCronDeleteInactiveUserAccounts.php.

Referenced by getDefaultIntervalKey().

const ilCronDeleteInactiveUserAccounts::INTERVAL_MONTHLY = '3'

Definition at line 38 of file class.ilCronDeleteInactiveUserAccounts.php.

const ilCronDeleteInactiveUserAccounts::INTERVAL_QUARTERLY = '4'

Definition at line 39 of file class.ilCronDeleteInactiveUserAccounts.php.

const ilCronDeleteInactiveUserAccounts::INTERVAL_WEEKLY = '2'

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


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