ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilClient Class Reference

Client Management. More...

+ Collaboration diagram for ilClient:

Public Member Functions

 __construct ($a_client_id, $a_db_connections)
 ilClient constructor. More...
 
 getDBSetup ()
 
 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
 

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,
  $a_db_connections 
)

ilClient constructor.

Parameters
$a_client_id
$a_db_connections

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

References getId().

45  {
46  if ($a_client_id)
47  {
48  $this->id = $a_client_id;
49  $this->ini_file_path = ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR."/".$this->getId()."/client.ini.php";
50  }
51 
52  $this->db_connections = $a_db_connections;
53 
54  // set path default.ini
55  $this->client_defaults = ILIAS_ABSOLUTE_PATH."/setup/client.master.ini.php";
56  }
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 559 of file class.ilClient.php.

References $db, $GLOBALS, getDBSetup(), MDB2\isError(), and isInstalledDB().

560  {
561  return $this->getDBSetup()->isConnectable();
562 
563  //try to connect to database
564  $db = $this->db_connections->connectDB($this->dsn);
565  if (MDB2::isError($db))
566  {
567  return false;
568  }
569 
570  if (!$this->isInstalledDB($db))
571  {
572  return false;
573  }
574 
575  // #10633
576  if($a_keep_connection)
577  {
578  $GLOBALS["ilDB"] = $this->db;
579  $GLOBALS["DIC"]["ilDB"] = function($c) {
580  return $GLOBALS["ilDB"];
581  };
582  }
583 
584  return true;
585  }
isError($data, $code=null)
Tell whether a value is a MDB2 error.
Definition: MDB2.php:599
isInstalledDB(&$a_db)
check if client db is installed
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
+ Here is the call graph for this function:

◆ connect()

ilClient::connect ( )

connect to client database

Returns
boolean true on success

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

References $db, and $GLOBALS.

Referenced by reconnect().

199  {
200  // check parameters
201  // To support oracle tnsnames.ora dbname is not required
202  if (!$this->getdbHost() || !$this->getdbUser()) {
203  $this->error = "empty_fields";
204 
205  return false;
206  }
207 
208  include_once("./Services/Database/classes/class.ilDBWrapperFactory.php");
209  $this->db = ilDBWrapperFactory::getWrapper($this->getdbType(),
210  $this->ini->readVariable("db","inactive_mysqli"));
211  $this->db->setDBUser($this->getdbUser());
212  $this->db->setDBPort($this->getdbPort());
213  $this->db->setDBPassword($this->getdbPass());
214  $this->db->setDBHost($this->getdbHost());
215  $this->db->setDBName($this->getdbName());
216  $con = $this->db->connect(true);
217 
218  if (!$con)
219  {
220  $this->error = "Database connection failed.";
221  return false;
222  }
223  $GLOBALS["ilDB"] = $this->db;
224  $GLOBALS["DIC"]["ilDB"] = function($c) {
225  return $GLOBALS["ilDB"];
226  };
227 
228  $this->db_exists = true;
229  return true;
230  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
+ 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 834 of file class.ilClient.php.

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

835  {
836  //var_dump($this->getDataDir());exit;
837  // create base data dir
838  if (!ilUtil::makeDir($this->getDataDir()))
839  {
840  $this->error = "could_not_create_base_data_dir :".$this->getDataDir();
841  return false;
842  }
843 
844  // create sub dirs in base data dir
845  if (!ilUtil::makeDir($this->getDataDir()."/mail"))
846  {
847  $this->error = "could_not_create_mail_data_dir :".$this->getDataDir()."/mail";
848  return false;
849  }
850 
851  if (!ilUtil::makeDir($this->getDataDir()."/lm_data"))
852  {
853  $this->error = "could_not_create_lm_data_dir :".$this->getDataDir()."/lm_data";
854  return false;
855  }
856 
857  if (!ilUtil::makeDir($this->getDataDir()."/forum"))
858  {
859  $this->error = "could_not_create_forum_data_dir :".$this->getDataDir()."/forum";
860  return false;
861  }
862 
863  if (!ilUtil::makeDir($this->getDataDir()."/files"))
864  {
865  $this->error = "could_not_create_files_data_dir :".$this->getDataDir()."/files";
866  return false;
867  }
868 
869  // create base webspace dir
870  if (!ilUtil::makeDir($this->getWebspaceDir()))
871  {
872  $this->error = "could_not_create_base_webspace_dir :".$this->getWebspaceDir();
873  return false;
874  }
875 
876  // create sub dirs in base webspace dir
877  if (!ilUtil::makeDir($this->getWebspaceDir()."/lm_data"))
878  {
879  $this->error = "could_not_create_lm_webspace_dir :".$this->getWebspaceDir()."/lm_data";
880  return false;
881  }
882 
883  if (!ilUtil::makeDir($this->getWebspaceDir()."/usr_images"))
884  {
885  $this->error = "could_not_create_usr_images_webspace_dir :".$this->getWebspaceDir()."/usr_images";
886  return false;
887  }
888 
889  if (!ilUtil::makeDir($this->getWebspaceDir()."/mobs"))
890  {
891  $this->error = "could_not_create_mobs_webspace_dir :".$this->getWebspaceDir()."/mobs";
892  return false;
893  }
894 
895  if (!ilUtil::makeDir($this->getWebspaceDir()."/css"))
896  {
897  $this->error = "could_not_create_css_webspace_dir :".$this->getWebspaceDir()."/css";
898  return false;
899  }
900 
901  // write client ini
902  if (!$this->ini->write())
903  {
904  $this->error = get_class($this).": ".$this->ini->getError();
905  return false;
906  }
907 
908  return true;
909  }
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 805 of file class.ilClient.php.

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

806  {
807  if ($a_ini === true and file_exists(ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR."/".$this->getId()."/client.ini.php"))
808  {
809  unlink(CLIENT_WEB_DIR."/client.ini.php");
810  $msg[] = "ini_deleted";
811  }
812 
813  if ($a_db === true and $this->db_exists)
814  {
815  $this->db->query("DROP DATABASE ".$this->getDbName());
816  $msg[] = "db_deleted";
817  }
818 
819  if ($a_files === true and file_exists(CLIENT_WEB_DIR) and is_dir(CLIENT_WEB_DIR))
820  {
821  // rmdir();
822  ilUtil::delDir(CLIENT_WEB_DIR);
823  ilUtil::delDir(CLIENT_DATA_DIR);
824  $msg[] = "files_deleted";
825  }
826 
827  return $msg;
828  }
getDbName()
get name of database
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 616 of file class.ilClient.php.

Referenced by getURLStringForNIC(), and updateNIC().

617  {
618  include_once './Services/Administration/classes/class.ilSetting.php';
619  $set = new ilSetting("common", true);
620  return $set->getAll();
621  }
ILIAS Setting Class.
+ Here is the caller graph for this function:

◆ getDataDir()

ilClient::getDataDir ( )

get client datadir path

Returns
string client datadir path

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

References getId().

Referenced by create().

541  {
542  return ILIAS_DATA_DIR."/".$this->getId();
543  }
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 189 of file class.ilClient.php.

References $db.

190  {
191  return $this->db;
192  }

◆ getDbHost()

ilClient::getDbHost ( )

get db host

Returns
string db host

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

324  {
325  return $this->ini->readVariable("db","host");
326  }

◆ getDbName()

ilClient::getDbName ( )

get name of database

Returns
string name of database

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

Referenced by delete().

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

◆ getDbPass()

ilClient::getDbPass ( )

get db password

Returns
string db password

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

396  {
397  return $this->ini->readVariable("db","pass");
398  }

◆ getDbPort()

ilClient::getDbPort ( )

get db port

Returns
string db port

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

369  {
370  return $this->ini->readVariable("db","port");
371  }

◆ getDBSetup()

ilClient::getDBSetup ( )
Returns

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

References ilDbSetup\getInstanceForClient().

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

62  {
63  require_once('./setup/classes/class.ilDbSetup.php');
64 
65  return ilDbSetup::getInstanceForClient($this);
66  }
static getInstanceForClient(\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 414 of file class.ilClient.php.

415  {
416  return (int) $this->ini->readVariable("db","slave_active");
417  }

◆ getDbSlaveHost()

ilClient::getDbSlaveHost ( )

get db slave host

Returns
string db host

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

434  {
435  return $this->ini->readVariable("db","slave_host");
436  }

◆ getDbSlaveName()

ilClient::getDbSlaveName ( )

get name of slave database

Returns
string name of database

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

452  {
453  return $this->ini->readVariable("db","slave_name");
454  }

◆ getDbSlavePass()

ilClient::getDbSlavePass ( )

get slave db password

Returns
string db password

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

506  {
507  return $this->ini->readVariable("db","slave_pass");
508  }

◆ getDbSlavePort()

ilClient::getDbSlavePort ( )

get slave db port

Returns
string db port

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

479  {
480  return $this->ini->readVariable("db","slave_port");
481  }

◆ getDbSlaveUser()

ilClient::getDbSlaveUser ( )

get slave db user

Returns
string db user

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

470  {
471  return $this->ini->readVariable("db","slave_user");
472  }

◆ getDbType()

ilClient::getDbType ( )

get type of database

Returns
string name of database

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

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

524  {
525  $val = $this->ini->readVariable("db","type");
526  if ($val == "")
527  {
528  return "mysql";
529  }
530  else
531  {
532  return $val;
533  }
534  }
+ Here is the caller graph for this function:

◆ getDbUser()

ilClient::getDbUser ( )

get db user

Returns
string db user

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

360  {
361  return $this->ini->readVariable("db","user");
362  }

◆ getDefaultLanguage()

ilClient::getDefaultLanguage ( )

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

References getSetting().

763  {
764  return $this->getSetting("language");
765  }
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 164 of file class.ilClient.php.

165  {
166  return $this->ini->readVariable("client","description");
167  }

◆ getError()

ilClient::getError ( )

get error message and clear error var

Returns
string error message

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

References $error.

782  {
784  $this->error = "";
785 
786  return $error;
787  }

◆ getId()

ilClient::getId ( )

get client id

Returns
string client id

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

References $id.

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

128  {
129  return $this->id;
130  }
+ Here is the caller graph for this function:

◆ getName()

ilClient::getName ( )

get client name

Returns
string client name

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

147  {
148  return $this->ini->readVariable("client","name");
149  }

◆ getNICkey()

ilClient::getNICkey ( )

get nic_key public

Returns
string nic_key

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

References getSetting(), and setNICkey().

Referenced by getURLStringForNIC().

751  {
752  $this->nic_key = $this->getSetting("nic_key");
753 
754  if (empty($this->nic_key))
755  {
756  $this->setNICkey();
757  }
758 
759  return $this->nic_key;
760  }
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 600 of file class.ilClient.php.

References $ilDB, and getDBSetup().

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

600  {
601  global $ilDB;
602  if (!$this->getDBSetup()->isDatabaseInstalled() || !$ilDB) {
603  return false;
604  }
605  include_once './Services/Administration/classes/class.ilSetting.php';
606  $set = new ilSetting("common", true);
607 
608  return $set->get($a_keyword);
609  }
ILIAS Setting Class.
global $ilDB
+ 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 641 of file class.ilClient.php.

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

Referenced by updateNIC().

642  {
643  $settings = $this->getAllSettings();
644 
645  $inst_id = (empty($settings["inst_id"])) ? "0" : $settings["inst_id"];
646 
647  // send host information to ilias-nic
648  //#18132: removed ipadr, server_port, server_software, institution, contact_title, contact_position,
649  // contact_institution, contact_street, contact_pcode, contact_city, contact_country, contact_phone
650  $url = $a_nic_url.
651  "?cmd=getid".
652  "&inst_id=".rawurlencode($inst_id).
653  "&hostname=".rawurlencode($_SERVER["SERVER_NAME"]).
654  "&inst_name=".rawurlencode($this->ini->readVariable("client","name")).
655  "&inst_info=".rawurlencode($this->ini->readVariable("client","description")).
656  "&http_path=".rawurlencode(ILIAS_HTTP_PATH).
657  "&contact_firstname=".rawurlencode($settings["admin_firstname"]).
658  "&contact_lastname=".rawurlencode($settings["admin_lastname"]).
659  "&contact_email=".rawurlencode($settings["admin_email"]).
660  "&nic_key=".rawurlencode($this->getNICkey());
661 
662  return $url;
663  }
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
$url
Definition: shib_logout.php:72
getNICkey()
get nic_key public
getAllSettings()
read all values from settings table public
+ 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 549 of file class.ilClient.php.

References getId().

Referenced by create().

550  {
551  return ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR."/".$this->getId();
552  }
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 73 of file class.ilClient.php.

References getDBSetup(), and getId().

74  {
75  $this->ini = new ilIniFile($this->ini_file_path);
76 
77  // load defaults only if no client.ini was found
78  if (!@file_exists($this->ini_file_path)) {
79  //echo "<br>A-".$this->ini_file_path."-";
80  $this->ini->GROUPS = parse_ini_file($this->client_defaults, true);
81 
82  return false;
83  }
84 
85  // read client.ini
86  if (!$this->ini->read()) {
87  $this->error = get_class($this) . ": " . $this->ini->getError();
88 
89  return false;
90  }
91 
92  // only for ilias main
93  define("CLIENT_WEB_DIR", ILIAS_ABSOLUTE_PATH . "/" . ILIAS_WEB_DIR . "/" . $this->getId());
94  define("CLIENT_DATA_DIR", ILIAS_DATA_DIR . "/" . $this->getId());
95  define("DEVMODE", $this->ini->readVariable('system', 'DEVMODE'));
96  define("ROOT_FOLDER_ID", $this->ini->readVariable('system', 'ROOT_FOLDER_ID'));
97  define("SYSTEM_FOLDER_ID", $this->ini->readVariable('system', 'SYSTEM_FOLDER_ID'));
98  define("ROLE_FOLDER_ID", $this->ini->readVariable('system', 'ROLE_FOLDER_ID'));
99  define("ANONYMOUS_USER_ID", 13);
100  define("ANONYMOUS_ROLE_ID", 14);
101  define("SYSTEM_USER_ID", 6);
102  define("SYSTEM_ROLE_ID", 2);
103 
104  $this->db_exists = $this->getDBSetup()->isConnectable();
105  $this->getDBSetup()->provideGlobalDB();
106  if ($this->db_exists) {
107  $this->db_installed = $this->getDBSetup()->isDatabaseInstalled();
108  }
109 
110  return true;
111  }
getId()
get client id
INIFile Parser.
+ 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 237 of file class.ilClient.php.

Referenced by checkDatabaseExists().

238  {
239  if(method_exists($a_db,'loadModule'))
240  {
241  $a_db->loadModule('Manager');
242  }
243  if(!$tables = $a_db->listTables())
244  {
245  return false;
246  }
247 
248  // check existence of some basic tables from ilias3 to determine if ilias3 is already installed in given database
249  if (in_array("object_data",$tables) and in_array("object_reference",$tables) and in_array("usr_data",$tables) and in_array("rbac_ua",$tables))
250  {
251  $this->db_installed = true;
252  return true;
253  }
254  $this->db_installed = false;
255  return false;
256  }
+ Here is the caller graph for this function:

◆ provideGlobalDB()

ilClient::provideGlobalDB ( )

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

References getDBSetup().

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

114  {
115  $this->getDBSetup()->provideGlobalDB();
116  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reconnect()

ilClient::reconnect ( )

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

References connect().

588  {
589  $this->connect();
590  }
connect()
connect to client database
+ Here is the call graph for this function:

◆ revokeGlobalDB()

ilClient::revokeGlobalDB ( )

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

References getDBSetup().

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

119  {
120  $this->getDBSetup()->provideGlobalDB();
121  }
+ 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 313 of file class.ilClient.php.

314  {
315  $this->ini->setVariable("db","host",$a_str);
316  }

◆ setDbName()

ilClient::setDbName (   $a_str)

set the name of database

Parameters
string

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

333  {
334  $this->ini->setVariable("db","name",$a_str);
335  }

◆ setDbPass()

ilClient::setDbPass (   $a_str)

set db password

Parameters
string

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

387  {
388  $this->ini->setVariable("db","pass",$a_str);
389  }

◆ setDbPort()

ilClient::setDbPort (   $a_str)

set db port

Parameters
string

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

378  {
379  $this->ini->setVariable("db","port",$a_str);
380  }

◆ setDbSlaveActive()

ilClient::setDbSlaveActive (   $a_act)

set the slave active

Parameters
int

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

405  {
406  $this->ini->setVariable("db","slave_active", (int) $a_act);
407  }

◆ setDbSlaveHost()

ilClient::setDbSlaveHost (   $a_str)

set the slave host

Parameters
string

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

424  {
425  $this->ini->setVariable("db","slave_host",$a_str);
426  }

◆ setDbSlaveName()

ilClient::setDbSlaveName (   $a_str)

set the name of slave database

Parameters
string

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

443  {
444  $this->ini->setVariable("db","slave_name",$a_str);
445  }

◆ setDbSlavePass()

ilClient::setDbSlavePass (   $a_str)

set slave db password

Parameters
string

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

497  {
498  $this->ini->setVariable("db","slave_pass",$a_str);
499  }

◆ setDbSlavePort()

ilClient::setDbSlavePort (   $a_str)

set slave db port

Parameters
string

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

488  {
489  $this->ini->setVariable("db","slave_port",$a_str);
490  }

◆ setDbSlaveUser()

ilClient::setDbSlaveUser (   $a_str)

set slave db user

Parameters
stringdb user

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

461  {
462  $this->ini->setVariable("db","slave_user",$a_str);
463  }

◆ setDbType()

ilClient::setDbType (   $a_str)

set the type of database

Parameters
string

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

515  {
516  $this->ini->setVariable("db","type",$a_str);
517  }

◆ setDbUser()

ilClient::setDbUser (   $a_str)

set db user

Parameters
stringdb user

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

351  {
352  $this->ini->setVariable("db","user",$a_str);
353  }

◆ setDefaultLanguage()

ilClient::setDefaultLanguage (   $a_lang_key)

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

References setSetting().

768  {
769  $this->setSetting("language",$a_lang_key);
770  $this->ini->setVariable("language","default",$a_lang_key);
771  $this->ini->write();
772 
773  return true;
774  }
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 173 of file class.ilClient.php.

174  {
175  $this->ini->setVariable("client","description",$a_str);
176  }

◆ setDSN()

ilClient::setDSN ( )

set the dsn and dsn_host

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

References array, and getDbType().

262  {
263  switch($this->getDbType())
264  {
265  case "oracle":
266  //$this->dsn_host = "oci8://".$this->getdbUser().":".$this->getdbPass()."@".$this->getdbHost();
267  $this->dsn_host = array(
268  'phptype' => 'oci8',
269  'hostspec' => $this->getdbHost(),
270  'username' => $this->getdbUser(),
271  'port' => $this->getdbPort(),
272  'password' => $this->getdbPass(),
273  );
274  //$this->dsn = "oci8://".$this->getdbUser().":".$this->getdbPass()."@".$this->getdbHost()."/?service=".$this->getdbName();
275  $this->dsn = $this->dsn = array(
276  'phptype' => 'oci8',
277  'hostspec' => $this->getdbHost(),
278  'username' => $this->getdbUser(),
279  'port' => $this->getdbPort(),
280  'password' => $this->getdbPass(),
281  'service' => $this->getdbName()
282  );
283  break;
284 
285  case "postgres":
286  $db_port_str = "";
287  if (trim($this->getdbPort()) != "")
288  {
289  $db_port_str = ":".$this->getdbPort();
290  }
291  $this->dsn_host = "pgsql://".$this->getdbUser().":".$this->getdbPass()."@".$this->getdbHost().$db_port_str;
292  $this->dsn = "pgsql://".$this->getdbUser().":".$this->getdbPass()."@".$this->getdbHost().$db_port_str."/".$this->getdbName();
293  break;
294 
295  case "mysql":
296  case "innodb":
297  default:
298  $db_port_str = "";
299  if (trim($this->getdbPort()) != "")
300  {
301  $db_port_str = ":".$this->getdbPort();
302  }
303  $this->dsn_host = "mysql://".$this->getdbUser().":".$this->getdbPass()."@".$this->getdbHost().$db_port_str;
304  $this->dsn = "mysql://".$this->getdbUser().":".$this->getdbPass()."@".$this->getdbHost().$db_port_str."/".$this->getdbName();
305  break;
306  }
307  }
Create styles array
The data for the language used.
getDbType()
get type of database
+ Here is the call graph for this function:

◆ setError()

ilClient::setError (   $error_message)
Parameters
$error_message

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

Referenced by updateNIC().

793  {
794  $this->error = $error_message;
795  }
+ Here is the caller graph for this function:

◆ setId()

ilClient::setId (   $a_client_id)

set client id

Parameters
stringclient id

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

References $id.

137  {
138  $this->id = $a_client_id;
139  $this->webspace_dir = ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR."/".$this->id;
140  }

◆ setName()

ilClient::setName (   $a_str)

set client name

Parameters
stringclient name

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

156  {
157  $this->ini->setVariable("client","name",$a_str);
158  }

◆ 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 732 of file class.ilClient.php.

References $_SERVER, and setSetting().

Referenced by getNICkey().

733  {
734  mt_srand((double)microtime()*1000000);
735  $nic_key = md5(str_replace(".","",$_SERVER["SERVER_ADDR"]) +
736  mt_rand(100000,999999));
737 
738  $this->setSetting("nic_key",$nic_key);
739 
740  $this->nic_key = $nic_key;
741 
742  return true;
743  }
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
setSetting($a_key, $a_val)
write one value to settings table public
+ 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 630 of file class.ilClient.php.

Referenced by setDefaultLanguage(), and setNICkey().

631  {
632  include_once './Services/Administration/classes/class.ilSetting.php';
633  $set = new ilSetting("common", true);
634  $set->set($a_key, $a_val);
635  }
ILIAS Setting Class.
+ 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 679 of file class.ilClient.php.

References $info, $url, ilCurlConnection\_isCurlExtensionLoaded(), getAllSettings(), ilLoggerFactory\getLogger(), getURLStringForNIC(), and setError().

680  {
681  $max_redirects = 5;
682  $socket_timeout = 5;
683 
684  require_once(__DIR__."/../../Services/WebServices/Curl/classes/class.ilCurlConnection.php");
686  $this->setError("CURL-extension not loaded.");
687  return false;
688  }
689 
690  $url = $this->getURLStringForNIC($a_nic_url);
691  $req = new ilCurlConnection($url);
692  $req->init();
693 
694  $settings = $this->getAllSettings();
695  if((bool)$settings['proxy_status'] && strlen($settings['proxy_host']) && strlen($settings['proxy_port']))
696  {
697  $req->setOpt(CURLOPT_HTTPPROXYTUNNEL, true);
698  $req->setOpt(CURLOPT_PROXY, $settings["proxy_host"]);
699  $req->setOpt(CURLOPT_PROXYPORT, $settings["proxy_port"]);
700  }
701 
702  $req->setOpt(CURLOPT_HEADER, 1);
703  $req->setOpt(CURLOPT_RETURNTRANSFER, 1);
704  $req->setOpt(CURLOPT_CONNECTTIMEOUT, $socket_timeout);
705  $req->setOpt(CURLOPT_MAXREDIRS, $max_redirects);
706  $response = $req->exec();
707 
708  $req->parseResponse($response);
709  $response_body = $req->getResponseBody();
710 
711  $info = $req->getInfo();
712  if ($info["http_code"] != "200") {
713  $this->setError("Could not connect to NIC-Server at '".$url."'");
714  return false;
715  }
716 
717  $this->nic_status = explode("\n", $response_body);
718 
719  ilLoggerFactory::getLogger('setup')->dump($nic_status);
720 
721  return true;
722  }
setError($error_message)
$url
Definition: shib_logout.php:72
$info
Definition: example_052.php:80
getURLStringForNIC($a_nic_url)
static _isCurlExtensionLoaded()
Check if curl extension is loaded.
getAllSettings()
read all values from settings table public
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:

◆ writeIni()

ilClient::writeIni ( )

write init

Parameters

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

918  {
919  $this->ini->write();
920  }

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 checkDatabaseExists(), 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.

◆ $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: