ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilRpcIniFileWriter.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 /*
5  +-----------------------------------------------------------------------------+
6  | ILIAS open source |
7  +-----------------------------------------------------------------------------+
8  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
9  | |
10  | This program is free software; you can redistribute it and/or |
11  | modify it under the terms of the GNU General Public License |
12  | as published by the Free Software Foundation; either version 2 |
13  | of the License, or (at your option) any later version. |
14  | |
15  | This program is distributed in the hope that it will be useful, |
16  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
17  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18  | GNU General Public License for more details. |
19  | |
20  | You should have received a copy of the GNU General Public License |
21  | along with this program; if not, write to the Free Software |
22  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
23  +-----------------------------------------------------------------------------+
24 */
25 
31 {
32  protected string $ini = '';
33 
34  protected string $host = '';
35  protected int $port = 0;
36  protected string $indexPath = '';
37  protected string $logPath = '';
38  protected string $logLevel = '';
39  protected int $numThreads = 0;
40  protected string $max_file_size = '';
41 
42  protected ilSetting $settings;
43  protected ilIniFile $inifile;
44 
45  public function __construct()
46  {
47  global $DIC;
48  $this->settings = $DIC->settings();
49  $this->inifile = $DIC['ilIliasIniFile'];
50  }
51 
52  public function write(): bool
53  {
54  // Main section
55  $this->ini = "[Server]\n";
56  $this->ini .= "IpAddress = " . $this->getHost() . "\n";
57  $this->ini .= "Port = " . $this->getPort() . "\n";
58  $this->ini .= "IndexPath = " . $this->getIndexPath() . "\n";
59  $this->ini .= "LogFile = " . $this->getLogPath() . "\n";
60  $this->ini .= "LogLevel = " . $this->getLogLevel() . "\n";
61  $this->ini .= "NumThreads = " . $this->getNumThreads() . "\n";
62  $this->ini .= "RamBufferSize = 256\n";
63  $this->ini .= "IndexMaxFileSizeMB = " . $this->getMaxFileSize() . "\n";
64 
65  $this->ini .= "\n";
66 
67  $this->ini .= "[Client1]\n";
68  $this->ini .= "ClientId = " . CLIENT_ID . "\n";
69  $this->ini .= "NicId = " . $this->settings->get('inst_id', '0') . "\n";
70  $this->ini .= "IliasIniPath = " . $this->inifile->readVariable(
71  'server',
72  'absolute_path'
73  ) . DIRECTORY_SEPARATOR . "ilias.ini.php\n";
74 
75  return true;
76  }
77 
78  public function getIniString(): string
79  {
80  return $this->ini;
81  }
82 
83  public function getHost(): string
84  {
85  return $this->host;
86  }
87 
88  public function setHost(string $host): void
89  {
90  $this->host = $host;
91  }
92 
93  public function getIndexPath(): string
94  {
95  return $this->indexPath;
96  }
97 
98  public function setIndexPath(string $indexPath): void
99  {
100  $this->indexPath = $indexPath;
101  }
102 
103  public function getLogLevel(): string
104  {
105  return $this->logLevel;
106  }
107 
108  public function setLogLevel(string $logLevel): void
109  {
110  $this->logLevel = $logLevel;
111  }
112 
113  public function getLogPath(): string
114  {
115  return $this->logPath;
116  }
117 
118  public function setLogPath(string $logPath): void
119  {
120  $this->logPath = $logPath;
121  }
122 
123  public function getNumThreads(): int
124  {
125  return $this->numThreads;
126  }
127 
128  public function setNumThreads(int $numThreads): void
129  {
130  $this->numThreads = $numThreads;
131  }
132 
133  public function getPort(): int
134  {
135  return $this->port;
136  }
137 
138  public function setPort(int $port): void
139  {
140  $this->port = $port;
141  }
142 
143  public function setMaxFileSize(string $a_fs): void
144  {
145  $this->max_file_size = $a_fs;
146  }
147 
148  public function getMaxFileSize(): string
149  {
150  return $this->max_file_size;
151  }
152 }
Creates a java server ini file for the current client
global $DIC
Definition: feed.php:28
setIndexPath(string $indexPath)
const CLIENT_ID
Definition: constants.php:41
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...