ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilClient Class Reference

Client Management. More...

+ Collaboration diagram for ilClient:

Public Member Functions

 __construct ($a_client_id)
 ilClient constructor. More...
 
 getDBSetup ($cached=true)
 
 init ()
 init client load client.ini and set some constants More...
 
 provideGlobalDB ()
 
 revokeGlobalDB ()
 
 getId ()
 get client id More...
 
 setId ($a_client_id)
 set client id More...
 
 getName ()
 get client name More...
 
 setName ($a_str)
 set client name More...
 
 getDescription ()
 get client description More...
 
 setDescription ($a_str)
 set client description More...
 
 getDB ()
 get mysql version More...
 
 connect ()
 connect to client database More...
 
 isInstalledDB (&$a_db)
 check if client db is installed More...
 
 setDSN ()
 set the dsn and dsn_host More...
 
 setDbHost ($a_str)
 set the host More...
 
 getDbHost ()
 get db host More...
 
 setDbName ($a_str)
 set the name of database More...
 
 getDbName ()
 get name of database More...
 
 setDbUser ($a_str)
 set db user More...
 
 getDbUser ()
 get db user More...
 
 getDbPort ()
 get db port More...
 
 setDbPort ($a_str)
 set db port More...
 
 setDbPass ($a_str)
 set db password More...
 
 getDbPass ()
 get db password More...
 
 setDbSlaveActive ($a_act)
 set the slave active More...
 
 getDbSlaveActive ()
 get slave active More...
 
 setDbSlaveHost ($a_str)
 set the slave host More...
 
 getDbSlaveHost ()
 get db slave host More...
 
 setDbSlaveName ($a_str)
 set the name of slave database More...
 
 getDbSlaveName ()
 get name of slave database More...
 
 setDbSlaveUser ($a_str)
 set slave db user More...
 
 getDbSlaveUser ()
 get slave db user More...
 
 getDbSlavePort ()
 get slave db port More...
 
 setDbSlavePort ($a_str)
 set slave db port More...
 
 setDbSlavePass ($a_str)
 set slave db password More...
 
 getDbSlavePass ()
 get slave db password More...
 
 setDbType ($a_str)
 set the type of database More...
 
 getDbType ()
 get type of database More...
 
 getDataDir ()
 get client datadir path More...
 
 getWebspaceDir ()
 get client webspacedir path More...
 
 checkDatabaseExists ($a_keep_connection=false)
 check database connection with database name More...
 
 reconnect ()
 
 getSetting ($a_keyword)
 read one value from settings table More...
 
 getAllSettings ()
 read all values from settings table public More...
 
 setSetting ($a_key, $a_val)
 write one value to settings table public More...
 
 getURLStringForNIC ($a_nic_url)
 
 updateNIC ($a_nic_url)
 Connect to ILIAS-NIC. More...
 
 setNICkey ()
 set nic_key generate nic_key if nic_key field in cust table is empty. More...
 
 getNICkey ()
 get nic_key public More...
 
 getDefaultLanguage ()
 
 setDefaultLanguage ($a_lang_key)
 
 getError ()
 get error message and clear error var More...
 
 setError ($error_message)
 
 delete ($a_ini=true, $a_db=false, $a_files=false)
 delete client More...
 
 create ()
 create a new client and its subdirectories More...
 
 writeIni ()
 write init More...
 

Data Fields

 $id
 
 $dir
 
 $name
 
 $db_exists = false
 
 $db_installed = false
 
 $client_defaults
 
 $status
 
 $setup_ok = false
 
 $nic_status
 
 $error = ''
 
 $db
 
 $ini
 

Protected Attributes

 $db_setup = null
 

Detailed Description

Client Management.

Author
Sascha Hofmann shofm.nosp@m.ann@.nosp@m.datab.nosp@m.ay.d.nosp@m.e
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 12 of file class.ilClient.php.

Constructor & Destructor Documentation

◆ __construct()

ilClient::__construct (   $a_client_id)

ilClient constructor.

Parameters
$a_client_id

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

References getId().

49  {
50  if ($a_client_id) {
51  $this->id = $a_client_id;
52  $this->ini_file_path = ILIAS_ABSOLUTE_PATH . "/" . ILIAS_WEB_DIR . "/" . $this->getId() . "/client.ini.php";
53  }
54 
55  // set path default.ini
56  $this->client_defaults = ILIAS_ABSOLUTE_PATH . "/setup/client.master.ini.php";
57  }
getId()
get client id
+ Here is the call graph for this function:

