ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
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 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.

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

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
+ 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.

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

118  : void
119  {
120  $lng = $this->lng;
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  }
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.
This class represents a number property in a property form.
+ Here is the call graph for this function:

◆ getCronDays()

ilCleanCOPageHistoryCronjob::getCronDays ( )
protected

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

References $settings, and ilSetting\get().

Referenced by addCustomSettingsToForm(), and run().

149  : int
150  {
152  return (int) $settings->get("copg_cron_days", "3600");
153  }
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 69 of file class.ilCleanCOPageHistoryCronjob.php.

70  {
71  return JobScheduleType::DAILY;
72  }

◆ getDefaultScheduleValue()

ilCleanCOPageHistoryCronjob::getDefaultScheduleValue ( )

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

References null.

74  : ?int
75  {
76  return null;
77  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ getDescription()

ilCleanCOPageHistoryCronjob::getDescription ( )

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

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

61  : string
62  {
63  $lng = $this->lng;
64 
65  $lng->loadLanguageModule("copg");
66  return $lng->txt("copg_history_cleanup_cron_info");
67  }
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 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.

References $settings, and ilSetting\get().

Referenced by addCustomSettingsToForm(), and run().

161  : int
162  {
164  return (int) $settings->get("copg_cron_keep_entries", "1000");
165  }
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 53 of file class.ilCleanCOPageHistoryCronjob.php.

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

53  : string
54  {
55  $lng = $this->lng;
56 
57  $lng->loadLanguageModule("copg");
58  return $lng->txt("copg_history_cleanup_cron");
59  }
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 79 of file class.ilCleanCOPageHistoryCronjob.php.

79  : bool
80  {
81  return false;
82  }

◆ hasCustomSettings()

ilCleanCOPageHistoryCronjob::hasCustomSettings ( )

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

89  : bool
90  {
91  return true;
92  }

◆ hasFlexibleSchedule()

ilCleanCOPageHistoryCronjob::hasFlexibleSchedule ( )

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

84  : bool
85  {
86  return false;
87  }

◆ run()

ilCleanCOPageHistoryCronjob::run ( )

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

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

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: result.php:32
global $DIC
Definition: shib_login.php:26
+ Here is the call graph for this function:

◆ saveCustomSettings()

ilCleanCOPageHistoryCronjob::saveCustomSettings ( ilPropertyFormGUI  $a_form)

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

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

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-...
+ Here is the call graph for this function:

◆ setCronDays()

ilCleanCOPageHistoryCronjob::setCronDays ( int  $days)
protected

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

References $settings, and ilSetting\set().

Referenced by saveCustomSettings().

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

References $settings, and ilSetting\set().

Referenced by saveCustomSettings().

167  : void
168  {
170  $settings->set("copg_cron_keep_entries", (string) $entries);
171  }
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 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: