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

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 ()
 
 run ()
 
- 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 ()
 

Static Public Member Functions

static updateLuceneIndex (array $a_obj_ids)
 Update lucene index. More...
 

Protected Attributes

int $timeout = 60
 
ilLanguage $lng
 
ilSetting $setting
 
- 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

Definition at line 15 of file class.ilLuceneIndexer.php.

Constructor & Destructor Documentation

◆ __construct()

ilLuceneIndexer::__construct ( )

Definition at line 22 of file class.ilLuceneIndexer.php.

23 {
24 global $DIC;
25
26 $this->lng = $DIC->language();
27 $this->setting = $DIC->settings();
28 }
global $DIC
Definition: feed.php:28

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

+ Here is the call graph for this function:

Member Function Documentation

◆ getDefaultScheduleType()

ilLuceneIndexer::getDefaultScheduleType ( )

Reimplemented from ilCronJob.

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

45 : int
46 {
48 }
const SCHEDULE_TYPE_DAILY
@depracated This will be replaced with an ENUM in ILIAS 9

References ilCronJob\SCHEDULE_TYPE_DAILY.

◆ getDefaultScheduleValue()

ilLuceneIndexer::getDefaultScheduleValue ( )

Reimplemented from ilCronJob.

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

50 : ?int
51 {
52 return null;
53 }

◆ getDescription()

ilLuceneIndexer::getDescription ( )

Reimplemented from ilCronJob.

Definition at line 40 of file class.ilLuceneIndexer.php.

40 : string
41 {
42 return $this->lng->txt("cron_lucene_index_info");
43 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getId()

ilLuceneIndexer::getId ( )

Reimplemented from ilCronJob.

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

30 : string
31 {
32 return "src_lucene_indexer";
33 }

◆ getTitle()

ilLuceneIndexer::getTitle ( )

Reimplemented from ilCronJob.

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

35 : string
36 {
37 return $this->lng->txt("cron_lucene_index");
38 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ hasAutoActivation()

ilLuceneIndexer::hasAutoActivation ( )

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

Reimplemented from ilCronJob.

Definition at line 55 of file class.ilLuceneIndexer.php.

55 : bool
56 {
57 return false;
58 }

◆ hasFlexibleSchedule()

ilLuceneIndexer::hasFlexibleSchedule ( )

Reimplemented from ilCronJob.

Definition at line 60 of file class.ilLuceneIndexer.php.

60 : bool
61 {
62 return true;
63 }

◆ run()

ilLuceneIndexer::run ( )

Reimplemented from ilCronJob.

Definition at line 65 of file class.ilLuceneIndexer.php.

66 {
68 $error_message = null;
69
70 try {
71 ilRpcClientFactory::factory('RPCIndexHandler', 60)->index(
72 CLIENT_ID . '_' . $this->setting->get('inst_id', "0"),
73 true
74 );
75 } catch (Exception $e) {
76 $error_message = $e->getMessage();
77
78 if ($e instanceof ilRpcClientException && $e->getCode() == 28) {
79 ilLoggerFactory::getLogger('src')->info('Connection timed out after ' . $this->timeout . ' seconds. ' .
80 'Indexing will continoue without a proper return message. View ilServer log if you think there are problems while indexing.');
81 $error_message = null;
82 }
83 }
84
85 $result = new ilCronJobResult();
86 if ($error_message) {
87 // #16035 - currently no way to discern the severity of the exception
88 $result->setMessage($error_message);
90 } else {
92 }
93 $result->setStatus($status);
94 return $result;
95 }
static getLogger(string $a_component_id)
Get component logger.
Class ilRpcClientException.
static factory(string $a_package, int $a_timeout=0)
Creates an ilRpcClient instance to our ilServer.
const CLIENT_ID
Definition: constants.php:41

References Vendor\Package\$e, CLIENT_ID, ilRpcClientFactory\factory(), ilLoggerFactory\getLogger(), ilCronJobResult\STATUS_FAIL, ilCronJobResult\STATUS_NO_ACTION, and ilCronJobResult\STATUS_OK.

+ Here is the call graph for this function:

◆ updateLuceneIndex()

static ilLuceneIndexer::updateLuceneIndex ( array  $a_obj_ids)
static

Update lucene index.

Parameters
int[]$a_obj_ids
Returns
bool

Definition at line 103 of file class.ilLuceneIndexer.php.

103 : bool
104 {
105 global $DIC;
106
107 $ilSetting = $DIC['ilSetting'];
108 if (!ilSearchSettings::getInstance()->isLuceneUserSearchEnabled()) {
109 return false;
110 }
111
112 try {
113 ilLoggerFactory::getLogger('src')->info('Lucene update index call BEGIN --- ');
114
115 ilRpcClientFactory::factory('RPCIndexHandler', 1)->indexObjects(
116 CLIENT_ID . '_' . $ilSetting->get('inst_id', "0"),
117 $a_obj_ids
118 );
119 ilLoggerFactory::getLogger('src')->info('Lucene update index call --- END');
120 } catch (Exception $e) {
121 $error_message = $e->getMessage();
122 ilLoggerFactory::getLogger('src')->error($error_message);
123 return false;
124 }
125
126 return true;
127 }
global $ilSetting
Definition: privfeed.php:17

References $DIC, Vendor\Package\$e, $ilSetting, CLIENT_ID, ilRpcClientFactory\factory(), ilSearchSettings\getInstance(), and ilLoggerFactory\getLogger().

Referenced by ilPersonalProfileGUI\savePublicProfile().

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

Field Documentation

◆ $lng

ilLanguage ilLuceneIndexer::$lng
protected

Definition at line 19 of file class.ilLuceneIndexer.php.

◆ $setting

ilSetting ilLuceneIndexer::$setting
protected

Definition at line 20 of file class.ilLuceneIndexer.php.

◆ $timeout

int ilLuceneIndexer::$timeout = 60
protected

Definition at line 17 of file class.ilLuceneIndexer.php.


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