Member Function Documentation

◆ checkDatabaseExists()

ilClient::checkDatabaseExists (   $a_keep_connection = false)

check database connection with database name

Returns
boolean

Definition at line 545 of file class.ilClient.php.

References getDBSetup().

546  {
547  return $this->getDBSetup()->isConnectable();
548  }
getDBSetup($cached=true)
+ Here is the call graph for this function:

◆ connect()

ilClient::connect ( )

connect to client database

Returns
boolean true on success

Definition at line 211 of file class.ilClient.php.

References Vendor\Package\$c, $db, $GLOBALS, and ilDBWrapperFactory\getWrapper().

Referenced by reconnect().

212  {
213  // check parameters
214  // To support oracle tnsnames.ora dbname is not required
215  if (!$this->getdbHost() || !$this->getdbUser()) {
216  $this->error = "empty_fields";
217 
218  return false;
219  }
220 
221  $this->db = ilDBWrapperFactory::getWrapper($this->getdbType());
222  $this->db->setDBUser($this->getdbUser());
223  $this->db->setDBPort($this->getdbPort());
224  $this->db->setDBPassword($this->getdbPass());
225  $this->db->setDBHost($this->getdbHost());
226  $this->db->setDBName($this->getdbName());
227  $con = $this->db->connect(true);
228 
229  if (!$con) {
230  $this->error = "Database connection failed.";
231  return false;
232  }
233  $GLOBALS["ilDB"] = $this->db;
234 
235  if ($GLOBALS["DIC"]->offsetExists("ilDB")) {
236  $GLOBALS["DIC"]->offsetUnset("ilDB");
237  }
238 
239  $GLOBALS["DIC"]["ilDB"] = function ($c) {
240  return $GLOBALS["ilDB"];
241  };
242 
243  $this->db_exists = true;
244  return true;
245  }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create()

ilClient::create ( )

create a new client and its subdirectories

Returns
boolean true on success

Definition at line 792 of file class.ilClient.php.

References getDataDir(), getWebspaceDir(), and ilUtil\makeDir().

793  {
794  //var_dump($this->getDataDir());exit;
795  // create base data dir
796  if (!ilUtil::makeDir($this->getDataDir())) {
797  $this->error = "could_not_create_base_data_dir :" . $this->getDataDir();
798  return false;
799  }
800 
801  // create sub dirs in base data dir
802  if (!ilUtil::makeDir($this->getDataDir() . "/mail")) {
803  $this->error = "could_not_create_mail_data_dir :" . $this->getDataDir() . "/mail";
804  return false;
805  }
806 
807  if (!ilUtil::makeDir($this->getDataDir() . "/lm_data")) {
808  $this->error = "could_not_create_lm_data_dir :" . $this->getDataDir() . "/lm_data";
809  return false;
810  }
811 
812  if (!ilUtil::makeDir($this->getDataDir() . "/forum")) {
813  $this->error = "could_not_create_forum_data_dir :" . $this->getDataDir() . "/forum";
814  return false;
815  }
816 
817  if (!ilUtil::makeDir($this->getDataDir() . "/files")) {
818  $this->error = "could_not_create_files_data_dir :" . $this->getDataDir() . "/files";
819  return false;
820  }
821 
822  // create base webspace dir
823  if (!ilUtil::makeDir($this->getWebspaceDir())) {
824  $this->error = "could_not_create_base_webspace_dir :" . $this->getWebspaceDir();
825  return false;
826  }
827 
828  // create sub dirs in base webspace dir
829  if (!ilUtil::makeDir($this->getWebspaceDir() . "/lm_data")) {
830  $this->error = "could_not_create_lm_webspace_dir :" . $this->getWebspaceDir() . "/lm_data";
831  return false;
832  }
833 
834  if (!ilUtil::makeDir($this->getWebspaceDir() . "/usr_images")) {
835  $this->error = "could_not_create_usr_images_webspace_dir :" . $this->getWebspaceDir() . "/usr_images";
836  return false;
837  }
838 
839  if (!ilUtil::makeDir($this->getWebspaceDir() . "/mobs")) {
840  $this->error = "could_not_create_mobs_webspace_dir :" . $this->getWebspaceDir() . "/mobs";
841  return false;
842  }
843 
844  if (!ilUtil::makeDir($this->getWebspaceDir() . "/css")) {
845  $this->error = "could_not_create_css_webspace_dir :" . $this->getWebspaceDir() . "/css";
846  return false;
847  }
848 
849  // write client ini
850  if (!$this->ini->write()) {
851  $this->error = get_class($this) . ": " . $this->ini->getError();
852  return false;
853  }
854 
855  return true;
856  }
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
getDataDir()
get client datadir path
getWebspaceDir()
get client webspacedir path
+ Here is the call graph for this function:

