ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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
 
 $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.

Member Function Documentation

◆ checkDatabaseExists()

ilClient::checkDatabaseExists (   $a_keep_connection = false)

check database connection with database name

Returns
boolean

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

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

563  {
564  //try to connect to database
565  $db = $this->db_connections->connectDB($this->dsn);
566  if (MDB2::isError($db))
567  {
568  return false;
569  }
570 
571  if (!$this->isInstalledDB($db))
572  {
573  return false;
574  }
575 
576  // #10633
577  if($a_keep_connection)
578  {
579  $GLOBALS["ilDB"] = $this->db;
580  }
581 
582  return true;
583  }
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 537 of file class.ilClient.php.

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

538  {
539  global $lng;
540 
541  if ($this->getDbType() == "oracle")
542  {
543  return true;
544  }
545 
546  //connect to databasehost
547  $db = $this->db_connections->connectHost($this->dsn_host);
548  if (MDB2::isError($db))
549  {
550  //$this->error = $db->getMessage()."! Please check database hostname, username & password.";
551  $this->error = $db->getMessage()." - ".$db->getUserInfo()." - ".$lng->txt("db_error_please_check");
552  return false;
553  }
554 
555  return true;
556  }
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 173 of file class.ilClient.php.

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

Referenced by init(), and reconnect().

174  {
175  // check parameters
176  // To support oracle tnsnames.ora dbname is not required
177  if (!$this->getdbHost() || !$this->getdbUser())
178  {
179  $this->error = "empty_fields";
180  return false;
181  }
182  /*
183  if (!$this->getdbHost() || !$this->getdbName() || !$this->getdbUser())
184  {
185  $this->error = "empty_fields";
186  return false;
187  }
188  */
189 
190  include_once("./Services/Database/classes/class.ilDBWrapperFactory.php");
191  $this->db = ilDBWrapperFactory::getWrapper($this->getdbType(),
192  $this->ini->readVariable("db","inactive_mysqli"));
193  $this->db->setDBUser($this->getdbUser());
194  $this->db->setDBPort($this->getdbPort());
195  $this->db->setDBPassword($this->getdbPass());
196  $this->db->setDBHost($this->getdbHost());
197  $this->db->setDBName($this->getdbName());
198  $con = $this->db->connect(true);
199 
200  if (!$con)
201  {
202  $this->error = "Database connection failed.";
203  return false;
204  }
205  $GLOBALS["ilDB"] = $this->db;
206 
207  $this->db_exists = true;
208  return true;
209  }
$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 800 of file class.ilClient.php.

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

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

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

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

Referenced by getURLStringForNIC(), and updateNIC().

609  {
610  include_once './Services/Administration/classes/class.ilSetting.php';
611  $set = new ilSetting("common", true);
612  return $set->getAll();
613  }
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 519 of file class.ilClient.php.

References getId().

Referenced by create().

520  {
521  return ILIAS_DATA_DIR."/".$this->getId();
522  }
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 164 of file class.ilClient.php.

References $db.

165  {
166  return $this->db;
167  }

◆ getDbHost()

ilClient::getDbHost ( )

get db host

Returns
string db host

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

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

◆ getDbName()

ilClient::getDbName ( )

get name of database

Returns
string name of database

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

Referenced by delete().

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

◆ getDbPass()

ilClient::getDbPass ( )

get db password

Returns
string db password

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

375  {
376  return $this->ini->readVariable("db","pass");
377  }

◆ getDbPort()

ilClient::getDbPort ( )

get db port

Returns
string db port

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

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

◆ getDbSlaveActive()

ilClient::getDbSlaveActive ( )

get slave active

Returns
int active

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

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

◆ getDbSlaveHost()

ilClient::getDbSlaveHost ( )

get db slave host

Returns
string db host

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

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

◆ getDbSlaveName()

ilClient::getDbSlaveName ( )

get name of slave database

Returns
string name of database

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

431  {
432  return $this->ini->readVariable("db","slave_name");
433  }

◆ getDbSlavePass()

