ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilClient Class Reference

Client Management. More...

+ Collaboration diagram for ilClient:

Public Member Functions

 ilClient ($a_client_id, $a_db_connections)
 Constructor. More...
 
 init ()
 init client load client.ini and set some constants More...
 
 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...
 
 checkDatabaseHost ()
 check database connection More...
 
 checkDatabaseExists ($a_keep_connection=false)
 check database connection with database name More...
 
 reconnect ()
 
 getSetting ($a_keyword)
 read one value from settings table public 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...
 
 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
 

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.

Member Function Documentation

◆ checkDatabaseExists()

ilClient::checkDatabaseExists (   $a_keep_connection = false)

check database connection with database name

Returns
boolean

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

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

553  {
554  //try to connect to database
555  $db = $this->db_connections->connectDB($this->dsn);
556  if (MDB2::isError($db))
557  {
558  return false;
559  }
560 
561  if (!$this->isInstalledDB($db))
562  {
563  return false;
564  }
565 
566  // #10633
567  if($a_keep_connection)
568  {
569  $GLOBALS["ilDB"] = $this->db;
570  }
571 
572  return true;
573  }
isError($data, $code=null)
Tell whether a value is a MDB2 error.
Definition: MDB2.php:594
isInstalledDB(&$a_db)
check if client db is installed
$GLOBALS['ct_recipient']
+ Here is the call graph for this function:

◆ checkDatabaseHost()

ilClient::checkDatabaseHost ( )

check database connection

Returns
boolean

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

References $lng, getDbType(), and MDB2\isError().

528  {
529  global $lng;
530 
531  if ($this->getDbType() == "oracle")
532  {
533  return true;
534  }
535 
536  //connect to databasehost
537  $db = $this->db_connections->connectHost($this->dsn_host);
538  if (MDB2::isError($db))
539  {
540  //$this->error = $db->getMessage()."! Please check database hostname, username & password.";
541  $this->error = $db->getMessage()." - ".$db->getUserInfo()." - ".$lng->txt("db_error_please_check");
542  return false;
543  }
544 
545  return true;
546  }
isError($data, $code=null)
Tell whether a value is a MDB2 error.
Definition: MDB2.php:594
getDbType()
get type of database
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ connect()

ilClient::connect ( )

connect to client database

Returns
boolean true on success

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

References $GLOBALS, and ilDBWrapperFactory\getWrapper().

Referenced by init(), and reconnect().

164  {
165  // check parameters
166  // To support oracle tnsnames.ora dbname is not required
167  if (!$this->getdbHost() || !$this->getdbUser())
168  {
169  $this->error = "empty_fields";
170  return false;
171  }
172  /*
173  if (!$this->getdbHost() || !$this->getdbName() || !$this->getdbUser())
174  {
175  $this->error = "empty_fields";
176  return false;
177  }
178  */
179 
180  include_once("./Services/Database/classes/class.ilDBWrapperFactory.php");
181  $this->db = ilDBWrapperFactory::getWrapper($this->getdbType(),
182  $this->ini->readVariable("db","inactive_mysqli"));
183  $this->db->setDBUser($this->getdbUser());
184  $this->db->setDBPort($this->getdbPort());
185  $this->db->setDBPassword($this->getdbPass());
186  $this->db->setDBHost($this->getdbHost());
187  $this->db->setDBName($this->getdbName());
188  $con = $this->db->connect(true);
189 
190  if (!$con)
191  {
192  $this->error = "Database connection failed.";
193  return false;
194  }
195  $GLOBALS["ilDB"] = $this->db;
196 
197  $this->db_exists = true;
198  return true;
199  }
$GLOBALS['ct_recipient']
static getWrapper($a_type, $a_inactive_mysqli=null)
+ 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 801 of file class.ilClient.php.

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