◆ delete()

ilClient::delete (   $a_ini = true,
  $a_db = false,
  $a_files = false 
)

delete client

Parameters
booleanremove ini if true
booleanremove db if true
booleanremove files if true
Returns
array confirmation messages

Definition at line 766 of file class.ilClient.php.

References ilUtil\delDir(), getDbName(), and getId().

767  {
768  if ($a_ini === true and file_exists(ILIAS_ABSOLUTE_PATH . "/" . ILIAS_WEB_DIR . "/" . $this->getId() . "/client.ini.php")) {
769  unlink(CLIENT_WEB_DIR . "/client.ini.php");
770  $msg[] = "ini_deleted";
771  }
772 
773  if ($a_db === true and $this->db_exists) {
774  $this->db->query("DROP DATABASE " . $this->getDbName());
775  $msg[] = "db_deleted";
776  }
777 
778  if ($a_files === true and file_exists(CLIENT_WEB_DIR) and is_dir(CLIENT_WEB_DIR)) {
779  // rmdir();
780  ilUtil::delDir(CLIENT_WEB_DIR);
781  ilUtil::delDir(CLIENT_DATA_DIR);
782  $msg[] = "files_deleted";
783  }
784 
785  return $msg;
786  }
getDbName()
get name of database
getId()
get client id
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ Here is the call graph for this function:

◆ getAllSettings()

ilClient::getAllSettings ( )

read all values from settings table public

Returns
array keyword/value pairs

Definition at line 580 of file class.ilClient.php.

Referenced by getURLStringForNIC().

581  {
582  include_once './Services/Administration/classes/class.ilSetting.php';
583  $set = new ilSetting("common", true);
584  return $set->getAll();
585  }
+ Here is the caller graph for this function:

◆ getDataDir()

ilClient::getDataDir ( )

get client datadir path

Returns
string client datadir path

Definition at line 526 of file class.ilClient.php.

References getId().

Referenced by create().

527  {
528  return ILIAS_DATA_DIR . "/" . $this->getId();
529  }
getId()
get client id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDB()

ilClient::getDB ( )

get mysql version

Get DB object

Definition at line 202 of file class.ilClient.php.

References $db.

203  {
204  return $this->db;
205  }

◆ getDbHost()

ilClient::getDbHost ( )

get db host

Returns
string db host

Definition at line 312 of file class.ilClient.php.

313  {
314  return $this->ini->readVariable("db", "host");
315  }

◆ getDbName()

ilClient::getDbName ( )

get name of database

Returns
string name of database

Definition at line 330 of file class.ilClient.php.

Referenced by delete().

331  {
332  return $this->ini->readVariable("db", "name");
333  }
+ Here is the caller graph for this function:

◆ getDbPass()

ilClient::getDbPass ( )

get db password

Returns
string db password

Definition at line 384 of file class.ilClient.php.

385  {
386  return $this->ini->readVariable("db", "pass");
387  }

◆ getDbPort()

ilClient::getDbPort ( )

get db port

Returns
string db port

Definition at line 357 of file class.ilClient.php.

358  {
359  return $this->ini->readVariable("db", "port");
360  }

◆ getDBSetup()

ilClient::getDBSetup (   $cached = true)
Parameters
bool$cached
Returns

Definition at line 64 of file class.ilClient.php.

References $db_setup, and ilDbSetup\getNewInstanceForClient().

Referenced by checkDatabaseExists(), getSetting(), init(), provideGlobalDB(), and revokeGlobalDB().

65  {
66  require_once('./setup/classes/class.ilDbSetup.php');
67 
68  if ($cached) {
69  if (is_null($this->db_setup)) {
70  $this->db_setup = \ilDbSetup::getNewInstanceForClient($this);
71  }
72  return $this->db_setup;
73  }
74 
75 
76  return \ilDbSetup::getNewInstanceForClient($this);
77  }
static getNewInstanceForClient(\ilClient $client)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDbSlaveActive()

ilClient::getDbSlaveActive ( )

get slave active

Returns
int active

Definition at line 403 of file class.ilClient.php.

404  {
405  return (int) $this->ini->readVariable("db", "slave_active");
406  }

◆ getDbSlaveHost()

ilClient::getDbSlaveHost ( )

get db slave host

Returns
string db host

Definition at line 422 of file class.ilClient.php.

423  {
424  return $this->ini->readVariable("db", "slave_host");
425  }

◆ getDbSlaveName()

ilClient::getDbSlaveName ( )

get name of slave database

Returns
string name of database

Definition at line 440 of file class.ilClient.php.

441  {
442  return $this->ini->readVariable("db", "slave_name");
443  }

◆ getDbSlavePass()

ilClient::getDbSlavePass ( )

get slave db password

Returns
string db password

Definition at line 494 of file class.ilClient.php.

495  {
496  return $this->ini->readVariable("db", "slave_pass");
497  }

◆ getDbSlavePort()

ilClient::getDbSlavePort ( )

get slave db port

Returns
string db port

Definition at line 467 of file class.ilClient.php.

468  {
469  return $this->ini->readVariable("db", "slave_port");
470  }

◆ getDbSlaveUser()

ilClient::getDbSlaveUser ( )

get slave db user

Returns
string db user

Definition at line 458 of file class.ilClient.php.

459  {
460  return $this->ini->readVariable("db", "slave_user");
461  }

◆ getDbType()

ilClient::getDbType ( )

get type of database

Returns
string name of database

Definition at line 512 of file class.ilClient.php.

Referenced by ilDbSetup\__construct(), DBSetup\__construct(), and setDSN().

513  {
514  $val = $this->ini->readVariable("db", "type");
515  if ($val == "") {
516  return "mysql";
517  } else {
518  return $val;
519  }
520  }
+ Here is the caller graph for this function:

◆ getDbUser()

ilClient::getDbUser ( )

get db user

Returns
string db user

Definition at line 348 of file class.ilClient.php.

349  {
350  return $this->ini->readVariable("db", "user");
351  }

◆ getDefaultLanguage()

ilClient::getDefaultLanguage ( )

Definition at line 721 of file class.ilClient.php.

References getSetting().

722  {
723  return $this->getSetting("language");
724  }
getSetting($a_keyword)
read one value from settings table
+ Here is the call graph for this function:

◆ getDescription()

ilClient::getDescription ( )

get client description

Returns
string client description

Definition at line 177 of file class.ilClient.php.

178  {
179  return $this->ini->readVariable("client", "description");
180  }

◆ getError()

ilClient::getError ( )

get error message and clear error var

Returns
string error message

Definition at line 741 of file class.ilClient.php.

References $error.

742  {
744  $this->error = "";
745 
746  return $error;
747  }

◆ getId()

ilClient::getId ( )

get client id

Returns
string client id

Definition at line 140 of file class.ilClient.php.

References $id.

Referenced by __construct(), delete(), getDataDir(), ilDbSetup\getInstanceForClient(), DBSetup\getInstanceForClient(), getWebspaceDir(), and init().

141  {
142  return $this->id;
143  }
+ Here is the caller graph for this function:

◆ getName()

ilClient::getName ( )

get client name

Returns
string client name

Definition at line 159 of file class.ilClient.php.

160  {
161  return $this->ini->readVariable("client", "name");
162  }

◆ getNICkey()

ilClient::getNICkey ( )

get nic_key public

Returns
string nic_key

Definition at line 710 of file class.ilClient.php.

References getSetting(), and setNICkey().

Referenced by getURLStringForNIC().

711  {
712  $this->nic_key = $this->getSetting("nic_key");
713 
714  if (empty($this->nic_key)) {
715  $this->setNICkey();
716  }
717 
718  return $this->nic_key;
719  }
setNICkey()
set nic_key generate nic_key if nic_key field in cust table is empty.
getSetting($a_keyword)
read one value from settings table
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSetting()

ilClient::getSetting (   $a_keyword)

read one value from settings table

public

