ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 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 ()
 

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 ILIAS\Cron\CronJob
JobScheduleType $schedule_type = null
 
int $schedule_value = null
 
Closure $date_time_provider = null
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilLuceneIndexer::__construct ( )

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

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

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

Member Function Documentation

◆ getDefaultScheduleType()

ilLuceneIndexer::getDefaultScheduleType ( )

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

49  {
50  return JobScheduleType::DAILY;
51  }

◆ getDefaultScheduleValue()

ilLuceneIndexer::getDefaultScheduleValue ( )

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

References null.

53  : ?int
54  {
55  return null;
56  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ getDescription()

ilLuceneIndexer::getDescription ( )

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

References ILIAS\Repository\lng().

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

◆ getId()

ilLuceneIndexer::getId ( )

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

33  : string
34  {
35  return "src_lucene_indexer";
36  }

◆ getTitle()

ilLuceneIndexer::getTitle ( )

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

References ILIAS\Repository\lng().

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

◆ hasAutoActivation()

ilLuceneIndexer::hasAutoActivation ( )

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

58  : bool
59  {
60  return false;
61  }

◆ hasFlexibleSchedule()

ilLuceneIndexer::hasFlexibleSchedule ( )

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

63  : bool
64  {
65  return true;
66  }

◆ run()

ilLuceneIndexer::run ( )

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

References Vendor\Package\$e, CLIENT_ID, ilRpcClientFactory\factory(), ilLoggerFactory\getLogger(), and null.

68  : JobResult
69  {
70  $status = JobResult::STATUS_NO_ACTION;
71  $error_message = null;
72 
73  try {
74  ilRpcClientFactory::factory('RPCIndexHandler', 60)->index(
75  CLIENT_ID . '_' . $this->setting->get('inst_id', "0"),
76  true
77  );
78  } catch (Exception $e) {
79  $error_message = $e->getMessage();
80 
81  if ($e instanceof ilRpcClientException && $e->getCode() == 28) {
82  ilLoggerFactory::getLogger('src')->info('Connection timed out after ' . $this->timeout . ' seconds. ' .
83  'Indexing will continoue without a proper return message. View ilServer log if you think there are problems while indexing.');
84  $error_message = null;
85  }
86  }
87 
88  $result = new JobResult();
89  if ($error_message) {
90  // #16035 - currently no way to discern the severity of the exception
91  $result->setMessage($error_message);
92  $status = JobResult::STATUS_FAIL;
93  } else {
94  $status = JobResult::STATUS_OK;
95  }
96  $result->setStatus($status);
97  return $result;
98  }
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.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 106 of file class.ilLuceneIndexer.php.

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

Referenced by ilPersonalProfileGUI\savePublicProfile().

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

◆ $setting

ilSetting ilLuceneIndexer::$setting
protected

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

◆ $timeout

int ilLuceneIndexer::$timeout = 60
protected

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


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