ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilLuceneIndexer.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once "Services/Cron/classes/class.ilCronJob.php";
5
16{
17 public function getId()
18 {
19 return "src_lucene_indexer";
20 }
21
22 public function getTitle()
23 {
24 global $lng;
25
26 return $lng->txt("cron_lucene_index");
27 }
28
29 public function getDescription()
30 {
31 global $lng;
32
33 return $lng->txt("cron_lucene_index_info");
34 }
35
36 public function getDefaultScheduleType()
37 {
39 }
40
41 public function getDefaultScheduleValue()
42 {
43 return;
44 }
45
46 public function hasAutoActivation()
47 {
48 return false;
49 }
50
51 public function hasFlexibleSchedule()
52 {
53 return true;
54 }
55
56 public function run()
57 {
58 global $ilSetting;
59
61 $error_message = null;
62
63 try
64 {
65 include_once './Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
66 ilRpcClientFactory::factory('RPCIndexHandler')->index(
67 CLIENT_ID.'_'.$ilSetting->get('inst_id',0),
68 true
69 );
70 }
72 {
73 $error_message = $e->getMessage();
74 }
75 catch(Exception $e)
76 {
77 $error_message = $e->getMessage();
78 }
79
81 if($error_message)
82 {
83 // #16035 - currently no way to discern the severity of the exception
84 $result->setMessage($error_message);
86 }
87 else
88 {
90 }
91 $result->setStatus($status);
92 return $result;
93 }
94
95
100 public static function updateLuceneIndex($a_obj_ids)
101 {
102 global $ilSetting;
103
104 include_once './Services/Search/classes/class.ilSearchSettings.php';
105 if(!ilSearchSettings::getInstance()->isLuceneUserSearchEnabled())
106 {
107 return false;
108 }
109
110 try
111 {
112 include_once './Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
113 ilRpcClientFactory::factory('RPCIndexHandler')->indexObjects(
114 CLIENT_ID.'_'.$ilSetting->get('inst_id',0),
115 $a_obj_ids
116 );
117 }
119 {
120 $error_message = $e->getMessage();
121 $GLOBALS['ilLog']->write(__METHOD__.': '.$e->getMessage());
122 }
123 catch(Exception $e)
124 {
125 $error_message = $e->getMessage();
126 $GLOBALS['ilLog']->write(__METHOD__.': '.$e->getMessage());
127 }
128
129 }
130
131}
132
133?>
$result
Cron job result data container.
Cron job application base class.
const SCHEDULE_TYPE_DAILY
getDescription()
Get description.
getDefaultScheduleValue()
Get schedule value.
hasFlexibleSchedule()
Can the schedule be configured?
static updateLuceneIndex($a_obj_ids)
Update lucene index.
getDefaultScheduleType()
Get schedule type.
hasAutoActivation()
Is to be activated on "installation".
static factory($a_package)
Create an XML_RPC2 client instance.
$GLOBALS['ct_recipient']
global $lng
Definition: privfeed.php:40
global $ilSetting
Definition: privfeed.php:40