Parameters
stringkeyword
Returns
string value

Definition at line 563 of file class.ilClient.php.

References $ilDB, and getDBSetup().

Referenced by ilSetup\checkClientDatabase(), getDefaultLanguage(), and getNICkey().

564  {
565  global $ilDB;
566  if (!$this->getDBSetup()->isDatabaseInstalled() || !$ilDB) {
567  return false;
568  }
569  include_once './Services/Administration/classes/class.ilSetting.php';
570  $set = new ilSetting("common", true);
571 
572  return $set->get($a_keyword);
573  }
global $ilDB
getDBSetup($cached=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getURLStringForNIC()

ilClient::getURLStringForNIC (   $a_nic_url)
Parameters
stringurl to ilias nic server
Returns
string url with required parameters

Definition at line 605 of file class.ilClient.php.

References $_SERVER, $url, getAllSettings(), getNICkey(), and ILIAS_HTTP_PATH.

Referenced by updateNIC().

606  {
607  $settings = $this->getAllSettings();
608 
609  $inst_id = (empty($settings["inst_id"])) ? "0" : $settings["inst_id"];
610 
611  // send host information to ilias-nic
612  //#18132: removed ipadr, server_port, server_software, institution, contact_title, contact_position,
613  // contact_institution, contact_street, contact_pcode, contact_city, contact_country, contact_phone
614  $url = $a_nic_url .
615  "?cmd=getid" .
616  "&inst_id=" . rawurlencode($inst_id) .
617  "&hostname=" . rawurlencode($_SERVER["SERVER_NAME"]) .
618  "&inst_name=" . rawurlencode($this->ini->readVariable("client", "name")) .
619  "&inst_info=" . rawurlencode($this->ini->readVariable("client", "description")) .
620  "&http_path=" . rawurlencode(ILIAS_HTTP_PATH) .
621  "&contact_firstname=" . rawurlencode($settings["admin_firstname"]) .
622  "&contact_lastname=" . rawurlencode($settings["admin_lastname"]) .
623  "&contact_email=" . rawurlencode($settings["admin_email"]) .
624  "&nic_key=" . rawurlencode($this->getNICkey());
625 
626  return $url;
627  }
getNICkey()
get nic_key public
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
getAllSettings()
read all values from settings table public
$url
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getWebspaceDir()

ilClient::getWebspaceDir ( )

get client webspacedir path

Returns
string clietn webspacedir path

Definition at line 535 of file class.ilClient.php.

References getId().

Referenced by create().

536  {
537  return ILIAS_ABSOLUTE_PATH . "/" . ILIAS_WEB_DIR . "/" . $this->getId();
538  }
getId()
get client id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init()

ilClient::init ( )

init client load client.ini and set some constants

Returns
boolean

Definition at line 84 of file class.ilClient.php.

References getDBSetup(), and getId().

85  {
86  $this->ini = new ilIniFile($this->ini_file_path);
87 
88  // load defaults only if no client.ini was found
89  if (!@file_exists($this->ini_file_path)) {
90  //echo "<br>A-".$this->ini_file_path."-";
91  $this->ini->GROUPS = parse_ini_file($this->client_defaults, true);
92 
93  return false;
94  }
95 
96  // read client.ini
97  if (!$this->ini->read()) {
98  $this->error = get_class($this) . ": " . $this->ini->getError();
99 
100  return false;
101  }
102 
103  // only for ilias main
104  define("CLIENT_WEB_DIR", ILIAS_ABSOLUTE_PATH . "/" . ILIAS_WEB_DIR . "/" . $this->getId());
105  define("CLIENT_DATA_DIR", ILIAS_DATA_DIR . "/" . $this->getId());
106  define("DEVMODE", $this->ini->readVariable('system', 'DEVMODE'));
107  define("ROOT_FOLDER_ID", $this->ini->readVariable('system', 'ROOT_FOLDER_ID'));
108  define("SYSTEM_FOLDER_ID", $this->ini->readVariable('system', 'SYSTEM_FOLDER_ID'));
109  define("ROLE_FOLDER_ID", $this->ini->readVariable('system', 'ROLE_FOLDER_ID'));
110  define("ANONYMOUS_USER_ID", 13);
111  define("ANONYMOUS_ROLE_ID", 14);
112  define("SYSTEM_USER_ID", 6);
113  define("SYSTEM_ROLE_ID", 2);
114 
115  $this->db_exists = $this->getDBSetup()->isConnectable();
116  $this->getDBSetup()->provideGlobalDB();
117  if ($this->db_exists) {
118  $this->db_installed = $this->getDBSetup()->isDatabaseInstalled();
119  }
120 
121  return true;
122  }
getId()
get client id
INIFile Parser.
getDBSetup($cached=true)
+ Here is the call graph for this function:

◆ isInstalledDB()

ilClient::isInstalledDB ( $a_db)

check if client db is installed

Parameters
objectdb object
Returns
boolean true if installed

Definition at line 252 of file class.ilClient.php.

253  {
254  if (method_exists($a_db, 'loadModule')) {
255  $a_db->loadModule('Manager');
256  }
257  if (!$tables = $a_db->listTables()) {
258  return false;
259  }
260 
261  // check existence of some basic tables from ilias3 to determine if ilias3 is already installed in given database
262  if (in_array("object_data", $tables) and in_array("object_reference", $tables) and in_array("usr_data", $tables) and in_array("rbac_ua", $tables)) {
263  $this->db_installed = true;
264  return true;
265  }
266  $this->db_installed = false;
267  return false;
268  }

◆ provideGlobalDB()

ilClient::provideGlobalDB ( )

Definition at line 125 of file class.ilClient.php.

References getDBSetup().

Referenced by ilSetup\checkClientDatabase(), ilSetup\checkClientLanguages(), and ilSetup\checkClientProxySettings().

126  {
127  $this->getDBSetup()->provideGlobalDB();
128  }
getDBSetup($cached=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reconnect()

ilClient::reconnect ( )

Definition at line 550 of file class.ilClient.php.

References connect().

551  {
552  $this->connect();
553  }
connect()
connect to client database
+ Here is the call graph for this function:

◆ revokeGlobalDB()

ilClient::revokeGlobalDB ( )

Definition at line 131 of file class.ilClient.php.

References getDBSetup().

Referenced by ilSetup\checkClientDatabase(), and ilSetup\checkClientLanguages().

132  {
133  $this->getDBSetup()->provideGlobalDB();
134  }
getDBSetup($cached=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDbHost()

ilClient::setDbHost (   $a_str)

set the host

Parameters
string

Definition at line 302 of file class.ilClient.php.

303  {
304  $this->ini->setVariable("db", "host", $a_str);
305  }

◆ setDbName()

ilClient::setDbName (   $a_str)

set the name of database

Parameters
string

Definition at line 321 of file class.ilClient.php.

322  {
323  $this->ini->setVariable("db", "name", $a_str);
324  }

◆ setDbPass()

ilClient::setDbPass (   $a_str)

set db password

Parameters
string

Definition at line 375 of file class.ilClient.php.

376  {
377  $this->ini->setVariable("db", "pass", $a_str);
378  }

◆ setDbPort()

ilClient::setDbPort (   $a_str)

set db port

Parameters
string

Definition at line 366 of file class.ilClient.php.

367  {
368  $this->ini->setVariable("db", "port", $a_str);
369  }

◆ setDbSlaveActive()

ilClient::setDbSlaveActive (   $a_act)

set the slave active

Parameters
int

Definition at line 393 of file class.ilClient.php.

394  {
395  $this->ini->setVariable("db", "slave_active", (int) $a_act);
396  }

◆ setDbSlaveHost()

ilClient::setDbSlaveHost (   $a_str)

set the slave host

Parameters
string

Definition at line 412 of file class.ilClient.php.

413  {
414  $this->ini->setVariable("db", "slave_host", $a_str);
415  }

◆ setDbSlaveName()

ilClient::setDbSlaveName (   $a_str)

set the name of slave database

Parameters
string

Definition at line 431 of file class.ilClient.php.

432  {
433  $this->ini->setVariable("db", "slave_name", $a_str);
434  }

◆ setDbSlavePass()

ilClient::setDbSlavePass (   $a_str)

set slave db password

Parameters
string

Definition at line 485 of file class.ilClient.php.

486  {
487  $this->ini->setVariable("db", "slave_pass", $a_str);
488  }

◆ setDbSlavePort()

ilClient::setDbSlavePort (   $a_str)

set slave db port

Parameters
string

Definition at line 476 of file class.ilClient.php.

477  {
478  $this->ini->setVariable("db", "slave_port", $a_str);
479  }

◆ setDbSlaveUser()

ilClient::setDbSlaveUser (   $a_str)

set slave db user

Parameters
stringdb user

Definition at line 449 of file class.ilClient.php.

450  {
451  $this->ini->setVariable("db", "slave_user", $a_str);
452  }

◆ setDbType()

ilClient::setDbType (   $a_str)

set the type of database

Parameters
string

Definition at line 503 of file class.ilClient.php.

504  {
505  $this->ini->setVariable("db", "type", $a_str);
506  }

◆ setDbUser()

ilClient::setDbUser (   $a_str)

set db user

Parameters
stringdb user

Definition at line 339 of file class.ilClient.php.

340  {
341  $this->ini->setVariable("db", "user", $a_str);
342  }

◆ setDefaultLanguage()

ilClient::setDefaultLanguage (   $a_lang_key)

Definition at line 726 of file class.ilClient.php.

References setSetting().

727  {
728  $this->setSetting("language", $a_lang_key);
729  $this->ini->setVariable("language", "default", $a_lang_key);
730  $this->ini->write();
731 
732  return true;
733  }
setSetting($a_key, $a_val)
write one value to settings table public
+ Here is the call graph for this function:

◆ setDescription()

ilClient::setDescription (   $a_str)

set client description

Parameters
stringclient description

Definition at line 186 of file class.ilClient.php.

187  {
188  $this->ini->setVariable("client", "description", $a_str);
189  }

◆ setDSN()

ilClient::setDSN ( )

set the dsn and dsn_host

Definition at line 273 of file class.ilClient.php.

References getDbType().

274  {
275  switch ($this->getDbType()) {
276  case "postgres":
277  $db_port_str = "";
278  if (trim($this->getdbPort()) != "") {
279  $db_port_str = ":" . $this->getdbPort();
280  }
281  $this->dsn_host = "pgsql://" . $this->getdbUser() . ":" . $this->getdbPass() . "@" . $this->getdbHost() . $db_port_str;
282  $this->dsn = "pgsql://" . $this->getdbUser() . ":" . $this->getdbPass() . "@" . $this->getdbHost() . $db_port_str . "/" . $this->getdbName();
283  break;
284 
285  case "mysql":
286  case "innodb":
287  default:
288  $db_port_str = "";
289  if (trim($this->getdbPort()) != "") {
290  $db_port_str = ":" . $this->getdbPort();
291  }
292  $this->dsn_host = "mysql://" . $this->getdbUser() . ":" . $this->getdbPass() . "@" . $this->getdbHost() . $db_port_str;
293  $this->dsn = "mysql://" . $this->getdbUser() . ":" . $this->getdbPass() . "@" . $this->getdbHost() . $db_port_str . "/" . $this->getdbName();
294  break;
295  }
296  }
getDbType()
get type of database
+ Here is the call graph for this function:

◆ setError()

ilClient::setError (   $error_message)
Parameters
$error_message

Definition at line 753 of file class.ilClient.php.

Referenced by updateNIC().

754  {
755  $this->error = $error_message;
756  }
+ Here is the caller graph for this function:

◆ setId()

ilClient::setId (   $a_client_id)

set client id

Parameters
stringclient id

Definition at line 149 of file class.ilClient.php.

References $id.

150  {
151  $this->id = $a_client_id;
152  $this->webspace_dir = ILIAS_ABSOLUTE_PATH . "/" . ILIAS_WEB_DIR . "/" . $this->id;
153  }

◆ setName()

ilClient::setName (   $a_str)

set client name

Parameters
stringclient name

Definition at line 168 of file class.ilClient.php.

169  {
170  $this->ini->setVariable("client", "name", $a_str);
171  }

◆ setNICkey()

ilClient::setNICkey ( )

set nic_key generate nic_key if nic_key field in cust table is empty.

the nic_key is used for authentication update requests sent to the ILIAS-NIC server. public

Returns
boolean

Definition at line 692 of file class.ilClient.php.

References $_SERVER, and setSetting().

Referenced by getNICkey().

693  {
694  mt_srand((double) microtime() * 1000000);
695  $nic_key = md5(str_replace(".", "", $_SERVER["SERVER_ADDR"]) +
696  mt_rand(100000, 999999));
697 
698  $this->setSetting("nic_key", $nic_key);
699 
700  $this->nic_key = $nic_key;
701 
702  return true;
703  }
setSetting($a_key, $a_val)
write one value to settings table public
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSetting()

ilClient::setSetting (   $a_key,
  $a_val 
)

write one value to settings table public

Parameters
stringkeyword
stringvalue
Returns
boolean true on success

Definition at line 594 of file class.ilClient.php.

Referenced by setDefaultLanguage(), and setNICkey().

595  {
596  include_once './Services/Administration/classes/class.ilSetting.php';
597  $set = new ilSetting("common", true);
598  $set->set($a_key, $a_val);
599  }
+ Here is the caller graph for this function:

◆ updateNIC()

ilClient::updateNIC (   $a_nic_url)

Connect to ILIAS-NIC.

This function establishes a HTTP connection to the ILIAS Network Information Center (NIC) in order to update the ILIAS-NIC host database and - in case of a newly installed system - obtain an installation id at first connection. This function my be put into a dedicated include file as soon as there are more functions concerning the interconnection of ILIAS hosts

Parameters
void
Returns
string/array $ret error message or data array

Definition at line 643 of file class.ilClient.php.

References $GLOBALS, XapiProxy\$req, $response, $url, ilCurlConnection\_isCurlExtensionLoaded(), ilLoggerFactory\getLogger(), getURLStringForNIC(), and setError().

644  {
645  $max_redirects = 5;
646  $socket_timeout = 5;
647 
648  require_once(__DIR__ . "/../../Services/WebServices/Curl/classes/class.ilCurlConnection.php");
650  $this->setError("CURL-extension not loaded.");
651  return false;
652  }
653 
654  if (!isset($GLOBALS["ilSetting"])) {
655  $GLOBALS["ilSetting"] = new ilSetting();
656  }
657 
658  $url = $this->getURLStringForNIC($a_nic_url);
659  $req = new ilCurlConnection($url);
660  $req->init();
661 
662  $req->setOpt(CURLOPT_HEADER, 1);
663  $req->setOpt(CURLOPT_RETURNTRANSFER, 1);
664  $req->setOpt(CURLOPT_CONNECTTIMEOUT, $socket_timeout);
665  $req->setOpt(CURLOPT_MAXREDIRS, $max_redirects);
666  $response = $req->exec();
667 
668  $req->parseResponse($response);
669  $response_body = $req->getResponseBody();
670 
671  $info = $req->getInfo();
672  if ($info["http_code"] != "200") {
673  $this->setError("Could not connect to NIC-Server at '" . $url . "'");
674  return false;
675  }
676 
677  $this->nic_status = explode("\n", $response_body);
678 
679  ilLoggerFactory::getLogger('setup')->dump($this->nic_status);
680 
681  return true;
682  }
setError($error_message)
getURLStringForNIC($a_nic_url)
static _isCurlExtensionLoaded()
Check if curl extension is loaded.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static getLogger($a_component_id)
Get component logger.
$url
$response
+ Here is the call graph for this function:

◆ writeIni()

ilClient::writeIni ( )

write init

Parameters

Definition at line 864 of file class.ilClient.php.

865  {
866  $this->ini->write();
867  }

Field Documentation

◆ $client_defaults

ilClient::$client_defaults

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

◆ $db

ilClient::$db

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

Referenced by connect(), and getDB().

◆ $db_exists

ilClient::$db_exists = false

Definition at line 17 of file class.ilClient.php.

◆ $db_installed

ilClient::$db_installed = false

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

◆ $db_setup

ilClient::$db_setup = null
protected

Definition at line 40 of file class.ilClient.php.

Referenced by getDBSetup().

◆ $dir

ilClient::$dir

Definition at line 15 of file class.ilClient.php.

◆ $error

ilClient::$error = ''

Definition at line 27 of file class.ilClient.php.

Referenced by getError().

◆ $id

ilClient::$id

Definition at line 14 of file class.ilClient.php.

Referenced by getId(), and setId().

◆ $ini

ilClient::$ini

Definition at line 35 of file class.ilClient.php.

◆ $name

ilClient::$name

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

◆ $nic_status

ilClient::$nic_status

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

◆ $setup_ok

ilClient::$setup_ok = false

Definition at line 22 of file class.ilClient.php.

◆ $status

ilClient::$status

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


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