ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilRPCServerSettings.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 
34 define("RPC_SERVER_PATH","/RPC2");
35 define("RPC_SERVER_ALIVE",true);
36 
38 {
39 
40  var $rpc_host = '';
41  var $rpc_port = '';
42 
43  var $log = null;
44  var $db = null;
45  var $err = null;
46 
47  var $settings_obj = null;
48 
49 
51  {
52  global $ilLog,$ilDB,$ilError,$ilias;
53 
54  $this->log =& $ilLog;
55  $this->db =& $ilDB;
56  $this->err =& $ilError;
57  $this->ilias =& $ilias;
58  }
59 
60  function getHost()
61  {
62  if(strlen($this->rpc_host))
63  {
64  return $this->rpc_host;
65  }
66  return $this->rpc_host = $this->ilias->getSetting('rpc_server_host');
67  }
68  function setHost($a_host)
69  {
70  $this->rpc_host = $a_host;
71  }
72  function getPort()
73  {
74  if(strlen($this->rpc_port))
75  {
76  return $this->rpc_port;
77  }
78  return $this->rpc_port = $this->ilias->getSetting('rpc_server_port');
79  }
80  function setPort($a_port)
81  {
82  $this->rpc_port = $a_port;
83  }
84  function getPath()
85  {
86  return RPC_SERVER_PATH;
87  }
88 
89  function update()
90  {
91  $this->ilias->setSetting('rpc_server_host',$this->getHost());
92  $this->ilias->setSetting('rpc_server_port',$this->getPort());
93 
94  return true;
95  }
96 
97  function pingServer()
98  {
99  include_once 'Services/Search/classes/Lucene/class.ilLuceneRPCAdapter.php';
100 
101  $rpc_adapter =& new ilLuceneRPCAdapter();
102  $rpc_adapter->setMode('ping');
103  $res = $rpc_adapter->send();
104 
105  if($res == RPC_SERVER_ALIVE)
106  {
107  return true;
108  }
109  return false;
110  }
111 }
112 ?>