ilClient::getDbSlavePass ( )

get slave db password

Returns
string db password

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

485  {
486  return $this->ini->readVariable("db","slave_pass");
487  }

◆ getDbSlavePort()

ilClient::getDbSlavePort ( )

get slave db port

Returns
string db port

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

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

◆ getDbSlaveUser()

ilClient::getDbSlaveUser ( )

get slave db user

Returns
string db user

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

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

◆ getDbType()

ilClient::getDbType ( )

get type of database

Returns
string name of database

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

Referenced by checkDatabaseHost(), and setDSN().

503  {
504  $val = $this->ini->readVariable("db","type");
505  if ($val == "")
506  {
507  return "mysql";
508  }
509  else
510  {
511  return $val;
512  }
513  }
+ Here is the caller graph for this function:

◆ getDbUser()

ilClient::getDbUser ( )

get db user

Returns
string db user

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

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

◆ getDefaultLanguage()

ilClient::getDefaultLanguage ( )

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

References getSetting().

738  {
739  return $this->getSetting("language");
740  }
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 139 of file class.ilClient.php.

140  {
141  return $this->ini->readVariable("client","description");
142  }

◆ getError()

ilClient::getError ( )

get error message and clear error var

Returns
string error message

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

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

◆ getId()

ilClient::getId ( )

get client id

Returns
string client id

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

References $id.

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

103  {
104  return $this->id;
105  }
+ Here is the caller graph for this function:

◆ getName()

ilClient::getName ( )

get client name

Returns
string client name

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

122  {
123  return $this->ini->readVariable("client","name");
124  }

◆ getNICkey()

ilClient::getNICkey ( )

get nic_key public

Returns
string nic_key

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

References getSetting(), and setNICkey().

Referenced by getURLStringForNIC().

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

Referenced by getDefaultLanguage(), and getNICkey().

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

References getAllSettings(), and getNICkey().

Referenced by updateNIC().

634  {
635  $settings = $this->getAllSettings();
636 
637  $inst_id = (empty($settings["inst_id"])) ? "0" : $settings["inst_id"];
638 
639  // send host information to ilias-nic
640  //#18132: removed ipadr, server_port, server_software, institution, contact_title, contact_position,
641  // contact_institution, contact_street, contact_pcode, contact_city, contact_country, contact_phone
642  $url = $a_nic_url.
643  "?cmd=getid".
644  "&inst_id=".rawurlencode($inst_id).
645  "&hostname=".rawurlencode($_SERVER["SERVER_NAME"]).
646  "&inst_name=".rawurlencode($this->ini->readVariable("client","name")).
647  "&inst_info=".rawurlencode($this->ini->readVariable("client","description")).
648  "&http_path=".rawurlencode(ILIAS_HTTP_PATH).
649  "&contact_firstname=".rawurlencode($settings["admin_firstname"]).
650  "&contact_lastname=".rawurlencode($settings["admin_lastname"]).
651  "&contact_email=".rawurlencode($settings["admin_email"]).
652  "&nic_key=".rawurlencode($this->getNICkey());
653 
654  return $url;
655  }
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 528 of file class.ilClient.php.

References getId(), ILIAS_ABSOLUTE_PATH, and ILIAS_WEB_DIR.

Referenced by create().

529  {
530  return ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR."/".$this->getId();
531  }
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 39 of file class.ilClient.php.

References getId(), ILIAS_ABSOLUTE_PATH, and ILIAS_WEB_DIR.

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

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

