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

Public Member Functions

 __construct ()
 
 getId ()
 
 getTitle ()
 
 getDescription ()
 
 getDefaultScheduleType ()
 
 getDefaultScheduleValue ()
 
 hasAutoActivation ()
 
 hasFlexibleSchedule ()
 
 run ()
 
- 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 ()
 

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
CronJobScheduleType $schedule_type = null
 
int $schedule_value = null
 
Closure $date_time_provider = null
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilLuceneIndexer::__construct ( )

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

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

24  {
25  global $DIC;
26 
27  $this->lng = $DIC->language();
28  $this->setting = $DIC->settings();
29  }
global $DIC
Definition: shib_login.php:25
+ Here is the call graph for this function:

Member Function Documentation

◆ getDefaultScheduleType()

ilLuceneIndexer::getDefaultScheduleType ( )

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

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

◆ getDefaultScheduleValue()

ilLuceneIndexer::getDefaultScheduleValue ( )

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

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

◆ getDescription()

ilLuceneIndexer::getDescription ( )

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

References ILIAS\Repository\lng().

41  : string
42  {
43  return $this->lng->txt("cron_lucene_index_info");
44  }
+ Here is the call graph for this function:

◆ getId()

ilLuceneIndexer::getId ( )

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

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

◆ getTitle()

ilLuceneIndexer::getTitle ( )

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

References ILIAS\Repository\lng().

36  : string
37  {
38  return $this->lng->txt("cron_lucene_index");
39  }
+ Here is the call graph for this function:

◆ hasAutoActivation()

ilLuceneIndexer::hasAutoActivation ( )

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

56  : bool
57  {
58  return false;
59  }

◆ hasFlexibleSchedule()

ilLuceneIndexer::hasFlexibleSchedule ( )

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

61  : bool
62  {
63  return true;
64  }

◆ run()

ilLuceneIndexer::run ( )

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

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

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

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

Referenced by ilPersonalProfileGUI\savePublicProfile().

104  : bool
105  {
106  global $DIC;
107 
108  $ilSetting = $DIC['ilSetting'];
109  if (!ilSearchSettings::getInstance()->isLuceneUserSearchEnabled()) {
110  return false;
111  }
112 
113  try {
114  ilLoggerFactory::getLogger('src')->info('Lucene update index call BEGIN --- ');
115 
116  ilRpcClientFactory::factory('RPCIndexHandler', 1)->indexObjects(
117  CLIENT_ID . '_' . $ilSetting->get('inst_id', "0"),
118  $a_obj_ids
119  );
120  ilLoggerFactory::getLogger('src')->info('Lucene update index call --- END');
121  } catch (Exception $e) {
122  $error_message = $e->getMessage();
123  ilLoggerFactory::getLogger('src')->error($error_message);
124  return false;
125  }
126 
127  return true;
128  }
static getLogger(string $a_component_id)
Get component logger.
static factory(string $a_package, int $a_timeout=0)
Creates an ilRpcClient instance to our ilServer.
const CLIENT_ID
Definition: constants.php:41
global $DIC
Definition: shib_login.php:25
global $ilSetting
Definition: privfeed.php:32
+ 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 20 of file class.ilLuceneIndexer.php.

◆ $setting

ilSetting ilLuceneIndexer::$setting
protected

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

◆ $timeout

int ilLuceneIndexer::$timeout = 60
protected

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


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