802  {
803  //var_dump($this->getDataDir());exit;
804  // create base data dir
805  if (!ilUtil::makeDir($this->getDataDir()))
806  {
807  $this->error = "could_not_create_base_data_dir :".$this->getDataDir();
808  return false;
809  }
810 
811  // create sub dirs in base data dir
812  if (!ilUtil::makeDir($this->getDataDir()."/mail"))
813  {
814  $this->error = "could_not_create_mail_data_dir :".$this->getDataDir()."/mail";
815  return false;
816  }
817 
818  if (!ilUtil::makeDir($this->getDataDir()."/lm_data"))
819  {
820  $this->error = "could_not_create_lm_data_dir :".$this->getDataDir()."/lm_data";
821  return false;
822  }
823 
824  if (!ilUtil::makeDir($this->getDataDir()."/forum"))
825  {
826  $this->error = "could_not_create_forum_data_dir :".$this->getDataDir()."/forum";
827  return false;
828  }
829 
830  if (!ilUtil::makeDir($this->getDataDir()."/files"))
831  {
832  $this->error = "could_not_create_files_data_dir :".$this->getDataDir()."/files";
833  return false;
834  }
835 
836  // create base webspace dir
837  if (!ilUtil::makeDir($this->getWebspaceDir()))
838  {
839  $this->error = "could_not_create_base_webspace_dir :".$this->getWebspaceDir();
840  return false;
841  }
842 
843  // create sub dirs in base webspace dir
844  if (!ilUtil::makeDir($this->getWebspaceDir()."/lm_data"))
845  {
846  $this->error = "could_not_create_lm_webspace_dir :".$this->getWebspaceDir()."/lm_data";
847  return false;
848  }
849 
850  if (!ilUtil::makeDir($this->getWebspaceDir()."/usr_images"))
851  {
852  $this->error = "could_not_create_usr_images_webspace_dir :".$this->getWebspaceDir()."/usr_images";
853  return false;
854  }
855 
856  if (!ilUtil::makeDir($this->getWebspaceDir()."/mobs"))
857  {
858  $this->error = "could_not_create_mobs_webspace_dir :".$this->getWebspaceDir()."/mobs";
859  return false;
860  }
861 
862  if (!ilUtil::makeDir($this->getWebspaceDir()."/css"))
863  {
864  $this->error = "could_not_create_css_webspace_dir :".$this->getWebspaceDir()."/css";
865  return false;
866  }
867 
868  // write client ini
869  if (!$this->ini->write())
870  {
871  $this->error = get_class($this).": ".$this->ini->getError();
872  return false;
873  }
874 
875  return true;
876  }
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 772 of file class.ilClient.php.

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

773  {
774  if ($a_ini === true and file_exists(ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR."/".$this->getId()."/client.ini.php"))
775  {
776  unlink(CLIENT_WEB_DIR."/client.ini.php");
777  $msg[] = "ini_deleted";
778  }
779 
780  if ($a_db === true and $this->db_exists)
781  {
782  $this->db->query("DROP DATABASE ".$this->getDbName());
783  $msg[] = "db_deleted";
784  }
785 
786  if ($a_files === true and file_exists(CLIENT_WEB_DIR) and is_dir(CLIENT_WEB_DIR))
787  {
788  // rmdir();
789  ilUtil::delDir(CLIENT_WEB_DIR);
790  ilUtil::delDir(CLIENT_DATA_DIR);
791  $msg[] = "files_deleted";
792  }
793 
794  return $msg;
795  }
getDbName()
get name of database
const ILIAS_WEB_DIR
const ILIAS_ABSOLUTE_PATH
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 598 of file class.ilClient.php.

Referenced by getURLStringForNIC(), and updateNIC().

599  {
600  include_once './Services/Administration/classes/class.ilSetting.php';
601  $set = new ilSetting("common", true);
602  return $set->getAll();
603  }
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 509 of file class.ilClient.php.

References getId().

Referenced by create().

510  {
511  return ILIAS_DATA_DIR."/".$this->getId();
512  }
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 154 of file class.ilClient.php.

155  {
156  return $this->db;
157  }

◆ getDbHost()

ilClient::getDbHost ( )

get db host

Returns
string db host

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

293  {
294  return $this->ini->readVariable("db","host");
295  }

◆ getDbName()

ilClient::getDbName ( )

get name of database

Returns
string name of database

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

Referenced by delete().

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

◆ getDbPass()

ilClient::getDbPass ( )

get db password

Returns
string db password

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

365  {
366  return $this->ini->readVariable("db","pass");
367  }

◆ getDbPort()

ilClient::getDbPort ( )

get db port

Returns
string db port

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

338  {
339  return $this->ini->readVariable("db","port");
340  }

◆ getDbSlaveActive()

ilClient::getDbSlaveActive ( )

get slave active

Returns
int active

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

384  {
385  return (int) $this->ini->readVariable("db","slave_active");
386  }

◆ getDbSlaveHost()

ilClient::getDbSlaveHost ( )

get db slave host

Returns
string db host

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

403  {
404  return $this->ini->readVariable("db","slave_host");
405  }

◆ getDbSlaveName()

ilClient::getDbSlaveName ( )

get name of slave database

Returns
string name of database

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

421  {
422  return $this->ini->readVariable("db","slave_name");
423  }

◆ getDbSlavePass()

ilClient::getDbSlavePass ( )

get slave db password

Returns
string db password

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

475  {
476  return $this->ini->readVariable("db","slave_pass");
477  }

◆ getDbSlavePort()

ilClient::getDbSlavePort ( )

get slave db port

Returns
string db port

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

448  {
449  return $this->ini->readVariable("db","slave_port");
450  }

◆ getDbSlaveUser()

ilClient::getDbSlaveUser ( )

get slave db user

Returns
string db user

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

439  {
440  return $this->ini->readVariable("db","slave_user");
441  }

◆ getDbType()

ilClient::getDbType ( )

get type of database

Returns
string name of database

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

Referenced by checkDatabaseHost(), and setDSN().

493  {
494  $val = $this->ini->readVariable("db","type");
495  if ($val == "")
496  {
497  return "mysql";
498  }
499  else
500  {
501  return $val;
502  }
503  }
+ Here is the caller graph for this function:

◆ getDbUser()

ilClient::getDbUser ( )

get db user

Returns
string db user

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

329  {
330  return $this->ini->readVariable("db","user");
331  }

◆ getDefaultLanguage()

ilClient::getDefaultLanguage ( )

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

References getSetting().

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

◆ getDescription()

ilClient::getDescription ( )

get client description

Returns
string client description

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

130  {
131  return $this->ini->readVariable("client","description");
132  }

◆ getError()

ilClient::getError ( )

get error message and clear error var

Returns
string error message

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

757  {
758  $error = $this->error;
759  $this->error = "";
760 
761  return $error;
762  }

◆ getId()

ilClient::getId ( )

get client id

Returns
string client id

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

References $id.

Referenced by getDataDir(), getWebspaceDir(), and ilClient().

93  {
94  return $this->id;
95  }
+ Here is the caller graph for this function:

◆ getName()

ilClient::getName ( )

get client name

Returns
string client name

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

112  {
113  return $this->ini->readVariable("client","name");
114  }

◆ getNICkey()

ilClient::getNICkey ( )

get nic_key public

Returns
string nic_key

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

References getSetting(), and setNICkey().

Referenced by getURLStringForNIC().

727  {
728  $this->nic_key = $this->getSetting("nic_key");
729 
730  if (empty($this->nic_key))
731  {
732  $this->setNICkey();
733  }
734 
735  return $this->nic_key;
736  }
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 public
+ 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 586 of file class.ilClient.php.

Referenced by getDefaultLanguage(), and getNICkey().

587  {
588  include_once './Services/Administration/classes/class.ilSetting.php';
589  $set = new ilSetting("common", true);
590  return $set->get($a_keyword);
591  }
ILIAS Setting Class.
+ 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 623 of file class.ilClient.php.

References getAllSettings(), and getNICkey().

Referenced by updateNIC().

624  {
625  $settings = $this->getAllSettings();
626 
627  $inst_id = (empty($settings["inst_id"])) ? "0" : $settings["inst_id"];
628 
629  // send host information to ilias-nic
630  $url = $a_nic_url.
631  "?cmd=getid".
632  "&inst_id=".rawurlencode($inst_id).
633  "&hostname=".rawurlencode($_SERVER["SERVER_NAME"]).
634  "&ipadr=".rawurlencode($_SERVER["SERVER_ADDR"]).
635  "&server_port=".rawurlencode($_SERVER["SERVER_PORT"]).
636  "&server_software=".rawurlencode($_SERVER["SERVER_SOFTWARE"]).
637  "&inst_name=".rawurlencode($this->ini->readVariable("client","name")).
638  "&inst_info=".rawurlencode($this->ini->readVariable("client","description")).
639  "&institution=".rawurlencode($settings["inst_institution"]).
640  "&http_path=".rawurlencode(ILIAS_HTTP_PATH).
641  "&contact_firstname=".rawurlencode($settings["admin_firstname"]).
642  "&contact_lastname=".rawurlencode($settings["admin_lastname"]).
643  "&contact_title=".rawurlencode($settings["admin_title"]).
644  "&contact_position=".rawurlencode($settings["admin_position"]).
645  "&contact_institution=".rawurlencode($settings["admin_institution"]).
646  "&contact_street=".rawurlencode($settings["admin_street"]).
647  "&contact_pcode=".rawurlencode($settings["admin_zipcode"]).
648  "&contact_city=".rawurlencode($settings["admin_city"]).
649  "&contact_country=".rawurlencode($settings["admin_country"]).
650  "&contact_phone=".rawurlencode($settings["admin_phone"]).
651  "&contact_email=".rawurlencode($settings["admin_email"]).
652  "&nic_key=".rawurlencode($this->getNICkey()).
653  "&version=".rawurlencode($settings["ilias_version"]);
654 
655  return $url;
656  }
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 518 of file class.ilClient.php.

References getId(), ILIAS_ABSOLUTE_PATH, and ILIAS_WEB_DIR.

Referenced by create().

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

◆ ilClient()

ilClient::ilClient (   $a_client_id,
  $a_db_connections 
)

Constructor.

Parameters
stringclient id

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

References getId(), ILIAS_ABSOLUTE_PATH, and ILIAS_WEB_DIR.

30  {
31  if ($a_client_id)
32  {
33  $this->id = $a_client_id;
34  $this->ini_file_path = ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR."/".$this->getId()."/client.ini.php";
35  }
36 
37  $this->db_connections = $a_db_connections;
38 
39  // set path default.ini
40  $this->client_defaults = ILIAS_ABSOLUTE_PATH."/setup/client.master.ini.php";
41  }
const ILIAS_WEB_DIR
const ILIAS_ABSOLUTE_PATH
getId()
get client id
+ Here is the call graph for this function:

◆ init()

ilClient::init ( )

init client load client.ini and set some constants

Returns
boolean

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

References connect(), ILIAS_ABSOLUTE_PATH, ILIAS_WEB_DIR, and isInstalledDB().

49  {
50  $this->ini = new ilIniFile($this->ini_file_path);
51 
52  // load defaults only if no client.ini was found
53  if (!@file_exists($this->ini_file_path))
54  {
55 //echo "<br>A-".$this->ini_file_path."-";
56  $this->ini->GROUPS = parse_ini_file($this->client_defaults,true);
57  return false;
58  }
59 
60  // read client.ini
61  if (!$this->ini->read())
62  {
63  $this->error = get_class($this).": ".$this->ini->getError();
64  return false;
65  }
66 
67  // only for ilias main
68  define("CLIENT_WEB_DIR",ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR."/".$this->getId());
69  define("CLIENT_DATA_DIR",ILIAS_DATA_DIR."/".$this->getId());
70  define ("DEVMODE",$this->ini->readVariable('system','DEVMODE'));
71  define ("ROOT_FOLDER_ID",$this->ini->readVariable('system','ROOT_FOLDER_ID'));
72  define ("SYSTEM_FOLDER_ID",$this->ini->readVariable('system','SYSTEM_FOLDER_ID'));
73  define ("ROLE_FOLDER_ID",$this->ini->readVariable('system','ROLE_FOLDER_ID'));
74  define ("ANONYMOUS_USER_ID",13);
75  define ("ANONYMOUS_ROLE_ID",14);
76  define ("SYSTEM_USER_ID",6);
77  define ("SYSTEM_ROLE_ID",2);
78 
79  $this->db_exists = $this->connect();
80  if ($this->db_exists)
81  {
82  $this->db_installed = $this->isInstalledDB($this->db);
83  }
84 
85  return true;
86  }
isInstalledDB(&$a_db)
check if client db is installed
connect()
connect to client database
const ILIAS_WEB_DIR
const ILIAS_ABSOLUTE_PATH
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 206 of file class.ilClient.php.

Referenced by checkDatabaseExists(), and init().

207  {
208  if(method_exists($a_db,'loadModule'))
209  {
210  $a_db->loadModule('Manager');
211  }
212  if(!$tables = $a_db->listTables())
213  {
214  return false;
215  }
216 
217  // check existence of some basic tables from ilias3 to determine if ilias3 is already installed in given database
218  if (in_array("object_data",$tables) and in_array("object_reference",$tables) and in_array("usr_data",$tables) and in_array("rbac_ua",$tables))
219  {
220  $this->db_installed = true;
221  return true;
222  }
223  $this->db_installed = false;
224  return false;
225  }
+ Here is the caller graph for this function:

◆ reconnect()

ilClient::reconnect ( )

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

References connect().

576  {
577  $this->connect();
578  }
connect()
connect to client database
+ Here is the call graph for this function:

◆ setDbHost()

ilClient::setDbHost (   $a_str)

set the host

Parameters
string

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

283  {
284  $this->ini->setVariable("db","host",$a_str);
285  }

◆ setDbName()

ilClient::setDbName (   $a_str)

set the name of database

Parameters
string

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

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

◆ setDbPass()

ilClient::setDbPass (   $a_str)

set db password

Parameters
string

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

356  {
357  $this->ini->setVariable("db","pass",$a_str);
358  }

◆ setDbPort()

ilClient::setDbPort (   $a_str)

set db port

Parameters
string

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

347  {
348  $this->ini->setVariable("db","port",$a_str);
349  }

◆ setDbSlaveActive()

ilClient::setDbSlaveActive (   $a_act)

set the slave active

Parameters
int

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

374  {
375  $this->ini->setVariable("db","slave_active", (int) $a_act);
376  }

◆ setDbSlaveHost()

ilClient::setDbSlaveHost (   $a_str)

set the slave host

Parameters
string

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

393  {
394  $this->ini->setVariable("db","slave_host",$a_str);
395  }

◆ setDbSlaveName()

ilClient::setDbSlaveName (   $a_str)

set the name of slave database

Parameters
string

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

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

◆ setDbSlavePass()

ilClient::setDbSlavePass (   $a_str)

set slave db password

Parameters
string

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

466  {
467  $this->ini->setVariable("db","slave_pass",$a_str);
468  }

◆ setDbSlavePort()

ilClient::setDbSlavePort (   $a_str)

set slave db port

Parameters
string

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

457  {
458  $this->ini->setVariable("db","slave_port",$a_str);
459  }

◆ setDbSlaveUser()

ilClient::setDbSlaveUser (   $a_str)

set slave db user

Parameters
stringdb user

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

430  {
431  $this->ini->setVariable("db","slave_user",$a_str);
432  }

◆ setDbType()

ilClient::setDbType (   $a_str)

set the type of database

Parameters
string

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

484  {
485  $this->ini->setVariable("db","type",$a_str);
486  }

◆ setDbUser()

ilClient::setDbUser (   $a_str)

set db user

Parameters
stringdb user

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

320  {
321  $this->ini->setVariable("db","user",$a_str);
322  }

◆ setDefaultLanguage()

ilClient::setDefaultLanguage (   $a_lang_key)

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

References setSetting().

744  {
745  $this->setSetting("language",$a_lang_key);
746  $this->ini->setVariable("language","default",$a_lang_key);
747  $this->ini->write();
748 
749  return true;
750  }
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 138 of file class.ilClient.php.

139  {
140  $this->ini->setVariable("client","description",$a_str);
141  }

◆ setDSN()

ilClient::setDSN ( )

set the dsn and dsn_host

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

References getDbType().

231  {
232  switch($this->getDbType())
233  {
234  case "oracle":
235  //$this->dsn_host = "oci8://".$this->getdbUser().":".$this->getdbPass()."@".$this->getdbHost();
236  $this->dsn_host = array(
237  'phptype' => 'oci8',
238  'hostspec' => $this->getdbHost(),
239  'username' => $this->getdbUser(),
240  'port' => $this->getdbPort(),
241  'password' => $this->getdbPass(),
242  );
243  //$this->dsn = "oci8://".$this->getdbUser().":".$this->getdbPass()."@".$this->getdbHost()."/?service=".$this->getdbName();
244  $this->dsn = $this->dsn = array(
245  'phptype' => 'oci8',
246  'hostspec' => $this->getdbHost(),
247  'username' => $this->getdbUser(),
248  'port' => $this->getdbPort(),
249  'password' => $this->getdbPass(),
250  'service' => $this->getdbName()
251  );
252  break;
253 
254  case "postgres":
255  $db_port_str = "";
256  if (trim($this->getdbPort()) != "")
257  {
258  $db_port_str = ":".$this->getdbPort();
259  }
260  $this->dsn_host = "pgsql://".$this->getdbUser().":".$this->getdbPass()."@".$this->getdbHost().$db_port_str;
261  $this->dsn = "pgsql://".$this->getdbUser().":".$this->getdbPass()."@".$this->getdbHost().$db_port_str."/".$this->getdbName();
262  break;
263 
264  case "mysql":
265  case "innodb":
266  default:
267  $db_port_str = "";
268  if (trim($this->getdbPort()) != "")
269  {
270  $db_port_str = ":".$this->getdbPort();
271  }
272  $this->dsn_host = "mysql://".$this->getdbUser().":".$this->getdbPass()."@".$this->getdbHost().$db_port_str;
273  $this->dsn = "mysql://".$this->getdbUser().":".$this->getdbPass()."@".$this->getdbHost().$db_port_str."/".$this->getdbName();
274  break;
275  }
276  }
getDbType()
get type of database
+ Here is the call graph for this function:

◆ setId()

ilClient::setId (   $a_client_id)

set client id

Parameters
stringclient id

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

References $id, ILIAS_ABSOLUTE_PATH, and ILIAS_WEB_DIR.

102  {
103  $this->id = $a_client_id;
104  $this->webspace_dir = ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR."/".$this->id;
105  }
const ILIAS_WEB_DIR
const ILIAS_ABSOLUTE_PATH

◆ setName()

ilClient::setName (   $a_str)

set client name

Parameters
stringclient name

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

121  {
122  $this->ini->setVariable("client","name",$a_str);
123  }

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

References setSetting().

Referenced by getNICkey().

709  {
710  mt_srand((double)microtime()*1000000);
711  $nic_key = md5(str_replace(".","",$_SERVER["SERVER_ADDR"]) +
712  mt_rand(100000,999999));
713 
714  $this->setSetting("nic_key",$nic_key);
715 
716  $this->nic_key = $nic_key;
717 
718  return true;
719  }
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 612 of file class.ilClient.php.

Referenced by setDefaultLanguage(), and setNICkey().

613  {
614  include_once './Services/Administration/classes/class.ilSetting.php';
615  $set = new ilSetting("common", true);
616  $set->set($a_key, $a_val);
617  }
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 672 of file class.ilClient.php.

References getAllSettings(), and getURLStringForNIC().

673  {
674  $settings = $this->getAllSettings();
675  if((bool)$settings['proxy_status'] && strlen($settings['proxy_host']) && strlen($settings['proxy_port']))
676  {
677  $proxy_options = array(
678  'proxy_host' => $settings['proxy_host'],
679  'proxy_port' => $settings['proxy_port']
680  );
681  }
682  else
683  {
684  $proxy_options = array();
685  }
686 
687  include_once('HTTP/Request.php');
688  $url = $this->getURLStringForNIC($a_nic_url);
689  $req = new HTTP_Request($url, $proxy_options);
690 
691  $req->sendRequest();
692  $response = $req->getResponseBody();
693  $response = explode("\n", $response);
694 
695  $this->nic_status = $response;
696 
697  return true;
698  }
getURLStringForNIC($a_nic_url)
getAllSettings()
read all values from settings table public
+ Here is the call graph for this function:

◆ writeIni()

ilClient::writeIni ( )

write init

Parameters

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

885  {
886  $this->ini->write();
887  }

Field Documentation

◆ $client_defaults

ilClient::$client_defaults

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

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

◆ $id

ilClient::$id

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

Referenced by getId(), and setId().

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