59  {
60  $this->ini = new ilIniFile($this->ini_file_path);
61 
62  // load defaults only if no client.ini was found
63  if (!@file_exists($this->ini_file_path))
64  {
65 //echo "<br>A-".$this->ini_file_path."-";
66  $this->ini->GROUPS = parse_ini_file($this->client_defaults,true);
67  return false;
68  }
69 
70  // read client.ini
71  if (!$this->ini->read())
72  {
73  $this->error = get_class($this).": ".$this->ini->getError();
74  return false;
75  }
76 
77  // only for ilias main
78  define("CLIENT_WEB_DIR",ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR."/".$this->getId());
79  define("CLIENT_DATA_DIR",ILIAS_DATA_DIR."/".$this->getId());
80  define ("DEVMODE",$this->ini->readVariable('system','DEVMODE'));
81  define ("ROOT_FOLDER_ID",$this->ini->readVariable('system','ROOT_FOLDER_ID'));
82  define ("SYSTEM_FOLDER_ID",$this->ini->readVariable('system','SYSTEM_FOLDER_ID'));
83  define ("ROLE_FOLDER_ID",$this->ini->readVariable('system','ROLE_FOLDER_ID'));
84  define ("ANONYMOUS_USER_ID",13);
85  define ("ANONYMOUS_ROLE_ID",14);
86  define ("SYSTEM_USER_ID",6);
87  define ("SYSTEM_ROLE_ID",2);
88 
89  $this->db_exists = $this->connect();
90  if ($this->db_exists)
91  {
92  $this->db_installed = $this->isInstalledDB($this->db);
93  }
94 
95  return true;
96  }
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 216 of file class.ilClient.php.

Referenced by checkDatabaseExists(), and init().

217  {
218  if(method_exists($a_db,'loadModule'))
219  {
220  $a_db->loadModule('Manager');
221  }
222  if(!$tables = $a_db->listTables())
223  {
224  return false;
225  }
226 
227  // check existence of some basic tables from ilias3 to determine if ilias3 is already installed in given database
228  if (in_array("object_data",$tables) and in_array("object_reference",$tables) and in_array("usr_data",$tables) and in_array("rbac_ua",$tables))
229  {
230  $this->db_installed = true;
231  return true;
232  }
233  $this->db_installed = false;
234  return false;
235  }
+ Here is the caller graph for this function:

◆ reconnect()

ilClient::reconnect ( )

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

References connect().

586  {
587  $this->connect();
588  }
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 292 of file class.ilClient.php.

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

◆ setDbName()

ilClient::setDbName (   $a_str)

set the name of database

Parameters
string

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

312  {
313  $this->ini->setVariable("db","name",$a_str);
314  }

◆ setDbPass()

ilClient::setDbPass (   $a_str)

set db password

Parameters
string

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

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

◆ setDbPort()

ilClient::setDbPort (   $a_str)

set db port

Parameters
string

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

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

◆ setDbSlaveActive()

ilClient::setDbSlaveActive (   $a_act)

set the slave active

Parameters
int

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

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

◆ setDbSlaveHost()

ilClient::setDbSlaveHost (   $a_str)

set the slave host

Parameters
string

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

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

◆ setDbSlaveName()

ilClient::setDbSlaveName (   $a_str)

set the name of slave database

Parameters
string

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

422  {
423  $this->ini->setVariable("db","slave_name",$a_str);
424  }

◆ setDbSlavePass()

ilClient::setDbSlavePass (   $a_str)

set slave db password

Parameters
string

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

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

◆ setDbSlavePort()

ilClient::setDbSlavePort (   $a_str)

set slave db port

Parameters
string

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

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

◆ setDbSlaveUser()

ilClient::setDbSlaveUser (   $a_str)

set slave db user

Parameters
stringdb user

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

440  {
441  $this->ini->setVariable("db","slave_user",$a_str);
442  }

◆ setDbType()

ilClient::setDbType (   $a_str)

set the type of database

Parameters
string

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

494  {
495  $this->ini->setVariable("db","type",$a_str);
496  }

◆ setDbUser()

ilClient::setDbUser (   $a_str)

set db user

Parameters
stringdb user

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

330  {
331  $this->ini->setVariable("db","user",$a_str);
332  }

◆ setDefaultLanguage()

ilClient::setDefaultLanguage (   $a_lang_key)

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

References setSetting().

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

149  {
150  $this->ini->setVariable("client","description",$a_str);
151  }

◆ setDSN()

ilClient::setDSN ( )

set the dsn and dsn_host

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

References getDbType().

