ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilWebResourceCronLinkCheck Class Reference
+ Inheritance diagram for ilWebResourceCronLinkCheck:
+ Collaboration diagram for ilWebResourceCronLinkCheck:

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...
 
 __getCheckPeriod ()
 
 activationWasToggled ($a_currently_active)
 Cron job status was changed. 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...
 
 getAllScheduleTypes ()
 Get all available schedule types. More...
 
 getScheduleTypesWithValues ()
 
 getValidScheduleTypes ()
 Returns a collection of all valid schedule types for a specific job. 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...
 

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

◆ __getCheckPeriod()

ilWebResourceCronLinkCheck::__getCheckPeriod ( )

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

114 {
115 switch ($this->getScheduleType()) {
117 $period = 24 * 60 * 60;
118 break;
119
121 $period = 7 * 24 * 60 * 60;
122 break;
123
125 $period = 30 * 7 * 24 * 60 * 60;
126 break;
127
129 $period = 3 * 30 * 7 * 24 * 60 * 60;
130 break;
131
132 default:
133 $period = 0;
134 }
135 return $period;
136 }
getScheduleType()
Get current schedule type (if flexible)
const SCHEDULE_TYPE_WEEKLY
const SCHEDULE_TYPE_DAILY
const SCHEDULE_TYPE_QUARTERLY
const SCHEDULE_TYPE_MONTHLY

References ilCronJob\getScheduleType(), ilCronJob\SCHEDULE_TYPE_DAILY, ilCronJob\SCHEDULE_TYPE_MONTHLY, ilCronJob\SCHEDULE_TYPE_QUARTERLY, and ilCronJob\SCHEDULE_TYPE_WEEKLY.

Referenced by run().

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

◆ activationWasToggled()

ilWebResourceCronLinkCheck::activationWasToggled (   $a_currently_active)

Cron job status was changed.

Parameters
bool$a_currently_active

Reimplemented from ilCronJob.

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

139 {
140 global $DIC;
141
142 $ilSetting = $DIC['ilSetting'];
143
144 // propagate cron-job setting to object setting
145 $ilSetting->set("cron_web_resource_check", (bool) $a_currently_active);
146 }
global $ilSetting
Definition: privfeed.php:17
global $DIC
Definition: saml.php:7

References $DIC, and $ilSetting.

◆ getDefaultScheduleType()

ilWebResourceCronLinkCheck::getDefaultScheduleType ( )

Get schedule type.

Returns
int

Reimplemented from ilCronJob.

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

40 {
42 }

References ilCronJob\SCHEDULE_TYPE_DAILY.

◆ getDefaultScheduleValue()

ilWebResourceCronLinkCheck::getDefaultScheduleValue ( )

Get schedule value.

Returns
int|array

Reimplemented from ilCronJob.

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

45 {
46 return;
47 }

◆ getDescription()

ilWebResourceCronLinkCheck::getDescription ( )

Get description.

Returns
string

Reimplemented from ilCronJob.

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

31 {
32 global $DIC;
33
34 $lng = $DIC['lng'];
35
36 return $lng->txt("check_web_resources_desc");
37 }
$lng

References $DIC, and $lng.

◆ getId()

ilWebResourceCronLinkCheck::getId ( )

Get id.

Returns
string

Reimplemented from ilCronJob.

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

17 {
18 return "webr_link_check";
19 }

◆ getTitle()

ilWebResourceCronLinkCheck::getTitle ( )

Get title.

Returns
string

Reimplemented from ilCronJob.

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

22 {
23 global $DIC;
24
25 $lng = $DIC['lng'];
26
27 return $lng->txt("check_web_resources");
28 }

References $DIC, and $lng.

◆ hasAutoActivation()

ilWebResourceCronLinkCheck::hasAutoActivation ( )

Is to be activated on "installation".

Returns
boolean

Reimplemented from ilCronJob.

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

50 {
51 return false;
52 }

◆ hasFlexibleSchedule()

ilWebResourceCronLinkCheck::hasFlexibleSchedule ( )

Can the schedule be configured?

Returns
boolean

Reimplemented from ilCronJob.

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

55 {
56 return true;
57 }

◆ run()

ilWebResourceCronLinkCheck::run ( )

Run job.

Returns
ilCronJobResult

Reimplemented from ilCronJob.

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

60 {
61 global $DIC;
62
63 $ilLog = $DIC->logger()->webr();
64 $ilUser = $DIC['ilUser'];
65 $ilDB = $DIC['ilDB'];
66
68
69 include_once'./Services/LinkChecker/classes/class.ilLinkChecker.php';
70
71 $counter = 0;
72 foreach (ilUtil::_getObjectsByOperations('webr', 'write', $ilUser->getId(), -1) as $node) {
73 if (!is_object($tmp_webr = ilObjectFactory::getInstanceByRefId($node, false))) {
74 continue;
75 }
76
77 $tmp_webr->initLinkResourceItemsObject();
78
79 // Set all link to valid. After check invalid links will be set to invalid
80
81 $link_checker = new ilLinkChecker($ilDB);
82 $link_checker->setMailStatus(true);
83 $link_checker->setCheckPeriod($this->__getCheckPeriod());
84 $link_checker->setObjId($tmp_webr->getId());
85
86
87 $tmp_webr->items_obj->updateValidByCheck($this->__getCheckPeriod());
88 foreach ($link_checker->checkWebResourceLinks() as $invalid) {
89 $tmp_webr->items_obj->readItem($invalid['page_id']);
90 $tmp_webr->items_obj->setActiveStatus(false);
91 $tmp_webr->items_obj->setValidStatus(false);
92 $tmp_webr->items_obj->setDisableCheckStatus(true);
93 $tmp_webr->items_obj->setLastCheckDate(time());
94 $tmp_webr->items_obj->update(false);
95 }
96
97 $tmp_webr->items_obj->updateLastCheck($this->__getCheckPeriod());
98
99 foreach ($link_checker->getLogMessages() as $message) {
100 $ilLog->debug($message);
101 $counter++;
102 }
103 }
104
105 if ($counter) {
107 }
108 $result = new ilCronJobResult();
109 $result->setStatus($status);
110 return $result;
111 }
$result
Cron job result data container.
class for checking external links in page objects Normally used in Cron jobs, but should be extensibl...
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _getObjectsByOperations($a_obj_type, $a_operation, $a_usr_id=0, $limit=0)
Get all objects of a specific type and check access This function is not recursive,...
catch(Exception $e) $message
global $ilDB
$ilUser
Definition: imgupload.php:18

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

+ Here is the call graph for this function:

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