ILIAS  release_8 Revision v8.24
ilCleanCOPageHistoryCronjob Class Reference
+ Inheritance diagram for ilCleanCOPageHistoryCronjob:
+ Collaboration diagram for ilCleanCOPageHistoryCronjob:

Public Member Functions

 __construct ()
 
 getId ()
 
 getTitle ()
 
 getDescription ()
 
 getDefaultScheduleType ()
 
 getDefaultScheduleValue ()
 
 hasAutoActivation ()
 Is to be activated on "installation", does only work for ILIAS core cron jobs. More...
 
 hasFlexibleSchedule ()
 
 hasCustomSettings ()
 
 run ()
 
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 
 saveCustomSettings (ilPropertyFormGUI $a_form)
 
- Public Member Functions inherited from ilCronJob
 setDateTimeProvider (?Closure $date_time_provider)
 
 isDue (?DateTimeImmutable $last_run, ?int $schedule_type, ?int $schedule_value, bool $is_manually_executed=false)
 
 getScheduleType ()
 Get current schedule type (if flexible) More...
 
 getScheduleValue ()
 Get current schedule value (if flexible) More...
 
 setSchedule (?int $a_type, ?int $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...
 
 isManuallyExecutable ()
 
 hasCustomSettings ()
 
 addCustomSettingsToForm (ilPropertyFormGUI $a_form)
 
 saveCustomSettings (ilPropertyFormGUI $a_form)
 
 addToExternalSettingsForm (int $a_form_id, array &$a_fields, bool $a_is_active)
 
 activationWasToggled (ilDBInterface $db, ilSetting $setting, bool $a_currently_active)
 Important: This method is (also) called from the setup process, where the constructor of an ilCronJob ist NOT executed. More...
 
 getId ()
 
 getTitle ()
 
 getDescription ()
 
 hasAutoActivation ()
 Is to be activated on "installation", does only work for ILIAS core cron jobs. More...
 
 hasFlexibleSchedule ()
 
 getDefaultScheduleType ()
 
 getDefaultScheduleValue ()
 
 run ()
 

Protected Member Functions

 getCronDays ()
 
 setCronDays (int $days)
 
 getKeepEntries ()
 
 setKeepEntries (int $entries)
 

Protected Attributes

HistoryManager $history_manager
 
ilSetting $settings
 
ilLanguage $lng
 
- Protected Attributes inherited from ilCronJob
int $schedule_type = null
 
int $schedule_value = null
 
Closure $date_time_provider = null
 

Additional Inherited Members

- Data Fields inherited from ilCronJob
const SCHEDULE_TYPE_DAILY = 1
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_IN_MINUTES = 2
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_IN_HOURS = 3
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_IN_DAYS = 4
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_WEEKLY = 5
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_MONTHLY = 6
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_QUARTERLY = 7
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 
const SCHEDULE_TYPE_YEARLY = 8
 @depracated This will be replaced with an ENUM in ILIAS 9 More...
 

Detailed Description

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 26 of file class.ilCleanCOPageHistoryCronjob.php.

Constructor & Destructor Documentation

◆ __construct()

ilCleanCOPageHistoryCronjob::__construct ( )

Definition at line 32 of file class.ilCleanCOPageHistoryCronjob.php.

33 {
34 global $DIC;
35
36 $this->lng = $DIC->language();
37 $this->settings = $DIC->settings();
38 $this->history_manager = $DIC
39 ->copage()
40 ->internal()
41 ->domain()
42 ->history();
43 }
global $DIC
Definition: feed.php:28

References $DIC, ILIAS\Repository\lng(), and ILIAS\Repository\settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ addCustomSettingsToForm()

ilCleanCOPageHistoryCronjob::addCustomSettingsToForm ( ilPropertyFormGUI  $a_form)

Reimplemented from ilCronJob.

Definition at line 115 of file class.ilCleanCOPageHistoryCronjob.php.

115 : void
116 {
118 $lng->loadLanguageModule("copg");
119
120 $ti = new ilNumberInputGUI(
121 $lng->txt("copg_cron_days"),
122 "copg_cron_days"
123 );
124 $ti->setSize(6);
125 $ti->setSuffix($lng->txt("copg_days"));
126 $ti->setInfo($lng->txt("copg_cron_days_info"));
127 $ti->setValue((string) $this->getCronDays());
128 $a_form->addItem($ti);
129
130 $ti = new ilNumberInputGUI($lng->txt("copg_cron_keep_entries"), "copg_cron_keep_entries");
131 $ti->setSize(6);
132 $ti->setSuffix($lng->txt("copg_entries"));
133 $ti->setInfo($lng->txt("copg_cron_keep_entries_info"));
134 $ti->setValue((string) $this->getKeepEntries());
135 $a_form->addItem($ti);
136 }
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This class represents a number property in a property form.

References $lng, ilPropertyFormGUI\addItem(), getCronDays(), getKeepEntries(), ilLanguage\loadLanguageModule(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ getCronDays()

ilCleanCOPageHistoryCronjob::getCronDays ( )
protected

Definition at line 146 of file class.ilCleanCOPageHistoryCronjob.php.

146 : int
147 {
149 return (int) $settings->get("copg_cron_days", "3600");
150 }
get(string $a_keyword, ?string $a_default_value=null)
get setting

References $settings, and ilSetting\get().

Referenced by addCustomSettingsToForm(), and run().

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

◆ getDefaultScheduleType()

ilCleanCOPageHistoryCronjob::getDefaultScheduleType ( )

Reimplemented from ilCronJob.

Definition at line 66 of file class.ilCleanCOPageHistoryCronjob.php.

66 : int
67 {
69 }
const SCHEDULE_TYPE_DAILY
@depracated This will be replaced with an ENUM in ILIAS 9

References ilCronJob\SCHEDULE_TYPE_DAILY.

◆ getDefaultScheduleValue()

ilCleanCOPageHistoryCronjob::getDefaultScheduleValue ( )

Reimplemented from ilCronJob.

Definition at line 71 of file class.ilCleanCOPageHistoryCronjob.php.

71 : ?int
72 {
73 return null;
74 }

◆ getDescription()

ilCleanCOPageHistoryCronjob::getDescription ( )

Reimplemented from ilCronJob.

Definition at line 58 of file class.ilCleanCOPageHistoryCronjob.php.

58 : string
59 {
61
62 $lng->loadLanguageModule("copg");
63 return $lng->txt("copg_history_cleanup_cron_info");
64 }

References $lng, ilLanguage\loadLanguageModule(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ getId()

ilCleanCOPageHistoryCronjob::getId ( )

Reimplemented from ilCronJob.

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

45 : string
46 {
47 return "copg_history_cleanup";
48 }

◆ getKeepEntries()

ilCleanCOPageHistoryCronjob::getKeepEntries ( )
protected

Definition at line 158 of file class.ilCleanCOPageHistoryCronjob.php.

158 : int
159 {
161 return (int) $settings->get("copg_cron_keep_entries", "1000");
162 }

References $settings, and ilSetting\get().

Referenced by addCustomSettingsToForm(), and run().

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

◆ getTitle()

ilCleanCOPageHistoryCronjob::getTitle ( )

Reimplemented from ilCronJob.

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

50 : string
51 {
53
54 $lng->loadLanguageModule("copg");
55 return $lng->txt("copg_history_cleanup_cron");
56 }

References $lng, ilLanguage\loadLanguageModule(), and ilLanguage\txt().

+ Here is the call graph for this function:

◆ hasAutoActivation()

ilCleanCOPageHistoryCronjob::hasAutoActivation ( )

Is to be activated on "installation", does only work for ILIAS core cron jobs.

Reimplemented from ilCronJob.

Definition at line 76 of file class.ilCleanCOPageHistoryCronjob.php.

76 : bool
77 {
78 return false;
79 }

◆ hasCustomSettings()

ilCleanCOPageHistoryCronjob::hasCustomSettings ( )

Reimplemented from ilCronJob.

Definition at line 86 of file class.ilCleanCOPageHistoryCronjob.php.

86 : bool
87 {
88 return true;
89 }

◆ hasFlexibleSchedule()

ilCleanCOPageHistoryCronjob::hasFlexibleSchedule ( )

Reimplemented from ilCronJob.

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

81 : bool
82 {
83 return false;
84 }

◆ run()

ilCleanCOPageHistoryCronjob::run ( )

Reimplemented from ilCronJob.

Definition at line 91 of file class.ilCleanCOPageHistoryCronjob.php.

92 {
93 global $DIC;
94
96 $log->debug("----- Delete old page history entries, Start -----");
97
99 $result = new ilCronJobResult();
100
101 $x_days = $this->getCronDays();
102 $keep_entries = $this->getKeepEntries();
103 $log->debug("... $x_days days, keep $keep_entries");
104
105 if ($this->history_manager->deleteOldHistoryEntries($x_days, $keep_entries)) {
107 }
108
109 $log->debug("----- Delete old page history entries, End -----");
110
111 $result->setStatus($status);
112 return $result;
113 }
static getLogger(string $a_component_id)
Get component logger.
$log
Definition: result.php:33

References $DIC, $log, getCronDays(), getKeepEntries(), ilLoggerFactory\getLogger(), ilCronJobResult\STATUS_NO_ACTION, and ilCronJobResult\STATUS_OK.

+ Here is the call graph for this function:

◆ saveCustomSettings()

ilCleanCOPageHistoryCronjob::saveCustomSettings ( ilPropertyFormGUI  $a_form)

Reimplemented from ilCronJob.

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

138 : bool
139 {
140 $this->setCronDays((int) $a_form->getInput("copg_cron_days"));
141 $this->setKeepEntries((int) $a_form->getInput("copg_cron_keep_entries"));
142
143 return true;
144 }
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...

References ilPropertyFormGUI\getInput(), setCronDays(), and setKeepEntries().

+ Here is the call graph for this function:

◆ setCronDays()

ilCleanCOPageHistoryCronjob::setCronDays ( int  $days)
protected

Definition at line 152 of file class.ilCleanCOPageHistoryCronjob.php.

152 : void
153 {
155 $settings->set("copg_cron_days", (string) $days);
156 }
set(string $a_key, string $a_val)

References $settings, and ilSetting\set().

Referenced by saveCustomSettings().

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

◆ setKeepEntries()

ilCleanCOPageHistoryCronjob::setKeepEntries ( int  $entries)
protected

Definition at line 164 of file class.ilCleanCOPageHistoryCronjob.php.

164 : void
165 {
167 $settings->set("copg_cron_keep_entries", (string) $entries);
168 }

References $settings, and ilSetting\set().

Referenced by saveCustomSettings().

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

Field Documentation

◆ $history_manager

HistoryManager ilCleanCOPageHistoryCronjob::$history_manager
protected

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

◆ $lng

ilLanguage ilCleanCOPageHistoryCronjob::$lng
protected

◆ $settings

ilSetting ilCleanCOPageHistoryCronjob::$settings
protected

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