241  {
242  switch($this->getDbType())
243  {
244  case "oracle":
245  //$this->dsn_host = "oci8://".$this->getdbUser().":".$this->getdbPass()."@".$this->getdbHost();
246  $this->dsn_host = array(
247  'phptype' => 'oci8',
248  'hostspec' => $this->getdbHost(),
249  'username' => $this->getdbUser(),
250  'port' => $this->getdbPort(),
251  'password' => $this->getdbPass(),
252  );
253  //$this->dsn = "oci8://".$this->getdbUser().":".$this->getdbPass()."@".$this->getdbHost()."/?service=".$this->getdbName();
254  $this->dsn = $this->dsn = array(
255  'phptype' => 'oci8',
256  'hostspec' => $this->getdbHost(),
257  'username' => $this->getdbUser(),
258  'port' => $this->getdbPort(),
259  'password' => $this->getdbPass(),
260  'service' => $this->getdbName()
261  );
262  break;
263 
264  case "postgres":
265  $db_port_str = "";
266  if (trim($this->getdbPort()) != "")
267  {
268  $db_port_str = ":".$this->getdbPort();
269  }
270  $this->dsn_host = "pgsql://".$this->getdbUser().":".$this->getdbPass()."@".$this->getdbHost().$db_port_str;
271  $this->dsn = "pgsql://".$this->getdbUser().":".$this->getdbPass()."@".$this->getdbHost().$db_port_str."/".$this->getdbName();
272  break;
273 
274  case "mysql":
275  case "innodb":
276  default:
277  $db_port_str = "";
278  if (trim($this->getdbPort()) != "")
279  {
280  $db_port_str = ":".$this->getdbPort();
281  }
282  $this->dsn_host = "mysql://".$this->getdbUser().":".$this->getdbPass()."@".$this->getdbHost().$db_port_str;
283  $this->dsn = "mysql://".$this->getdbUser().":".$this->getdbPass()."@".$this->getdbHost().$db_port_str."/".$this->getdbName();
284  break;
285  }
286  }
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 111 of file class.ilClient.php.

References $id, ILIAS_ABSOLUTE_PATH, and ILIAS_WEB_DIR.

112  {
113  $this->id = $a_client_id;
114  $this->webspace_dir = ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR."/".$this->id;
115  }
const ILIAS_WEB_DIR
const ILIAS_ABSOLUTE_PATH

◆ setName()

ilClient::setName (   $a_str)

set client name

Parameters
stringclient name

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

131  {
132  $this->ini->setVariable("client","name",$a_str);
133  }

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

References setSetting().

Referenced by getNICkey().

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

Referenced by setDefaultLanguage(), and setNICkey().

623  {
624  include_once './Services/Administration/classes/class.ilSetting.php';
625  $set = new ilSetting("common", true);
626  $set->set($a_key, $a_val);
627  }
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 671 of file class.ilClient.php.

References getAllSettings(), and getURLStringForNIC().

672  {
673  $settings = $this->getAllSettings();
674  if((bool)$settings['proxy_status'] && strlen($settings['proxy_host']) && strlen($settings['proxy_port']))
675  {
676  $proxy_options = array(
677  'proxy_host' => $settings['proxy_host'],
678  'proxy_port' => $settings['proxy_port']
679  );
680  }
681  else
682  {
683  $proxy_options = array();
684  }
685 
686  include_once('HTTP/Request.php');
687  $url = $this->getURLStringForNIC($a_nic_url);
688  $req = new HTTP_Request($url, $proxy_options);
689 
690  $req->sendRequest();
691  $response = $req->getResponseBody();
692  $response = explode("\n", $response);
693 
694  $this->nic_status = $response;
695 
696  return true;
697  }
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 883 of file class.ilClient.php.

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

Field Documentation

◆ $client_defaults

ilClient::$client_defaults

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

◆ $db

ilClient::$db

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

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

◆ $id

ilClient::$id

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

Referenced by getId(), and setId().

◆ $ini

ilClient::$ini

Definition at line 33 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: