ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 ILIAS\Cron\CronJob
 setDateTimeProvider (?\Closure $date_time_provider)
 
 isDue (?\DateTimeImmutable $last_run, ?JobScheduleType $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 (?JobScheduleType $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 ()
 
 usesLegacyForms ()
 
 getCustomConfigurationInput (\ILIAS\UI\Factory $ui_factory, \ILIAS\Refinery\Factory $factory, \ilLanguage $lng)
 
 addCustomSettingsToForm (\ilPropertyFormGUI $a_form)
 
 saveCustomConfiguration (mixed $form_data)
 
 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 ILIAS\Cron\CronJob
JobScheduleType $schedule_type = null
 
int $schedule_value = null
 
Closure $date_time_provider = null
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ __construct()

ilCleanCOPageHistoryCronjob::__construct ( )

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

36 {
37 global $DIC;
38
39 $this->lng = $DIC->language();
40 $this->settings = $DIC->settings();
41 $this->history_manager = $DIC
42 ->copage()
43 ->internal()
44 ->domain()
45 ->history();
46 }
global $DIC
Definition: shib_login.php:26

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)

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

118 : void
119 {
121 $lng->loadLanguageModule("copg");
122
123 $ti = new ilNumberInputGUI(
124 $lng->txt("copg_cron_days"),
125 "copg_cron_days"
126 );
127 $ti->setSize(6);
128 $ti->setSuffix($lng->txt("copg_days"));
129 $ti->setInfo($lng->txt("copg_cron_days_info"));
130 $ti->setValue((string) $this->getCronDays());
131 $a_form->addItem($ti);
132
133 $ti = new ilNumberInputGUI($lng->txt("copg_cron_keep_entries"), "copg_cron_keep_entries");
134 $ti->setSize(6);
135 $ti->setSuffix($lng->txt("copg_entries"));
136 $ti->setInfo($lng->txt("copg_cron_keep_entries_info"));
137 $ti->setValue((string) $this->getKeepEntries());
138 $a_form->addItem($ti);
139 }
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 149 of file class.ilCleanCOPageHistoryCronjob.php.

149 : int
150 {
152 return (int) $settings->get("copg_cron_days", "3600");
153 }
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 ILIAS\Cron\CronJob.

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

70 {
71 return JobScheduleType::DAILY;
72 }

◆ getDefaultScheduleValue()

ilCleanCOPageHistoryCronjob::getDefaultScheduleValue ( )

Reimplemented from ILIAS\Cron\CronJob.

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

74 : ?int
75 {
76 return null;
77 }

◆ getDescription()

ilCleanCOPageHistoryCronjob::getDescription ( )

Reimplemented from ILIAS\Cron\CronJob.

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

61 : string
62 {
64
65 $lng->loadLanguageModule("copg");
66 return $lng->txt("copg_history_cleanup_cron_info");
67 }

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

+ Here is the call graph for this function:

◆ getId()

ilCleanCOPageHistoryCronjob::getId ( )

Reimplemented from ILIAS\Cron\CronJob.

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

48 : string
49 {
50 return "copg_history_cleanup";
51 }

◆ getKeepEntries()

ilCleanCOPageHistoryCronjob::getKeepEntries ( )
protected

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

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

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 ILIAS\Cron\CronJob.

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

53 : string
54 {
56
57 $lng->loadLanguageModule("copg");
58 return $lng->txt("copg_history_cleanup_cron");
59 }

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 ILIAS\Cron\CronJob.

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

79 : bool
80 {
81 return false;
82 }

◆ hasCustomSettings()

ilCleanCOPageHistoryCronjob::hasCustomSettings ( )

Reimplemented from ILIAS\Cron\CronJob.

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

89 : bool
90 {
91 return true;
92 }

◆ hasFlexibleSchedule()

ilCleanCOPageHistoryCronjob::hasFlexibleSchedule ( )

Reimplemented from ILIAS\Cron\CronJob.

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

84 : bool
85 {
86 return false;
87 }

◆ run()

ilCleanCOPageHistoryCronjob::run ( )

Reimplemented from ILIAS\Cron\CronJob.

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

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

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

+ Here is the call graph for this function:

◆ saveCustomSettings()

ilCleanCOPageHistoryCronjob::saveCustomSettings ( ilPropertyFormGUI  $a_form)

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

141 : bool
142 {
143 $this->setCronDays((int) $a_form->getInput("copg_cron_days"));
144 $this->setKeepEntries((int) $a_form->getInput("copg_cron_keep_entries"));
145
146 return true;
147 }
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 155 of file class.ilCleanCOPageHistoryCronjob.php.

155 : void
156 {
158 $settings->set("copg_cron_days", (string) $days);
159 }
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 167 of file class.ilCleanCOPageHistoryCronjob.php.

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

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 31 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: