ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilCleanCOPageHistoryCronjob Class Reference
+ Inheritance diagram for ilCleanCOPageHistoryCronjob:
+ Collaboration diagram for ilCleanCOPageHistoryCronjob:

Public Member Functions

 __construct ()
 
 getId ()
 
 getTitle ()
 
 getDescription ()
 
 getDefaultScheduleType ()
 
 getDefaultScheduleValue ()
 
 hasAutoActivation ()
 
 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, ?CronJobScheduleType $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 (?CronJobScheduleType $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
CronJobScheduleType $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 27 of file class.ilCleanCOPageHistoryCronjob.php.

Constructor & Destructor Documentation

◆ __construct()

ilCleanCOPageHistoryCronjob::__construct ( )

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

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

34  {
35  global $DIC;
36 
37  $this->lng = $DIC->language();
38  $this->settings = $DIC->settings();
39  $this->history_manager = $DIC
40  ->copage()
41  ->internal()
42  ->domain()
43  ->history();
44  }
global $DIC
Definition: shib_login.php:25
+ Here is the call graph for this function:

Member Function Documentation

◆ addCustomSettingsToForm()

ilCleanCOPageHistoryCronjob::addCustomSettingsToForm ( ilPropertyFormGUI  $a_form)

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

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

116  : void
117  {
118  $lng = $this->lng;
119  $lng->loadLanguageModule("copg");
120 
121  $ti = new ilNumberInputGUI(
122  $lng->txt("copg_cron_days"),
123  "copg_cron_days"
124  );
125  $ti->setSize(6);
126  $ti->setSuffix($lng->txt("copg_days"));
127  $ti->setInfo($lng->txt("copg_cron_days_info"));
128  $ti->setValue((string) $this->getCronDays());
129  $a_form->addItem($ti);
130 
131  $ti = new ilNumberInputGUI($lng->txt("copg_cron_keep_entries"), "copg_cron_keep_entries");
132  $ti->setSize(6);
133  $ti->setSuffix($lng->txt("copg_entries"));
134  $ti->setInfo($lng->txt("copg_cron_keep_entries_info"));
135  $ti->setValue((string) $this->getKeepEntries());
136  $a_form->addItem($ti);
137  }
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...
loadLanguageModule(string $a_module)
Load language module.
+ Here is the call graph for this function:

◆ getCronDays()

ilCleanCOPageHistoryCronjob::getCronDays ( )
protected

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

References $settings, and ilSetting\get().

Referenced by addCustomSettingsToForm(), and run().

147  : int
148  {
150  return (int) $settings->get("copg_cron_days", "3600");
151  }
get(string $a_keyword, ?string $a_default_value=null)
get setting
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDefaultScheduleType()

ilCleanCOPageHistoryCronjob::getDefaultScheduleType ( )

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

68  {
69  return CronJobScheduleType::SCHEDULE_TYPE_DAILY;
70  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getDefaultScheduleValue()

ilCleanCOPageHistoryCronjob::getDefaultScheduleValue ( )

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

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

◆ getDescription()

ilCleanCOPageHistoryCronjob::getDescription ( )

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

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

59  : string
60  {
61  $lng = $this->lng;
62 
63  $lng->loadLanguageModule("copg");
64  return $lng->txt("copg_history_cleanup_cron_info");
65  }
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...
loadLanguageModule(string $a_module)
Load language module.
+ Here is the call graph for this function:

◆ getId()

ilCleanCOPageHistoryCronjob::getId ( )

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

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

◆ getKeepEntries()

ilCleanCOPageHistoryCronjob::getKeepEntries ( )
protected

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

References $settings, and ilSetting\get().

Referenced by addCustomSettingsToForm(), and run().

159  : int
160  {
162  return (int) $settings->get("copg_cron_keep_entries", "1000");
163  }
get(string $a_keyword, ?string $a_default_value=null)
get setting
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTitle()

ilCleanCOPageHistoryCronjob::getTitle ( )

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

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

51  : string
52  {
53  $lng = $this->lng;
54 
55  $lng->loadLanguageModule("copg");
56  return $lng->txt("copg_history_cleanup_cron");
57  }
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...
loadLanguageModule(string $a_module)
Load language module.
+ Here is the call graph for this function:

◆ hasAutoActivation()

ilCleanCOPageHistoryCronjob::hasAutoActivation ( )

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

77  : bool
78  {
79  return false;
80  }

◆ hasCustomSettings()

ilCleanCOPageHistoryCronjob::hasCustomSettings ( )

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

87  : bool
88  {
89  return true;
90  }

◆ hasFlexibleSchedule()

ilCleanCOPageHistoryCronjob::hasFlexibleSchedule ( )

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

82  : bool
83  {
84  return false;
85  }

◆ run()

ilCleanCOPageHistoryCronjob::run ( )

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

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

93  {
94  global $DIC;
95 
97  $log->debug("----- Delete old page history entries, Start -----");
98 
100  $result = new ilCronJobResult();
101 
102  $x_days = $this->getCronDays();
103  $keep_entries = $this->getKeepEntries();
104  $log->debug("... $x_days days, keep $keep_entries");
105 
106  if ($this->history_manager->deleteOldHistoryEntries($x_days, $keep_entries)) {
107  $status = ilCronJobResult::STATUS_OK;
108  }
109 
110  $log->debug("----- Delete old page history entries, End -----");
111 
112  $result->setStatus($status);
113  return $result;
114  }
static getLogger(string $a_component_id)
Get component logger.
final const STATUS_NO_ACTION
global $DIC
Definition: shib_login.php:25
$log
Definition: ltiresult.php:34
+ Here is the call graph for this function:

◆ saveCustomSettings()

ilCleanCOPageHistoryCronjob::saveCustomSettings ( ilPropertyFormGUI  $a_form)

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

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

139  : bool
140  {
141  $this->setCronDays((int) $a_form->getInput("copg_cron_days"));
142  $this->setKeepEntries((int) $a_form->getInput("copg_cron_keep_entries"));
143 
144  return true;
145  }
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-...
+ Here is the call graph for this function:

◆ setCronDays()

ilCleanCOPageHistoryCronjob::setCronDays ( int  $days)
protected

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

References $settings, and ilSetting\set().

Referenced by saveCustomSettings().

153  : void
154  {
156  $settings->set("copg_cron_days", (string) $days);
157  }
set(string $a_key, string $a_val)
+ 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 165 of file class.ilCleanCOPageHistoryCronjob.php.

References $settings, and ilSetting\set().

Referenced by saveCustomSettings().

165  : void
166  {
168  $settings->set("copg_cron_keep_entries", (string) $entries);
169  }
set(string $a_key, string $a_val)
+ 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 29 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: