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

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.
 __getCheckPeriod ()
 activationWasToggled ($a_currently_active)
 Cron job status was changed.
- 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.

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
- Protected Member Functions inherited from ilCronJob
 checkSchedule ($a_ts_last_run, $a_schedule_type, $a_schedule_value)

Detailed Description

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

Member Function Documentation

ilWebResourceCronLinkCheck::__getCheckPeriod ( )

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

References ilCronJob\getScheduleType().

Referenced by run().

{
switch($this->getScheduleType())
{
case self::SCHEDULE_TYPE_DAILY:
$period = 24 * 60 * 60;
break;
case self::SCHEDULE_TYPE_WEEKLY:
$period = 7 * 24 * 60 * 60;
break;
case self::SCHEDULE_TYPE_MONTHLY:
$period = 30 * 7 * 24 * 60 * 60;
break;
case self::SCHEDULE_TYPE_QUARTERLY:
$period = 3 * 30 * 7 * 24 * 60 * 60;
break;
default:
$period = 0;
}
return $period;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilWebResourceCronLinkCheck::activationWasToggled (   $a_currently_active)

Cron job status was changed.

Parameters
bool$a_currently_active

Reimplemented from ilCronJob.

Definition at line 136 of file class.ilWebResourceCronLinkCheck.php.

References $ilSetting.

{
global $ilSetting;
// propagate cron-job setting to object setting
$ilSetting->set("cron_web_resource_check", (bool)$a_currently_active);
}
ilWebResourceCronLinkCheck::getDefaultScheduleType ( )

Get schedule type.

Returns
int

Reimplemented from ilCronJob.

Definition at line 35 of file class.ilWebResourceCronLinkCheck.php.

References ilCronJob\SCHEDULE_TYPE_DAILY.

ilWebResourceCronLinkCheck::getDefaultScheduleValue ( )

Get schedule value.

Returns
int|array

Reimplemented from ilCronJob.

Definition at line 40 of file class.ilWebResourceCronLinkCheck.php.

{
return;
}
ilWebResourceCronLinkCheck::getDescription ( )

Get description.

Returns
string

Reimplemented from ilCronJob.

Definition at line 28 of file class.ilWebResourceCronLinkCheck.php.

References $lng.

{
global $lng;
return $lng->txt("check_web_resources_desc");
}
ilWebResourceCronLinkCheck::getId ( )

Get id.

Returns
string

Reimplemented from ilCronJob.

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

{
return "webr_link_check";
}
ilWebResourceCronLinkCheck::getTitle ( )

Get title.

Returns
string

Reimplemented from ilCronJob.

Definition at line 21 of file class.ilWebResourceCronLinkCheck.php.

References $lng.

{
global $lng;
return $lng->txt("check_web_resources");
}
ilWebResourceCronLinkCheck::hasAutoActivation ( )

Is to be activated on "installation".

Returns
boolean

Reimplemented from ilCronJob.

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

{
return false;
}
ilWebResourceCronLinkCheck::hasFlexibleSchedule ( )

Can the schedule be configured?

Returns
boolean

Reimplemented from ilCronJob.

Definition at line 50 of file class.ilWebResourceCronLinkCheck.php.

{
return true;
}
ilWebResourceCronLinkCheck::run ( )

Run job.

Returns
ilCronJobResult

Reimplemented from ilCronJob.

Definition at line 55 of file class.ilWebResourceCronLinkCheck.php.

References $ilDB, $ilLog, $ilUser, $result, __getCheckPeriod(), ilUtil\_getObjectsByOperations(), ilObjectFactory\getInstanceByRefId(), ilCronJobResult\STATUS_NO_ACTION, and ilCronJobResult\STATUS_OK.

{
global $ilLog, $ilUser, $ilDB;
include_once'./Services/LinkChecker/classes/class.ilLinkChecker.php';
$counter = 0;
foreach(ilUtil::_getObjectsByOperations('webr','write',$ilUser->getId(),-1) as $node)
{
if(!is_object($tmp_webr = ilObjectFactory::getInstanceByRefId($node,false)))
{
continue;
}
$tmp_webr->initLinkResourceItemsObject();
// Set all link to valid. After check invalid links will be set to invalid
$link_checker =& new ilLinkChecker($ilDB);
$link_checker->setMailStatus(true);
$link_checker->setCheckPeriod($this->__getCheckPeriod());
$link_checker->setObjId($tmp_webr->getId());
$tmp_webr->items_obj->updateValidByCheck($this->__getCheckPeriod());
foreach($link_checker->checkWebResourceLinks() as $invalid)
{
$tmp_webr->items_obj->readItem($invalid['page_id']);
$tmp_webr->items_obj->setActiveStatus(false);
$tmp_webr->items_obj->setValidStatus(false);
$tmp_webr->items_obj->setDisableCheckStatus(true);
$tmp_webr->items_obj->setLastCheckDate(time());
$tmp_webr->items_obj->update(false);
}
$tmp_webr->items_obj->updateLastCheck($this->__getCheckPeriod());
foreach($link_checker->getLogMessages() as $message)
{
$ilLog->write($message);
$counter++;
}
}
if($counter)
{
}
$result->setStatus($status);
return $result;
}

+ Here is the call graph for this function:


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