ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilSetup Class Reference

Setup class. More...

+ Inheritance diagram for ilSetup:
+ Collaboration diagram for ilSetup:

Public Member Functions

 ilSetup ($a_auth, $a_auth_type)
 constructor More...
 
 setClient ($a_cl)
 
 getClient ()
 
 init ()
 init setup load settings from ilias.ini if exists and sets some constants More...
 
 saveNewClient ()
 saves client.ini & updates client list in ilias.ini More...
 
 updateNewClient ($a_old_client_id)
 update client.ini & move data dirs does not work correctly at this time - DISABLED More...
 
 createDatabase ($a_collation="")
 create client database More...
 
 installDatabase ()
 set the database data More...
 
 getline ( $fp, $delim)
 
 readDump ($db, $file)
 execute a query More...
 
 checkIniFileExists ()
 check if inifile exists More...
 
 checkWritable ()
 check for writable directory More...
 
 checkCreatable ($a_dir=".")
 check for permission to create new folders in specified directory More...
 
 checkCookiesEnabled ()
 check cookies enabled More...
 
 checkPHPVersion ()
 check for PHP version More...
 
 checkMySQL ()
 Check MySQL. More...
 
 checkAuth ()
 check authentication status More...
 
 checkDom ()
 Check MySQL. More...
 
 checkXsl ()
 Check MySQL. More...
 
 checkGd ()
 Check MySQL. More...
 
 checkMemoryLimit ()
 Check Memory Limit. More...
 
 queryPreliminaries ()
 preliminaries More...
 
 checkPreliminaries ()
 check all prliminaries More...
 
 getPassword ()
 get setup master password More...
 
 setPassword ($a_password)
 set setup master password More...
 
 loginAsClient ($a_auth_data)
 process client login More...
 
 loginAsAdmin ($a_password)
 process setup admin login More...
 
 newClient ($a_client_id=0)
 creates a client object in $this->client More...
 
 getStatus ($client=0)
 coumpute client status More...
 
 checkFinish (&$client)
 check if client setup was finished More...
 
 checkAccess (&$client)
 check client access status More...
 
 checkClientIni (&$client)
 check client ini status More...
 
 checkClientDatabase (&$client)
 check client db status More...
 
 checkClientSessionSettings (&$client, $a_as_bool=false)
 check client session config status More...
 
 checkClientProxySettings (&$client)
 check client session config status More...
 
 checkClientLanguages (&$client)
 check client installed languages status More...
 
 checkClientContact (&$client)
 check client contact data status More...
 
 checkClientNIC (&$client)
 check client nic status More...
 
 isInstalled ()
 check if client's db is installed More...
 
 isAuthenticated ()
 check if current user is authenticated More...
 
 isAdmin ()
 check if current user is admin More...
 
 saveMasterSetup ($a_formdata)
 saves intial settings More...
 
 updateMasterSettings ($a_formdata)
 updates settings More...
 
 checkToolsSetup ($a_formdata)
 check pathes to 3rd party software More...
 
 checkDataDirSetup ($a_formdata)
 check datadir path More...
 
 checkPasswordSetup ($a_formdata)
 check setup password More...
 
 checkLogSetup ($a_formdata)
 check log path More...
 
 getError ()
 get Error message More...
 
 _ilSetup ()
 destructor More...
 
 testConvert ($a_convert_path)
 Check convert program. More...
 
 testGhostscript ($a_ghostscript_path)
 Check ghostscript program. More...
 
 testJava ($a_java_path)
 Check JVM. More...
 
 testLatex ($a_latex_url)
 Check latex cgi script. More...
 
 testZip ($a_zip_path)
 Check zip program. More...
 
 testUnzip ($a_unzip_path)
 Check unzip program. More...
 
 testHtmldoc ($a_htmldoc_path)
 Check htmldoc program. More...
 
 unzip ($a_file, $overwrite=false)
 unzip file More...
 
 setSessionSettings ($session_settings)
 saves session settings to db More...
 
 getSessionSettings ()
 reads session settings from db More...
 
 cloneFromSource ($source_id)
 Clone source client into current client. More...
 
 printProxyStatus ($client)
 Print proxy settings. More...
 
 saveProxySettings ($proxy_settings)
 
 hasOpCacheEnabled ()
 
- Public Member Functions inherited from PEAR
 PEAR ($error_class=null)
 Constructor. More...
 
 _PEAR ()
 Destructor (the emulated type of...). More...
 
getStaticProperty ($class, $var)
 If you have a class that's mostly/entirely static, and you need static properties, you can use this method to simulate them. More...
 
 registerShutdownFunc ($func, $args=array())
 Use this function to register a shutdown method for static classes. More...
 
 isError ($data, $code=null)
 Tell whether a value is a PEAR error. More...
 
 setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled. More...
 
 expectError ($code=' *')
 This method is used to tell which errors you expect to get. More...
 
 popExpect ()
 This method pops one element off the expected error codes stack. More...
 
 _checkDelExpect ($error_code)
 This method checks unsets an error code if available. More...
 
 delExpect ($error_code)
 This method deletes all occurences of the specified element from the expected error codes stack. More...
 
raiseError ($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
 This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied. More...
 
throwError ($message=null, $code=null, $userinfo=null)
 Simpler form of raiseError with fewer options. More...
 
 staticPushErrorHandling ($mode, $options=null)
 
 staticPopErrorHandling ()
 
 pushErrorHandling ($mode, $options=null)
 Push a new error handler on top of the error handler options stack. More...
 
 popErrorHandling ()
 Pop the last error handler used. More...
 
 loadExtension ($ext)
 OS independant PHP extension load. More...
 

Data Fields

 $ini
 
 $ini_file_path
 
 $error = ""
 
 $ini_ilias_exists = false
 
 $ini_client_exists = false
 
 $setup_defaults
 
 $ilias_nic_server = "https://www.ilias.de/ilias-nic/index.php"
 
 $preliminaries_result = array()
 
 $preliminaries = true
 
 $SQL_FILE = "./setup/sql/ilias3.sql"
 
 $dsn = ""
 
 $db
 
 $setup_password
 
 $default_client
 
 $safe_mode
 
 $safe_mode_exec_dir
 
 $auth
 
 $access_mode
 
 $client
 
- Data Fields inherited from PEAR
 $_debug = false
 
 $_default_error_mode = null
 
 $_default_error_options = null
 
 $_default_error_handler = ''
 
 $_error_class = 'PEAR_Error'
 
 $_expected_errors = array()
 

Protected Member Functions

 checkOpcacheSettings ()
 

Detailed Description

Setup class.

class to setup ILIAS first and maintain the ini-settings and the database

Author
Peter Gabriel pgabr.nosp@m.iel@.nosp@m.datab.nosp@m.ay.d.nosp@m.e
Sascha Hofmann shofm.nosp@m.ann@.nosp@m.datab.nosp@m.ay.d.nosp@m.e
Version
$Id$

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

Member Function Documentation

◆ _ilSetup()

ilSetup::_ilSetup ( )

destructor

Returns
boolean

Definition at line 1672 of file class.ilSetup.php.

1673  {
1674  //if ($this->ini->readVariable("db","type") != "")
1675  //{
1676  // $this->db->disconnect();
1677  //}
1678  return true;
1679  }

◆ checkAccess()

ilSetup::checkAccess ( $client)

check client access status

Parameters
objectclient
Returns
boolean

Definition at line 944 of file class.ilSetup.php.

References $client.

Referenced by getStatus().

945  {
946  if ($client->ini->readVariable("client","access") == "1")
947  {
948  $arr["status"] = true;
949  $arr["comment"] = $this->lng->txt("online");
950  }
951  else
952  {
953  $arr["status"] = false;
954  $arr["comment"] = $this->lng->txt("disabled");
955  }
956 
957  return $arr;
958  }
+ Here is the caller graph for this function:

◆ checkAuth()

ilSetup::checkAuth ( )

check authentication status

Returns
boolean

Definition at line 516 of file class.ilSetup.php.

References $_SESSION.

Referenced by ilSetup().

517  {
518  if ($_SESSION["auth"] === true && $_SESSION["auth_path"] == ILIAS_HTTP_PATH)
519  {
520  return true;
521  }
522 
523  return false;
524  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ Here is the caller graph for this function:

◆ checkClientContact()

ilSetup::checkClientContact ( $client)

check client contact data status

Parameters
objectclient
Returns
boolean

Definition at line 1159 of file class.ilSetup.php.

References $client, and ilUtil\is_email().

Referenced by getStatus().

1160  {
1161  $arr["status"] = true;
1162  //$arr["comment"] = $this->lng->txt("filled_out");
1163 
1164  $settings = $client->getAllSettings();
1165  $client_name = $client->getName();
1166 
1167  // check required fields
1168  if (empty($settings["admin_firstname"]) or empty($settings["admin_lastname"]) or
1169  empty($settings["admin_email"]) or empty($client_name))
1170  {
1171  $arr["status"] = false;
1172  $arr["comment"] = $this->lng->txt("missing_data");
1173  }
1174 
1175  // admin email
1176  if (!ilUtil::is_email($settings["admin_email"]) and $arr["status"] != false)
1177  {
1178  $arr["status"] = false;
1179  $arr["comment"] = $this->lng->txt("email_not_valid");
1180  }
1181 
1182  return $arr;
1183  }
static is_email($a_email)
This preg-based function checks whether an e-mail address is formally valid.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkClientDatabase()

ilSetup::checkClientDatabase ( $client)

check client db status

Parameters
objectclient
Returns
boolean

Definition at line 984 of file class.ilSetup.php.

References $client, and $ilDB.

Referenced by getStatus().

985  {
986  if (!$arr["status"] = $client->db_exists)
987  {
988  $arr["comment"] = $this->lng->txt("no_database");
989  return $arr;
990  }
991 
992  if (!$arr["status"] = $client->db_installed)
993  {
994  $arr["comment"] = $this->lng->txt("db_not_installed");
995  return $arr;
996  }
997 
998  // TODO: move this to client class!!
999  $client->setup_ok = (bool) $client->getSetting("setup_ok");
1000 
1001  //$this->lng->setDbHandler($client->db);
1002  include_once "./Services/Database/classes/class.ilDBUpdate.php";
1003  $ilDB = $client->db;
1004  $this->lng->setDbHandler($client->db);
1005  $dbupdate = new ilDBUpdate($client->db);
1006 
1007  if (!$arr["status"] = $dbupdate->getDBVersionStatus())
1008  {
1009  $arr["comment"] = $this->lng->txt("db_needs_update");
1010  $arr["update"] = true;
1011  return $arr;
1012  }
1013  else if ($dbupdate->hotfixAvailable())
1014  {
1015  $arr["status"] = false;
1016  $arr["comment"] = $this->lng->txt("hotfix_available");
1017  $arr["update"] = true;
1018  return $arr;
1019  }
1020  else if ($dbupdate->customUpdatesAvailable())
1021  {
1022  $arr["status"] = false;
1023  $arr["comment"] = $this->lng->txt("custom_updates_available");
1024  $arr["update"] = true;
1025  return $arr;
1026  }
1027 
1028  // check control information
1029 
1030  $cset = $ilDB->query("SELECT count(*) as cnt FROM ctrl_calls");
1031  $crec = $ilDB->fetchAssoc($cset);
1032  if ($crec["cnt"] == 0)
1033  {
1034  $arr["status"] = false;
1035  $arr["comment"] = $this->lng->txt("db_control_structure_missing");
1036  $arr["update"] = true;
1037  return $arr;
1038  }
1039 
1040  //$arr["comment"] = "version ".$dbupdate->getCurrentVersion();
1041  return $arr;
1042  }
Database Update class.
global $ilDB
+ Here is the caller graph for this function:

◆ checkClientIni()

ilSetup::checkClientIni ( $client)

check client ini status

Parameters
objectclient
Returns
boolean

Definition at line 965 of file class.ilSetup.php.

References $client.

Referenced by getStatus().

966  {
967  if (!$arr["status"] = $client->init())
968  {
969  $arr["comment"] = $client->getError();
970  }
971  else
972  {
973  //$arr["comment"] = "dir: /".ILIAS_WEB_DIR."/".$client->getId();
974  }
975 
976  return $arr;
977  }
+ Here is the caller graph for this function:

◆ checkClientLanguages()

ilSetup::checkClientLanguages ( $client)

check client installed languages status

Parameters
objectclient
Returns
boolean

Definition at line 1134 of file class.ilSetup.php.

Referenced by getStatus().

1135  {
1136  $installed_langs = $this->lng->getInstalledLanguages();
1137 
1138  $count = count($installed_langs);
1139 
1140  if ($count < 1)
1141  {
1142  $arr["status"] = false;
1143  $arr["comment"] = $this->lng->txt("lang_none_installed");
1144  }
1145  else
1146  {
1147  $arr["status"] = true;
1148  //$arr["comment"] = $count." ".$this->lng->txt("languages_installed");
1149  }
1150 
1151  return $arr;
1152  }
+ Here is the caller graph for this function:

◆ checkClientNIC()

ilSetup::checkClientNIC ( $client)

check client nic status

Parameters
objectclient
Returns
boolean

Definition at line 1190 of file class.ilSetup.php.

References $client.

Referenced by getStatus().

1191  {
1192  $settings = $client->getAllSettings();
1193 
1194  if (!isset($settings["nic_enabled"]))
1195  {
1196  $arr["status"] = false;
1197  $arr["comment"] = $this->lng->txt("nic_not_disabled");
1198  return $arr;
1199  }
1200 
1201  $arr["status"] = true;
1202 
1203  if ($settings["nic_enabled"] == "-1")
1204  {
1205  $arr["comment"] = $this->lng->txt("nic_reg_failed");
1206  return $arr;
1207  }
1208 
1209  if (!$settings["nic_enabled"])
1210  {
1211  $arr["comment"] = $this->lng->txt("nic_reg_disabled");
1212  }
1213  else
1214  {
1215  $arr["comment"] = $this->lng->txt("nic_reg_enabled");
1216  if ($settings["inst_id"] <= 0)
1217  {
1218  $arr["status"] = false;
1219  }
1220  }
1221 
1222  return $arr;
1223  }
+ Here is the caller graph for this function:

◆ checkClientProxySettings()

ilSetup::checkClientProxySettings ( $client)

check client session config status

Parameters
objectclient

Definition at line 1089 of file class.ilSetup.php.

References $ilDB, $query, $res, and $row.

Referenced by getStatus().

1090  {
1091  global $ilDB;
1092  $db = $ilDB;
1093 
1094  $fields = array('proxy_status','proxy_host','proxy_port');
1095 
1096  $query = "SELECT keyword, value FROM settings WHERE ".$db->in('keyword', $fields, false, 'text');
1097  $res = $db->query($query);
1098 
1099  $proxy_settings = array();
1100  $already_saved = false;
1101  while($row = $db->fetchAssoc($res))
1102  {
1103  $already_saved = true;
1104  $proxy_settings[$row['keyword']] = $row['value'];
1105  }
1106 
1107  if(!$already_saved)
1108  {
1109  $arr["status"] = false;
1110  $arr["comment"] = $this->lng->txt("proxy");
1111  $arr["text"] = $this->lng->txt("proxy");
1112  }
1113  else if((bool)$proxy_settings["proxy_status"] == false)
1114  {
1115  $arr["status"] = true;
1116  $arr["comment"] = $this->lng->txt("proxy_disabled");
1117  $arr["text"] = $this->lng->txt("proxy_disabled");
1118  }
1119  else
1120  {
1121  $arr["status"] = true;
1122  $arr["comment"] = $this->lng->txt("proxy_activated_configurated");
1123  $arr["text"] = $this->lng->txt("proxy_activated_configurated");
1124 
1125  }
1126  return $arr;
1127  }
global $ilDB
+ Here is the caller graph for this function:

◆ checkClientSessionSettings()

ilSetup::checkClientSessionSettings ( $client,
  $a_as_bool = false 
)

check client session config status

Parameters
objectclient
Returns
boolean

Definition at line 1049 of file class.ilSetup.php.

References $ilDB, $query, $res, $row, DB_FETCHMODE_ASSOC, and ilSessionControl\getSettingFields().

1050  {
1051  require_once('Services/Authentication/classes/class.ilSessionControl.php');
1052 
1053  global $ilDB;
1054  $db = $ilDB;
1055 
1057 
1058  $query = "SELECT keyword, value FROM settings WHERE ".$db->in('keyword', $fields, false, 'text');
1059  $res = $db->query($query);
1060 
1061  $rows = array();
1062  while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
1063  {
1064  if( $row['value'] != '' )
1065  $rows[] = $row;
1066  else break;
1067  }
1068 
1069  if (count($rows) != count($fields))
1070  {
1071  if($a_as_bool) return false;
1072  $arr["status"] = false;
1073  $arr["comment"] = $this->lng->txt("session_management_not_configured");
1074  }
1075  else
1076  {
1077  if($a_as_bool) return true;
1078  $arr["status"] = true;
1079  $arr["comment"] = $this->lng->txt("session_management_configured");
1080  }
1081 
1082  return $arr;
1083  }
static getSettingFields()
returns the array of setting fields
const DB_FETCHMODE_ASSOC
Definition: class.ilDB.php:10
global $ilDB
+ Here is the call graph for this function:

◆ checkCookiesEnabled()

ilSetup::checkCookiesEnabled ( )

check cookies enabled

Returns
array

Definition at line 453 of file class.ilSetup.php.

References $sess.

Referenced by queryPreliminaries().

454  {
455  global $sess;
456 
457  if ($sess->usesCookies)
458  {
459  $arr["status"] = true;
460  $arr["comment"] = "";
461  }
462  else
463  {
464  $arr["status"] = false;
465  $arr["comment"] = $this->lng->txt("pre_cookies_disabled");
466  }
467 
468  return $arr;
469  }
+ Here is the caller graph for this function:

◆ checkCreatable()

ilSetup::checkCreatable (   $a_dir = ".")

check for permission to create new folders in specified directory

Parameters
stringdirectory
Returns
array

Definition at line 427 of file class.ilSetup.php.

Referenced by queryPreliminaries().

428  {
429  clearstatcache();
430  if (@mkdir($a_dir."/crst879dldsk9d", 0774))
431  {
432  $arr["status"] = true;
433  $arr["comment"] = "";
434 
435  @rmdir($a_dir."/crst879dldsk9d");
436  }
437  else
438  {
439  $arr["status"] = false;
440  //$cdir = getcwd();
441  //chdir("..");
442  $arr["comment"] = getcwd().": ".$this->lng->txt("pre_folder_create_error");
443  //chdir($cdir);
444  }
445 
446  return $arr;
447  }
+ Here is the caller graph for this function:

◆ checkDataDirSetup()

ilSetup::checkDataDirSetup (   $a_formdata)

check datadir path

Parameters
arrayform data
Returns
boolean

Definition at line 1549 of file class.ilSetup.php.

References ilFile\deleteTrailingSlash(), ILIAS_ABSOLUTE_PATH, and ilUtil\stripSlashes().

1550  {
1551  // remove trailing slash & convert backslashes to forwardslashes
1552  $datadir_path = preg_replace("/\\\\/","/",ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["datadir_path"])));
1553 
1554  if (empty($datadir_path))
1555  {
1556  $this->error = "no_path_datadir";
1557  return false;
1558  }
1559 
1560  $webspace_dir = ILIAS_ABSOLUTE_PATH . "/data";
1561 
1562  // datadir may not point to webspace dir or to any place under webspace_dir
1563  if (strpos($datadir_path,$webspace_dir) !== false)
1564  {
1565  $this->error = "datadir_webspacedir_match";
1566  return false;
1567  }
1568 
1569  // create dir
1570  if ($a_formdata["chk_datadir_path"] == 1)
1571  {
1572  $dir_to_create = substr(strrchr($datadir_path, "/"), 1);
1573  $dir_to_check = substr($datadir_path,0,- strlen($dir_to_create)-1);
1574 
1575  if (is_writable($datadir_path))
1576  {
1577  $this->error = "dir_exists_create";
1578  return false;
1579  }
1580 
1581  if (!is_writable($dir_to_check))
1582  {
1583  $this->error = "cannot_create_datadir_no_write_access";
1584  return false;
1585  }
1586  }
1587  else // check set target dir
1588  {
1589  if (!is_writable($datadir_path))
1590  {
1591  $this->error = "cannot_create_datadir_no_write_access";
1592  return false;
1593  }
1594  }
1595 
1596  return true;
1597  }
deleteTrailingSlash($a_path)
delete trailing slash of path variables
const ILIAS_ABSOLUTE_PATH
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:

◆ checkDom()

ilSetup::checkDom ( )

Check MySQL.

Returns
boolean

Definition at line 531 of file class.ilSetup.php.

References $ilDB.

Referenced by queryPreliminaries().

532  {
533  global $ilDB;
534 
535  if (class_exists("DOMDocument"))
536  {
537  $arr["status"] = true;
538  }
539  else
540  {
541  $arr["status"] = false;
542  $arr["comment"] = $this->lng->txt("pre_dom_missing");
543  }
544 
545  return $arr;
546  }
global $ilDB
+ Here is the caller graph for this function:

◆ checkFinish()

ilSetup::checkFinish ( $client)

check if client setup was finished

Parameters
objectclient
Returns
boolean

Definition at line 923 of file class.ilSetup.php.

References $client.

Referenced by getStatus().

924  {
925  if ($client->getSetting("setup_ok"))
926  {
927  $arr["status"] = true;
928  //$arr["comment"] = $this->lng->txt("setup_finished");
929  }
930  else
931  {
932  $arr["status"] = false;
933  $arr["comment"] = $this->lng->txt("setup_not_finished");
934  }
935 
936  return $arr;
937  }
+ Here is the caller graph for this function:

◆ checkGd()

ilSetup::checkGd ( )

Check MySQL.

Returns
boolean

Definition at line 574 of file class.ilSetup.php.

References $ilDB.

Referenced by queryPreliminaries().

575  {
576  global $ilDB;
577 
578  if (function_exists("imagefill") && function_exists("imagecolorallocate"))
579  {
580  $arr["status"] = true;
581  }
582  else
583  {
584  $arr["status"] = false;
585  $arr["comment"] = sprintf($this->lng->txt("pre_gd_missing"),
586  "http://php.net/manual/en/book.image.php");
587  }
588 
589  return $arr;
590  }
global $ilDB
+ Here is the caller graph for this function:

◆ checkIniFileExists()

ilSetup::checkIniFileExists ( )

check if inifile exists

Returns
boolean

Definition at line 387 of file class.ilSetup.php.

388  {
389  $a = @file_exists($this->INI_FILE);
390  return $a;
391  }

◆ checkLogSetup()

ilSetup::checkLogSetup (   $a_formdata)

check log path

Parameters
arrayform data
Returns
boolean

Definition at line 1626 of file class.ilSetup.php.

References ilFile\deleteTrailingSlash(), and ilUtil\stripSlashes().

1627  {
1628  // log path
1629  if (!$a_formdata["chk_log_status"])
1630  {
1631  // remove trailing slash & convert backslashes to forwardslashes
1632  $log_path = preg_replace("/\\\\/","/",ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["log_path"])));
1633 
1634  if (empty($log_path))
1635  {
1636  $this->error = "no_path_log";
1637  return false;
1638  }
1639 
1640  if (!@touch($log_path))
1641  {
1642  $this->error = "could_not_create_logfile";
1643  return false;
1644  }
1645  }
1646 
1647  return true;
1648  }
deleteTrailingSlash($a_path)
delete trailing slash of path variables
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:

◆ checkMemoryLimit()

ilSetup::checkMemoryLimit ( )

Check Memory Limit.

Returns
boolean

Definition at line 596 of file class.ilSetup.php.

References $ilDB.

Referenced by queryPreliminaries().

597  {
598  global $ilDB;
599 
600  $limit = ini_get("memory_limit");
601 
602  $limit_ok = true;
603  if (is_int(strpos($limit, "M")))
604  {
605  $limit_n = (int) $limit;
606  if ($limit_n < 40)
607  {
608  $limit_ok = false;
609  }
610  }
611 
612  if ($limit_ok)
613  {
614  $arr["status"] = true;
615  $arr["comment"] = $limit.". ".$this->lng->txt("pre_memory_limit_recommend");
616  }
617  else
618  {
619  $arr["status"] = false;
620  $arr["comment"] = $limit.". ".$this->lng->txt("pre_memory_limit_too_low");
621  }
622 
623  return $arr;
624  }
global $ilDB
+ Here is the caller graph for this function:

◆ checkMySQL()

ilSetup::checkMySQL ( )

Check MySQL.

Returns
boolean

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

References $ilDB.

495  {
496  global $ilDB;
497 
498  if (function_exists("mysql_query"))
499  {
500  $arr["status"] = true;
501  $arr["comment"] = $this->lng->txt("pre_mysql_4_1_or_higher");
502  }
503  else
504  {
505  $arr["status"] = false;
506  $arr["comment"] = $this->lng->txt("pre_mysql_missing");
507  }
508 
509  return $arr;
510  }
global $ilDB

◆ checkOpcacheSettings()

ilSetup::checkOpcacheSettings ( )
protected
Returns
array

Definition at line 630 of file class.ilSetup.php.

Referenced by queryPreliminaries().

630  {
631  $arr = array();
632  $load_comments = ini_get("opcache.load_comments");
633  if($load_comments == 1) {
634  $arr["status"] = true;
635  } else {
636  $arr["status"] = false;
637  $arr["comment"] = $this->lng->txt("pre_opcache_comments");
638  }
639 
640  return $arr;
641  }
+ Here is the caller graph for this function:

◆ checkPasswordSetup()

ilSetup::checkPasswordSetup (   $a_formdata)

check setup password

Parameters
arrayform data
Returns
boolean

Definition at line 1604 of file class.ilSetup.php.

1605  {
1606  if (!$a_formdata["setup_pass"])
1607  {
1608  $this->error = "no_setup_pass_given";
1609  return false;
1610  }
1611 
1612  if ($a_formdata["setup_pass"] != $a_formdata["setup_pass2"])
1613  {
1614  $this->error = "pass_does_not_match";
1615  return false;
1616  }
1617 
1618  return true;
1619  }

◆ checkPHPVersion()

ilSetup::checkPHPVersion ( )

check for PHP version

Returns
array

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

Referenced by queryPreliminaries().

476  {
477  $version = PHP_VERSION;
478 
479  $arr["status"] = true;
480  $arr["comment"] = "PHP ".$version;
481  if (version_compare($version, '5.3.0', '<'))
482  {
483  $arr["status"] = false;
484  $arr["comment"] = "PHP ".$version.". ".$this->lng->txt("pre_php_version_too_low");
485  }
486 
487  return $arr;
488  }
+ Here is the caller graph for this function:

◆ checkPreliminaries()

ilSetup::checkPreliminaries ( )

check all prliminaries

Returns
boolean

Definition at line 674 of file class.ilSetup.php.

References queryPreliminaries().

675  {
676  $this->preliminaries_result = $this->queryPreliminaries();
677 
678  foreach ($this->preliminaries_result as $val)
679  {
680  if ($val["status"] === false)
681  {
682  $this->preliminaries = false;
683  return false;
684  }
685  }
686 
687  return true;
688  }
queryPreliminaries()
preliminaries
+ Here is the call graph for this function:

◆ checkToolsSetup()

ilSetup::checkToolsSetup (   $a_formdata)

check pathes to 3rd party software

Parameters
arrayform data
Returns
boolean

Definition at line 1385 of file class.ilSetup.php.

References ilUtil\stripSlashes(), testConvert(), testGhostscript(), testHtmldoc(), testJava(), testLatex(), testUnzip(), and testZip().

1386  {
1387  // convert path
1388  if (!isset($a_formdata["chk_convert_path"]))
1389  {
1390  // convert backslashes to forwardslashes
1391  $convert_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["convert_path"]));
1392 
1393  if (($err = $this->testConvert($convert_path)) != "")
1394  {
1395  $this->error = $err;
1396  return false;
1397  }
1398  }
1399 
1400  // zip path
1401  if (!isset($a_formdata["chk_zip_path"]))
1402  {
1403  // convert backslashes to forwardslashes
1404  $zip_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["zip_path"]));
1405 
1406  if (empty($zip_path))
1407  {
1408  $this->error = "no_path_zip";
1409  return false;
1410  }
1411 
1412  if (!$this->testZip($zip_path))
1413  {
1414  $this->error = "check_failed_zip";
1415  return false;
1416  }
1417  }
1418 
1419  // unzip path
1420  if (!isset($a_formdata["chk_unzip_path"]))
1421  {
1422  // convert backslashes to forwardslashes
1423  $unzip_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["unzip_path"]));
1424 
1425  if (empty($unzip_path))
1426  {
1427  $this->error = "no_path_unzip";
1428  return false;
1429  }
1430 
1431  if (!$this->testUnzip($unzip_path))
1432  {
1433  $this->error = "check_failed_unzip";
1434  return false;
1435  }
1436  }
1437 
1438  // ghostscript path
1439  if (!isset($a_formdata["chk_ghostscript_path"]))
1440  {
1441  // convert backslashes to forwardslashes
1442  $ghostscript_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["ghostscript_path"]));
1443 
1444  if (($err = $this->testGhostscript($ghostscript_path)) != "")
1445  {
1446  $this->error = $err;
1447  return false;
1448  }
1449  }
1450 
1451  // java path
1452  if (!isset($a_formdata["chk_java_path"]))
1453  {
1454  // convert backslashes to forwardslashes
1455  $java_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["java_path"]));
1456 
1457  if (empty($java_path))
1458  {
1459  $this->error = "no_path_java";
1460  return false;
1461  }
1462 
1463  if (!$this->testJava($java_path))
1464  {
1465  $this->error = "check_failed_java";
1466  return false;
1467  }
1468  }
1469 
1470  // htmldoc path
1471  if (!isset($a_formdata["chk_htmldoc_path"]))
1472  {
1473  // convert backslashes to forwardslashes
1474  $htmldoc_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["htmldoc_path"]));
1475 
1476  if (empty($htmldoc_path))
1477  {
1478  $this->error = "no_path_htmldoc";
1479  return false;
1480  }
1481 
1482  if (!$this->testHtmldoc($htmldoc_path))
1483  {
1484  $this->error = "check_failed_htmldoc";
1485  return false;
1486  }
1487  }
1488  /*if (!isset($a_formdata["chk_mkisofs_path"]))
1489  {
1490  // convert backslashes to forwardslashes
1491  $mkisofs_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["mkisofs_path"]));
1492 
1493  if (empty($mkisofs_path))
1494  {
1495  $this->error = "no_path_mkisofs";
1496  return false;
1497  }
1498 
1499  if (!$this->testHtmldoc($mkisofs_path))
1500  {
1501  $this->error = "check_failed_mkisofs";
1502  return false;
1503  }
1504  }*/
1505 
1506  if (!isset($a_formdata["chk_ffmpeg_path"]))
1507  {
1508  // convert backslashes to forwardslashes
1509  $ffmpeg_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["ffmpeg_path"]));
1510 
1511  if (empty($ffmpeg_path))
1512  {
1513  $this->error = "no_path_ffmpeg";
1514  return false;
1515  }
1516 
1517  if (!$this->testFFMpeg($ffmpeg_path))
1518  {
1519  $this->error = "check_failed_ffmpeg";
1520  return false;
1521  }
1522  }
1523 
1524  // latex url
1525  if (!isset($a_formdata["chk_latex_url"]))
1526  {
1527  $latex_url = ilUtil::stripSlashes($a_formdata["latex_url"]);
1528  if (empty($latex_url))
1529  {
1530  $this->error = "no_latex_url";
1531  return false;
1532  }
1533 
1534  if (!$this->testLatex($latex_url))
1535  {
1536  $this->error = "check_failed_latex";
1537  return false;
1538  }
1539  }
1540 
1541  return true;
1542  }
testLatex($a_latex_url)
Check latex cgi script.
testZip($a_zip_path)
Check zip program.
testJava($a_java_path)
Check JVM.
testConvert($a_convert_path)
Check convert program.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
testGhostscript($a_ghostscript_path)
Check ghostscript program.
testHtmldoc($a_htmldoc_path)
Check htmldoc program.
testUnzip($a_unzip_path)
Check unzip program.
+ Here is the call graph for this function:

◆ checkWritable()

ilSetup::checkWritable ( )

check for writable directory

Parameters
stringdirectory
Returns
array

Definition at line 398 of file class.ilSetup.php.

Referenced by queryPreliminaries().

399  {
400  clearstatcache();
401  if (is_writable("."))
402  {
403  $arr["status"] = true;
404  //$cdir = getcwd();
405  //chdir("..");
406  $arr["comment"] = getcwd();
407  //chdir($cdir);
408  }
409  else
410  {
411  $arr["status"] = false;
412  $arr["comment"] = $this->lng->txt("pre_folder_write_error");
413  //$cdir = getcwd();
414  //chdir("..");
415  $arr["comment"] = getcwd().": ".$arr["comment"];
416  //chdir($cdir);
417  }
418 
419  return $arr;
420  }
+ Here is the caller graph for this function:

◆ checkXsl()

ilSetup::checkXsl ( )

Check MySQL.

Returns
boolean

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

References $ilDB.

Referenced by queryPreliminaries().

553  {
554  global $ilDB;
555 
556  if (class_exists("XSLTProcessor"))
557  {
558  $arr["status"] = true;
559  }
560  else
561  {
562  $arr["status"] = false;
563  $arr["comment"] = sprintf($this->lng->txt("pre_xsl_missing"),
564  "http://php.net/manual/en/book.xsl.php");
565  }
566 
567  return $arr;
568  }
global $ilDB
+ Here is the caller graph for this function:

◆ cloneFromSource()

ilSetup::cloneFromSource (   $source_id)

Clone source client into current client.

Parameters
arrayform data
Returns
boolean

Definition at line 2135 of file class.ilSetup.php.

References $client, ilUtil\delDir(), ilUtil\makeDir(), and ilUtil\rCopy().

2136  {
2137  // Getting source and targets
2138  $source = new ilClient($source_id, $this->db_connections);
2139  $source->init();
2140  $target = $this->client;
2141 
2142  // ************************************************
2143  // ** COPY FILES
2144 
2145  // Cleaning up datadir
2146  if (! ilUtil::delDir($target->getDataDir())) {
2147  $this->error = "Could not delete data dir $target->getDataDir()";
2148  //return false;
2149  }
2150 
2151  // Create empty datadir
2152  if (!ilUtil::makeDir($target->getDataDir()))
2153  {
2154  $this->error = "could_not_create_base_data_dir :".$target->getDataDir();
2155  return false;
2156  }
2157 
2158  // Copying datadir
2159  if (! ilUtil::rCopy($source->getDataDir(),$target->getDataDir())) {
2160  $this->error = "clone_datadircopyfail";
2161  $target->ini->write();
2162  return false;
2163  }
2164 
2165  // Cleaning up Webspacedir
2166  if (! ilUtil::delDir($target->getWebspaceDir())) {
2167  $this->error = "Could not delete webspace dir $target->getWebspaceDir()";
2168  //return false;
2169  }
2170 
2171  // Create empty Webspacedir
2172  if (!ilUtil::makeDir($target->getWebspaceDir()))
2173  {
2174  $this->error = "could_not_create_base_webspace_dir :".$target->getWebspaceDir();
2175  return false;
2176  }
2177 
2178  // Copying Webspacedir
2179  if (! ilUtil::rCopy($source->getWebspaceDir(),$target->getWebspaceDir())) {
2180  $this->error = "clone_websipacedircopyfail";
2181  $target->ini->write();
2182  return false;
2183  }
2184 
2185  // Restore ini file
2186  $target->ini->write();
2187 
2188  // ************************************************
2189  // ** COPY DATABASE
2190 
2191  $source->connect();
2192  if (!$source->db)
2193  {
2194  $this->error = "Source database connection failed.";
2195  return false;
2196  }
2197 
2198  $target->connect();
2199  if (!$target->db)
2200  {
2201  $this->error = "Target database connection failed.";
2202  return false;
2203  }
2204 
2205  $source->connect();
2206  $srcTables = $source->db->query("SHOW TABLES");
2207  $target->connect();
2208 
2209  // drop all tables of the target db
2210  $tarTables = $target->db->query("SHOW TABLES");
2211  foreach($tarTables->fetchAll() as $cTable)
2212  {
2213  $target->db->query("DROP TABLE IF EXISTS " . $cTable[0]);
2214  }
2215 
2216  foreach($srcTables->fetchAll() as $cTable){
2217  $drop = $target->db->query("DROP TABLE IF EXISTS " . $cTable[0]);
2218  $create = $target->db->query("CREATE TABLE " . $cTable[0] . " LIKE " . $source->getDbName() . "." . $cTable[0]);
2219  if(!$create) {
2220  $error = true;
2221  }
2222  $insert = $target->db->query("INSERT INTO " . $cTable[0] . " SELECT * FROM ".$source->getDbName().".".$cTable[0]);
2223  }
2224 
2225  $target->db->query("UPDATE settings SET VALUE = ".$target->db->quote(0, "integer")." WHERE keyword = ".$target->db->quote("inst_id", "text"));
2226  $target->db->query("UPDATE settings SET VALUE = ".$target->db->quote(0, "integer")." WHERE keyword = ".$target->db->quote("nic_enabled", "text"));
2227  return true;
2228  }
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
Client Management.
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:

◆ createDatabase()

ilSetup::createDatabase (   $a_collation = "")

create client database

Returns
boolean

Definition at line 224 of file class.ilSetup.php.

References $r, and MDB2\isError().

225  {
226  if ($this->client->checkDatabaseExists())
227  {
228  $this->error = $this->lng->txt("database_exists");
229  return false;
230  }
231 
232  $this->client->getDB()->connectHost(true);
233 
234  //create database
235  $db = $this->client->getDB();
236  if (MDB2::isError($db))
237  {
238  $this->error = "connection_failed";
239  return false;
240  }
241 
242  $r = $db->createDatabase($this->client->getdbName(),
243  "utf8", $a_collation);
244 
245  if (MDB2::isError($r))
246  {
247  $this->error = "create_database_failed";
248  return false;
249  }
250 
251  //database is created, now disconnect and reconnect
252  $db->disconnect();
253 
254  $this->client->db_exists = true;
255  return true;
256  }
isError($data, $code=null)
Tell whether a value is a MDB2 error.
Definition: MDB2.php:594
$r
+ Here is the call graph for this function:

◆ getClient()

ilSetup::getClient ( )
Returns
ilClient

Definition at line 135 of file class.ilSetup.php.

References $client.

135  {
136  return $this->client;
137  }

◆ getError()

ilSetup::getError ( )

get Error message

Returns
string error message

Definition at line 1654 of file class.ilSetup.php.

References $error.

1655  {
1656  if (empty($this->error))
1657  {
1658  return false;
1659  }
1660 
1661  $error = $this->error;
1662  $this->error = "";
1663 
1664  return $error;
1665  }

◆ getline()

ilSetup::getline (   $fp,
  $delim 
)

Definition at line 287 of file class.ilSetup.php.

References $result.

Referenced by readDump().

288  {
289  $result = "";
290  while( !feof( $fp ) )
291  {
292  $tmp = fgetc( $fp );
293  if( $tmp == $delim )
294  return $result;
295  $result .= $tmp;
296  }
297  return $result;
298  }
$result
+ Here is the caller graph for this function:

◆ getPassword()

ilSetup::getPassword ( )

get setup master password

Returns
string

Definition at line 694 of file class.ilSetup.php.

695  {
696  return $this->ini->readVariable("setup","pass");
697  }

◆ getSessionSettings()

ilSetup::getSessionSettings ( )

reads session settings from db

Returns
array session_settings

Definition at line 2070 of file class.ilSetup.php.

References $query, $res, $row, DB_FETCHMODE_ASSOC, ilSessionControl\DEFAULT_ALLOW_CLIENT_MAINTENANCE, ilSessionControl\DEFAULT_MAX_COUNT, ilSessionControl\DEFAULT_MAX_IDLE, ilSessionControl\DEFAULT_MAX_IDLE_AFTER_FIRST_REQUEST, ilSessionControl\DEFAULT_MIN_IDLE, and ilSessionControl\getSettingFields().

2071  {
2072  require_once('Services/Authentication/classes/class.ilSessionControl.php');
2073 
2074  $db = $this->client->getDB();
2075 
2076  $setting_fields = ilSessionControl::getSettingFields();
2077 
2078  $query = "SELECT * FROM settings WHERE module = %s " .
2079  "AND ".$db->in('keyword', $setting_fields, false, 'text');
2080 
2081  $res = $db->queryF($query, array('text'), array('common'));
2082 
2083  $session_settings = array();
2084  while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
2085  {
2086  $session_settings[$row['keyword']] = $row['value'];
2087  }
2088 
2089  foreach( $setting_fields as $field )
2090  {
2091  if( !isset($session_settings[$field]) )
2092  {
2093  $value = 1;
2094 
2095  switch($field)
2096  {
2097  case 'session_max_count':
2098 
2100  break;
2101 
2102  case 'session_min_idle':
2103 
2105  break;
2106 
2107  case 'session_max_idle':
2108 
2110  break;
2111 
2112  case 'session_max_idle_after_first_request':
2113 
2115  break;
2116 
2117  case 'session_allow_client_maintenance':
2118 
2120  break;
2121  }
2122 
2123  $session_settings[$field] = $value;
2124  }
2125  }
2126 
2127  return $session_settings;
2128  }
const DEFAULT_MAX_COUNT
default value for settings that have not been defined in setup or administration yet ...
static getSettingFields()
returns the array of setting fields
const DB_FETCHMODE_ASSOC
Definition: class.ilDB.php:10
+ Here is the call graph for this function:

◆ getStatus()

ilSetup::getStatus (   $client = 0)

coumpute client status

Parameters
stringclient id
Returns
array status information

Definition at line 871 of file class.ilSetup.php.

References $client, checkAccess(), checkClientContact(), checkClientDatabase(), checkClientIni(), checkClientLanguages(), checkClientNIC(), checkClientProxySettings(), and checkFinish().

872  {
873  if (!is_object($client))
874  {
875  if ($this->ini_client_exists)
876  {
878  }
879  else
880  {
881  $client = new ilClient(0, $this->db_connections);
882  }
883  }
884 
885  $status = array();
886  $status["ini"] = $this->checkClientIni($client); // check this one
887  $status["db"] = $this->checkClientDatabase($client);
888  if ($status["db"]["status"] === false and $status["db"]["update"] !== true)
889  {
890  //$status["sess"]["status"] = false;
891  //$status["sess"]["comment"] = $status["db"]["comment"];
892  $status["lang"]["status"] = false;
893  $status["lang"]["comment"] = $status["db"]["comment"];
894  $status["contact"]["status"] = false;
895  $status["contact"]["comment"] = $status["db"]["comment"];
896 
897  $status["proxy"]["status"] = false;
898  $status["proxy"]["comment"] = $status["db"]["comment"];
899 
900  $status["nic"]["status"] = false;
901  $status["nic"]["comment"] = $status["db"]["comment"];
902  }
903  else
904  {
905  //$status["sess"] = $this->checkClientSessionSettings($client);
906  $status["lang"] = $this->checkClientLanguages($client);
907  $status["contact"] = $this->checkClientContact($client);
908  $status["proxy"] = $this->checkClientProxySettings($client);
909  $status["nic"] = $this->checkClientNIC($client);
910  $status["finish"] = $this->checkFinish($client);
911  $status["access"] = $this->checkAccess($client);
912  }
913 
914  //return value
915  return $status;
916  }
checkClientIni(&$client)
check client ini status
checkClientDatabase(&$client)
check client db status
checkClientContact(&$client)
check client contact data status
checkFinish(&$client)
check if client setup was finished
checkClientLanguages(&$client)
check client installed languages status
checkClientNIC(&$client)
check client nic status
Client Management.
checkAccess(&$client)
check client access status
checkClientProxySettings(&$client)
check client session config status
+ Here is the call graph for this function:

◆ hasOpCacheEnabled()

ilSetup::hasOpCacheEnabled ( )
Returns
bool

Definition at line 2319 of file class.ilSetup.php.

Referenced by queryPreliminaries().

2319  {
2320  $ini_get = ini_get('opcache.enable');
2321 
2322  return ($ini_get === 1 OR $ini_get === '1' OR strtolower($ini_get) === 'on');
2323  }
+ Here is the caller graph for this function:

◆ ilSetup()

ilSetup::ilSetup (   $a_auth,
  $a_auth_type 
)

constructor

Parameters
booleanuser is authenticated? (true) or not (false)
stringuser is admin or common user

Definition at line 67 of file class.ilSetup.php.

References $lng, $log, checkAuth(), ilFile\deleteTrailingSlash(), ILIAS_ABSOLUTE_PATH, init(), PEAR\PEAR(), PEAR_ERROR_CALLBACK, and PEAR\setErrorHandling().

68  {
69  global $log, $lng;
70 
71  $this->PEAR();
72  $this->lng = $lng;
73 
74  $this->db_connections = new ilDBConnections();
75 
76  define("ILIAS_MODULE","setup");
77 
78  $this->auth = ($this->checkAuth()) ? true : false;
79  $this->access_mode = $a_auth_type;
80 
81  // safe mode status & exec_dir
82  if ($this->safe_mode = ini_get("safe_mode"))
83  {
84  $this->safe_mode_exec_dir = ilFile::deleteTrailingSlash(ini_get("safe_mode_exec_dir"));
85  }
86 
87  // Error Handling
88  $this->error_obj = new ilErrorHandling();
89  $this->setErrorHandling(PEAR_ERROR_CALLBACK,array($this->error_obj,'errorHandler'));
90 
91  // set path to ilias.ini
92  $this->ini_file_path = ILIAS_ABSOLUTE_PATH."/ilias.ini.php";
93  $this->setup_defaults = ILIAS_ABSOLUTE_PATH."/setup/ilias.master.ini.php";
94 
95  // init setup.ini
96  $this->ini_ilias_exists = $this->init();
97 
98  if ($this->ini_ilias_exists)
99  {
100  if ($this->ini->readVariable("log","path") != "")
101  {
102  $log->path = $this->ini->readVariable("log","path");
103  }
104 
105  if ($this->ini->readVariable("log","file") != "")
106  {
107  $log->filename = $this->ini->readVariable("log","file");
108  }
109 
110  if ($this->ini->readVariable("log","enabled") != "")
111  {
112  $log->enabled = $this->ini->readVariable("log","enabled");
113  }
114  }
115  }
setErrorHandling($mode=null, $options=null)
Sets how errors generated by this object should be handled.
Definition: PEAR.php:335
Administrates DB connections in setup.
const PEAR_ERROR_CALLBACK
Definition: PEAR.php:35
PEAR($error_class=null)
Constructor.
Definition: PEAR.php:170
deleteTrailingSlash($a_path)
delete trailing slash of path variables
const ILIAS_ABSOLUTE_PATH
init()
init setup load settings from ilias.ini if exists and sets some constants
checkAuth()
check authentication status
Error Handling & global info handling uses PEAR error class.
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ init()

ilSetup::init ( )

init setup load settings from ilias.ini if exists and sets some constants

Returns
boolean

Definition at line 144 of file class.ilSetup.php.

Referenced by ilSetup().

145  {
146  // load data from setup.ini file
147  $this->ini = new ilIniFile($this->ini_file_path);
148 
149  if (!$this->ini->read())
150  {
151  $this->ini->GROUPS = parse_ini_file($this->setup_defaults,true);
152  $this->error = get_class($this).": ".$this->ini->getError();
153  return false;
154  }
155 
156  $this->setup_password = $this->ini->readVariable("setup","pass");
157  $this->default_client = $this->ini->readVariable("clients","default");
158 
159  define("ILIAS_DATA_DIR",$this->ini->readVariable("clients","datadir"));
160  define("ILIAS_WEB_DIR",$this->ini->readVariable("clients","path"));
161 
162  return true;
163  }
INIFile Parser.
+ Here is the caller graph for this function:

◆ installDatabase()

ilSetup::installDatabase ( )

set the database data

Returns
boolean

Definition at line 262 of file class.ilSetup.php.

References readDump().

263  {
264 /* if (!$this->client->checkDatabaseHost())
265  {
266  $this->error = "no_connection_to_host";
267  return false;
268  }*/
269 
270  if (!$this->client->connect())
271  {
272  return false;
273  }
274 
275  //take sql dump an put it in
276  if ($this->readDump($this->client->db, $this->SQL_FILE))
277  {
278  $this->client->db_installed = true;
279  return true;
280  }
281  else
282  {
283  return false;
284  }
285  }
readDump($db, $file)
execute a query
+ Here is the call graph for this function:

◆ isAdmin()

ilSetup::isAdmin ( )

check if current user is admin

Returns
boolean

Definition at line 1247 of file class.ilSetup.php.

1248  {
1249  return ($this->access_mode == "admin") ? true : false;
1250  }

◆ isAuthenticated()

ilSetup::isAuthenticated ( )

check if current user is authenticated

Returns
boolean

Definition at line 1238 of file class.ilSetup.php.

References $auth.

1239  {
1240  return $this->auth;
1241  }

◆ isInstalled()

ilSetup::isInstalled ( )

check if client's db is installed

Returns
boolean

Definition at line 1229 of file class.ilSetup.php.

References $ini_ilias_exists.

Referenced by newClient().

1230  {
1231  return $this->ini_ilias_exists;
1232  }
+ Here is the caller graph for this function:

◆ loginAsAdmin()

ilSetup::loginAsAdmin (   $a_password)

process setup admin login

Parameters
stringpassword
Returns
boolean

Definition at line 824 of file class.ilSetup.php.

References $_SESSION.

825  {
826  $a_password = md5($a_password);
827 
828  if ($this->ini->readVariable("setup","pass") == $a_password)
829  {
830  $_SESSION["auth"] = true;
831  $_SESSION["auth_path"] = ILIAS_HTTP_PATH;
832  $_SESSION["access_mode"] = "admin";
833  return true;
834  }
835 
836  return false;
837  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']

◆ loginAsClient()

ilSetup::loginAsClient (   $a_auth_data)

process client login

Parameters
array
Returns
boolean

Definition at line 722 of file class.ilSetup.php.

References $_SESSION, $data, $ilDB, $r, ilUserPasswordManager\getInstance(), IL_PASSWD_CRYPTED, and newClient().

723  {
724  global $ilDB;
725 
726  if (empty($a_auth_data["client_id"]))
727  {
728  $this->error = "no_client_id";
729  return false;
730  }
731 
732  if (empty($a_auth_data["username"]))
733  {
734  $this->error = "no_username";
735  return false;
736  }
737 
738  if (empty($a_auth_data["password"]))
739  {
740  $this->error = "no_password";
741  return false;
742  }
743 
744  if (!$this->newClient($a_auth_data["client_id"]))
745  {
746  $this->error = "unknown_client_id";
747  unset($this->client);
748  return false;
749  }
750 
751  if (!$this->client->db_exists)
752  {
753  $this->error = "no_db_connect_consult_admin";
754  unset($this->client);
755  return false;
756  }
757 
758  $s1 = $this->client->db->query("SELECT value from settings WHERE keyword = ".
759  $this->client->db->quote('system_role_id','text'));
760  $r1 = $this->client->db->fetchAssoc($s1);
761  $system_role_id = $r1["value"];
762 
763  $add_usrfields = '';
764  if($this->client->db->tableColumnExists('usr_data', 'passwd_enc_type'))
765  {
766  $add_usrfields .= ' , usr_data.passwd_enc_type, usr_data.passwd_salt ';
767  }
768  $q = "SELECT usr_data.usr_id, usr_data.passwd $add_usrfields " .
769  "FROM usr_data " .
770  "LEFT JOIN rbac_ua ON rbac_ua.usr_id=usr_data.usr_id " .
771  "WHERE rbac_ua.rol_id = " . $this->client->db->quote((int)$system_role_id, 'integer') . " " .
772  "AND usr_data.login=" . $this->client->db->quote($a_auth_data["username"], 'text');
773  $r = $this->client->db->query($q);
774  if(!$this->client->db->numRows($r))
775  {
776  $this->error = 'login_invalid';
777  return false;
778  }
779 
780  $data = $this->client->db->fetchAssoc($r);
781 
782  global $ilClientIniFile;
783 
784  $ilClientIniFile = $this->client->ini;
785 
786  require_once 'Services/User/classes/class.ilUserPasswordManager.php';
787  $crypt_type = ilUserPasswordManager::getInstance()->getEncoderName();
788  if(strlen($add_usrfields) && ilUserPasswordManager::getInstance()->isEncodingTypeSupported($crypt_type))
789  {
790  require_once 'setup/classes/class.ilObjSetupUser.php';
791  $user = new ilObjSetupUser();
792  $user->setPasswd($data['passwd'], IL_PASSWD_CRYPTED);
793  $user->setPasswordEncodingType($data['passwd_enc_type']);
794  $user->setPasswordSalt($data['passwd_salt']);
795 
796  $password_valid = ilUserPasswordManager::getInstance()->verifyPassword($user, $a_auth_data['password'], false);
797  }
798  else
799  {
800  $password_valid = $data['passwd'] == md5($a_auth_data['password']);
801  }
802 
803  if($password_valid)
804  {
805  // all checks passed -> user valid
806  $_SESSION['auth'] = true;
807  $_SESSION['auth_path'] = ILIAS_HTTP_PATH;
808  $_SESSION['access_mode'] = 'client';
809  $_SESSION['ClientId'] = $this->client->getId();
810  return true;
811  }
812  else
813  {
814  $this->error = 'login_invalid';
815  return false;
816  }
817  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
const IL_PASSWD_CRYPTED
newClient($a_client_id=0)
creates a client object in $this->client
Class ilObjSetupUser A class derived from ilObjUser for authentication purposes in the ILIAS setup...
global $ilDB
static getInstance()
Single method to reduce footprint (included files, created instances)
$r
+ Here is the call graph for this function:

◆ newClient()

ilSetup::newClient (   $a_client_id = 0)

creates a client object in $this->client

Parameters
stringclient id
Returns
boolean

Definition at line 844 of file class.ilSetup.php.

References $_SESSION, and isInstalled().

Referenced by loginAsClient().

845  {
846  if (!$this->isInstalled())
847  {
848  return false;
849  }
850 
851  $this->client = new ilClient($a_client_id, $this->db_connections);
852 
853  if (!$this->client->init())
854  {
855 //echo "<br>noclientinit";
856  $this->error = get_class($this).": ".$this->client->getError();
857  $_SESSION["ClientId"] = "";
858  return false;
859  }
860 
861  $_SESSION["ClientId"] = $a_client_id;
862 
863  return true;
864  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
isInstalled()
check if client&#39;s db is installed
Client Management.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ printProxyStatus()

ilSetup::printProxyStatus (   $client)

Print proxy settings.

private

Verifies the proxy server connection

Definition at line 2236 of file class.ilSetup.php.

References $client, $lng, PEAR_ERROR_RETURN, ilUtil\sendFailure(), and ilUtil\sendSuccess().

2237  {
2238  require_once './Services/Http/exceptions/class.ilProxyException.php';
2239  $settings = $client->getAllSettings();
2240 
2241  if((bool)$settings['proxy_status'] == true)
2242  {
2243  try
2244  {
2250  require_once 'Services/PEAR/lib/Net/Socket.php';
2251 
2252  $socket = new Net_Socket();
2253  $socket->setErrorHandling(PEAR_ERROR_RETURN);
2254  $response = $socket->connect($settings['proxy_host'], $settings['proxy_port']);
2255  if(!is_bool($response))
2256  {
2257  global $lng;
2258  throw new ilProxyException(strlen($response) ? $response : $lng->txt('proxy_not_connectable'));
2259  }
2260 
2261  ilUtil::sendSuccess($this->lng->txt('proxy_connectable'));
2262 
2263  }
2264  catch(ilProxyException $e)
2265  {
2266  ilUtil::sendFailure($this->lng->txt('proxy_pear_net_socket_error').': '.$e->getMessage());
2267  }
2268  }
2269 
2270  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Class for proxy related exception handling in ILIAS.
const PEAR_ERROR_RETURN
#+ ERROR constants
Definition: PEAR.php:31
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $lng
Definition: privfeed.php:40
Generalized Socket class.
Definition: Socket.php:35
+ Here is the call graph for this function:

◆ queryPreliminaries()

ilSetup::queryPreliminaries ( )

preliminaries

check if different things are ok for setting up ilias private

Returns
array

Definition at line 650 of file class.ilSetup.php.

References checkCookiesEnabled(), checkCreatable(), checkDom(), checkGd(), checkMemoryLimit(), checkOpcacheSettings(), checkPHPVersion(), checkWritable(), checkXsl(), and hasOpCacheEnabled().

Referenced by checkPreliminaries().

651  {
652  $a = array();
653  $a["php"] = $this->checkPHPVersion();
654 // $a["mysql"] = $this->checkMySQL();
655  $a["root"] = $this->checkWritable();
656  $a["folder_create"] = $this->checkCreatable();
657  $a["cookies_enabled"] = $this->checkCookiesEnabled();
658  $a["dom"] = $this->checkDom();
659  $a["xsl"] = $this->checkXsl();
660  $a["gd"] = $this->checkGd();
661  $a["memory"] = $this->checkMemoryLimit();
662 // var_dump(ini_get('opcache.enable') ); // FSX
663  if ($this->hasOpCacheEnabled()) {
664  $a["load_comments"] = $this->checkOpcacheSettings();
665  }
666 
667  return $a;
668  }
checkXsl()
Check MySQL.
checkCreatable($a_dir=".")
check for permission to create new folders in specified directory
checkWritable()
check for writable directory
checkOpcacheSettings()
checkDom()
Check MySQL.
checkMemoryLimit()
Check Memory Limit.
checkCookiesEnabled()
check cookies enabled
checkGd()
Check MySQL.
checkPHPVersion()
check for PHP version
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readDump()

ilSetup::readDump (   $db,
  $file 
)

execute a query

Parameters
string
string
Returns
boolean ture if query was processed successfully

Definition at line 306 of file class.ilSetup.php.

References $file, $r, $reader, and getline().

Referenced by installDatabase().

307  {
308  // mysql (old procedure)
309  if ($db->getDBType() == "mysql")
310  {
311  $fp = fopen($file, 'r');
312 
313  while(!feof($fp))
314  {
315  //$line = trim(fgets($fp, 200000));
316  $line = trim($this->getline($fp, "\n"));
317 
318  if ($line != "" && substr($line,0,1)!="#"
319  && substr($line,0,1)!="-")
320  {
321  //take line per line, until last char is ";"
322  if (substr($line,-1)==";")
323  {
324  //query is complete
325  $q .= " ".substr($line,0,-1);
326  $r = $db->query($q);
327 
328  if ($db->getErrorNo() > 0)
329  {
330  echo "<br />ERROR: ".$db->getError().
331  "<br />SQL: $q";
332  return false;
333  }
334  unset($q);
335  unset($line);
336  } //if
337  else
338  {
339  $q .= " ".$line;
340  } //else
341  } //if
342  } //for
343 
344  fclose($fp);
345  }
346 
347  #echo 'Start Memory: '.memory_get_usage().' peak: '.memory_get_peak_usage();
348  if (in_array($db->getDBType(), array("oracle", "postgres", "innodb")))
349  {
350  if(@is_dir('./setup/sql/ilDBTemplate'))
351  {
352  include_once './Services/Database/classes/class.ilArrayTableDataParser.php';
353  include_once './Services/Xml/exceptions/class.ilSaxParserException.php';
354  $reader = new tmpDirectoyIterator('./setup/sql/ilDBTemplate');
355  foreach($reader as $file)
356  {
357  eval(file_get_contents('./setup/sql/ilDBTemplate/'.$file));
358  try
359  {
360  $parser = new ilArrayTableDataParser('./setup/sql/ilDBTemplate/'.$file.'_inserts');
361  #$parser = new ilSimpleXMLTableDataParser('./setup/sql/ilDBTemplate/'.$file.'.xml');
362  $parser->startParsing();
363  #echo 'Table: '.$file.', memory: '.memory_get_peak_usage().' peak: '.memory_get_peak_usage().'<br />';flush();
364 
365  }
366  catch(ilSaxParserException $e)
367  {
368  die($e);
369  }
370  }
371  }
372  else
373  {
374  include_once("./setup/sql/ilDBTemplate.php");
375  setupILIASDatabase();
376  }
377  }
378  #echo 'Start Memory: '.memory_get_usage().' peak: '.memory_get_peak_usage();
379  return true;
380  }
print $file
SaxParserException thrown by ilSaxParser if property throwException is set.
getline( $fp, $delim)
$r
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveMasterSetup()

ilSetup::saveMasterSetup (   $a_formdata)

saves intial settings

Parameters
arrayform data
Returns
boolean

Definition at line 1257 of file class.ilSetup.php.

References $_SESSION, ilFile\deleteTrailingSlash(), ILIAS_ABSOLUTE_PATH, ilUtil\makeDir(), and ilUtil\stripSlashes().

1258  {
1259  $datadir_path = preg_replace("/\\\\/","/",ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["datadir_path"])));
1260 
1261  if ($a_formdata["chk_datadir_path"] == 1) // mode create dir
1262  {
1263  if (!ilUtil::makeDir($datadir_path))
1264  {
1265  $this->error = "create_datadir_failed";
1266  return false;
1267  }
1268  }
1269 
1270  // create webspace dir if it does not exist
1271  if (!@file_exists(ILIAS_ABSOLUTE_PATH."/".$this->ini->readVariable("clients","path")) and !@is_dir(ILIAS_ABSOLUTE_PATH."/".$this->ini->readVariable("clients","path")))
1272  {
1273  if (!ilUtil::makeDir(ILIAS_ABSOLUTE_PATH."/".$this->ini->readVariable("clients","path")))
1274  {
1275  $this->error = "create_webdir_failed";
1276  return false;
1277  }
1278  }
1279 
1280  $form_log_path = preg_replace("/\\\\/","/",ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["log_path"])));
1281  $log_path = substr($form_log_path,0,strrpos($form_log_path,"/"));
1282  $log_file = substr($form_log_path,strlen($log_path)+1);
1283 
1284  $this->ini->setVariable("server","http_path",ILIAS_HTTP_PATH);
1285  $this->ini->setVariable("server","absolute_path",ILIAS_ABSOLUTE_PATH);
1286  $this->ini->setVariable("server","timezone",preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["time_zone"])));
1287  $this->ini->setVariable("clients", "datadir", $datadir_path);
1288  $this->ini->setVariable("tools", "convert", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["convert_path"])));
1289  $this->ini->setVariable("tools", "zip", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["zip_path"])));
1290  $this->ini->setVariable("tools", "unzip", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["unzip_path"])));
1291  $this->ini->setVariable("tools", "ghostscript", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["ghostscript_path"])));
1292  $this->ini->setVariable("tools", "java", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["java_path"])));
1293  $this->ini->setVariable("tools", "htmldoc", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["htmldoc_path"])));
1294  //$this->ini->setVariable("tools", "mkisofs", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["mkisofs_path"])));
1295  $this->ini->setVariable("tools", "ffmpeg", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["ffmpeg_path"])));
1296  $this->ini->setVariable("tools", "latex", ilUtil::stripSlashes($a_formdata["latex_url"]));
1297  $this->ini->setVariable("tools", "vscantype", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["vscanner_type"])));
1298  $this->ini->setVariable("tools", "scancommand", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["scan_command"])));
1299  $this->ini->setVariable("tools", "cleancommand", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["clean_command"])));
1300  $this->ini->setVariable("setup", "pass", md5($a_formdata["setup_pass"]));
1301  $this->ini->setVariable("log", "path", $log_path);
1302  $this->ini->setVariable("log", "file", $log_file);
1303  $this->ini->setVariable("log", "enabled", ($a_formdata["chk_log_status"]) ? "0" : 1);
1304 
1305  $this->ini->setVariable("https","auto_https_detect_enabled", ($a_formdata["auto_https_detect_enabled"]) ? 1 : 0);
1306  $this->ini->setVariable("https","auto_https_detect_header_name", $a_formdata["auto_https_detect_header_name"]);
1307  $this->ini->setVariable("https","auto_https_detect_header_value", $a_formdata["auto_https_detect_header_value"]);
1308 
1309  if (!$this->ini->write())
1310  {
1311  $this->error = get_class($this).": ".$this->ini->getError();
1312  return false;
1313  }
1314 
1315  // everything is fine. so we authenticate the user and set access mode to 'admin'
1316  $_SESSION["auth"] = true;
1317  $_SESSION["auth_path"] = ILIAS_HTTP_PATH;
1318  $_SESSION["access_mode"] = "admin";
1319 
1320  return true;
1321  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
deleteTrailingSlash($a_path)
delete trailing slash of path variables
const ILIAS_ABSOLUTE_PATH
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:

◆ saveNewClient()

ilSetup::saveNewClient ( )

saves client.ini & updates client list in ilias.ini

Returns
boolean

Definition at line 169 of file class.ilSetup.php.

References $_SESSION.

Referenced by updateNewClient().

170  {
171  // save client id to session
172  $_SESSION["ClientId"] = $this->client->getId();
173 
174  // create client
175  if (!$this->client->create())
176  {
177  $this->error = $this->client->getError();
178  return false;
179  }
180 
181  //everything okay
182  $this->ini_client_exists = true;
183 
184  return true;
185  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ Here is the caller graph for this function:

◆ saveProxySettings()

ilSetup::saveProxySettings (   $proxy_settings)

Definition at line 2272 of file class.ilSetup.php.

References $query, $res, and $row.

2273  {
2274  $db = $this->client->getDB();
2275  $proxy_fields = array('proxy_status','proxy_host','proxy_port');
2276 
2277  foreach($proxy_fields as $field)
2278  {
2279  if( isset($proxy_settings[$field]) )
2280  {
2281  $query = "SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
2282  $res = $db->queryF($query,
2283  array('text', 'text'), array('common', $field));
2284 
2285  $row = array();
2286  while($row = $db->fetchAssoc($res)) break;
2287 
2288  if( count($row) > 0 )
2289  {
2290  $db->update(
2291  'settings',
2292  array(
2293  'value' => array('text', $proxy_settings[$field])
2294  ),
2295  array(
2296  'module' => array('text', 'common'),
2297  'keyword' => array('text', $field)
2298  )
2299  );
2300  }
2301  else
2302  {
2303  $db->insert(
2304  'settings',
2305  array(
2306  'module' => array('text', 'common'),
2307  'keyword' => array('text', $field),
2308  'value' => array('text', $proxy_settings[$field])
2309  )
2310  );
2311  }
2312  }
2313  }
2314  }

◆ setClient()

ilSetup::setClient (   $a_cl)
Parameters
$a_cl

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

127  {
128  $this->client = $a_cl;
129  }

◆ setPassword()

ilSetup::setPassword (   $a_password)

set setup master password

Parameters
stringpassword
Returns
boolean

Definition at line 704 of file class.ilSetup.php.

705  {
706  $this->ini->setVariable("setup","pass",md5($a_password));
707 
708  if ($this->ini->write() == false)
709  {
710  $this->error = $this->ini->getError();
711  return false;
712  }
713 
714  return true;
715  }

◆ setSessionSettings()

ilSetup::setSessionSettings (   $session_settings)

saves session settings to db

Parameters
array$session_settings

Definition at line 2010 of file class.ilSetup.php.

References $query, $res, $row, DB_FETCHMODE_ASSOC, ilSessionControl\getSettingFields(), and ilUtil\sendInfo().

2011  {
2012  require_once('Services/Authentication/classes/class.ilSessionControl.php');
2013 
2014  $db = $this->client->getDB();
2015 
2016  $setting_fields = ilSessionControl::getSettingFields();
2017 
2018  $i = 0;
2019  foreach($setting_fields as $field)
2020  {
2021  if( isset($session_settings[$field]) )
2022  {
2023  $query = "SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
2024  $res = $db->queryF($query,
2025  array('text', 'text'), array('common', $field));
2026 
2027  $row = array();
2028  while($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) break;
2029 
2030  if( count($row) > 0 )
2031  {
2032  $db->update(
2033  'settings',
2034  array(
2035  'value' => array('text', $session_settings[$field])
2036  ),
2037  array(
2038  'module' => array('text', 'common'),
2039  'keyword' => array('text', $field)
2040  )
2041  );
2042  }
2043  else
2044  {
2045  $db->insert(
2046  'settings',
2047  array(
2048  'module' => array('text', 'common'),
2049  'keyword' => array('text', $field),
2050  'value' => array('text', $session_settings[$field])
2051  )
2052  );
2053  }
2054 
2055  $i++;
2056  }
2057  }
2058 
2059  if($i < 4) $message = $this->lng->txt("session_settings_not_saved");
2060  else $message = $this->lng->txt("settings_saved");
2061 
2062  ilUtil::sendInfo($message);
2063  }
static getSettingFields()
returns the array of setting fields
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
const DB_FETCHMODE_ASSOC
Definition: class.ilDB.php:10
+ Here is the call graph for this function:

◆ testConvert()

ilSetup::testConvert (   $a_convert_path)

Check convert program.

Parameters
stringconvert path
Returns
boolean true -> OK | false -> not OK

Definition at line 1687 of file class.ilSetup.php.

Referenced by checkToolsSetup().

1688  {
1689  if (trim($a_convert_path) == "")
1690  {
1691  return "no_path_convert";
1692  }
1693  if (!is_file($a_convert_path))
1694  {
1695  return "check_failed_convert";
1696  }
1697 
1698  return "";
1699 
1700  }
+ Here is the caller graph for this function:

◆ testGhostscript()

ilSetup::testGhostscript (   $a_ghostscript_path)

Check ghostscript program.

Parameters
stringghostscript path
Returns
boolean true -> OK | false -> not OK

Definition at line 1708 of file class.ilSetup.php.

Referenced by checkToolsSetup().

1709  {
1710  // ghostscript is optional, so empty path is ok
1711  if (trim($a_ghostscript_path) == "")
1712  {
1713  return "";
1714  }
1715  if (!is_file($a_ghostscript_path))
1716  {
1717  return "check_failed_ghostscript";
1718  }
1719 
1720  return "";
1721  }
+ Here is the caller graph for this function:

◆ testHtmldoc()

ilSetup::testHtmldoc (   $a_htmldoc_path)

Check htmldoc program.

Parameters
stringhtmldoc_path
Returns
boolean true -> OK | false -> not OK

Definition at line 1884 of file class.ilSetup.php.

References ILIAS_ABSOLUTE_PATH.

Referenced by checkToolsSetup().

1885  {
1886  // java is optional, so empty path is ok
1887  if (trim($a_htmldoc_path) == "")
1888  {
1889  return "";
1890  }
1891 
1892  if (!is_file($a_htmldoc_path))
1893  {
1894  return "check_failed_htmldoc";
1895  }
1896 
1897  return "";
1898 
1899 
1900  $curDir = getcwd();
1901 
1902  chdir(ILIAS_ABSOLUTE_PATH);
1903 
1904  $html = "<html><head><title></title></head><body><p>test</p></body></html>";
1905 
1906  $html_file = "htmldoc_test_file.html";
1907 
1908  $fp = fopen( $html_file ,"wb");
1909  fwrite($fp, $html);
1910  fclose($fp);
1911 
1912  $htmldoc = $a_htmldoc_path." ";
1913  $htmldoc .= "--no-toc ";
1914  $htmldoc .= "--no-jpeg ";
1915  $htmldoc .= "--webpage ";
1916  $htmldoc .= "--outfile htmldoc_test_file.pdf ";
1917  $htmldoc .= "--bodyfont Arial ";
1918  $htmldoc .= "--charset iso-8859-15 ";
1919  $htmldoc .= "--color ";
1920  $htmldoc .= "--size A4 "; // --landscape
1921  $htmldoc .= "--format pdf ";
1922  $htmldoc .= "--footer ... ";
1923  $htmldoc .= "--header ... ";
1924  $htmldoc .= "--left 60 ";
1925  // $htmldoc .= "--right 200 ";
1926  $htmldoc .= $html_file;
1927  exec($htmldoc);
1928 
1929  unlink(ILIAS_ABSOLUTE_PATH."/".$html_file);
1930 
1931  chdir($curDir);
1932 
1933  if (file_exists(ILIAS_ABSOLUTE_PATH."/htmldoc_test_file.pdf"))
1934  {
1935  unlink(ILIAS_ABSOLUTE_PATH."/htmldoc_test_file.pdf");
1936  return true;
1937  }
1938  else
1939  {
1940  return false;
1941  }
1942  }
const ILIAS_ABSOLUTE_PATH
+ Here is the caller graph for this function:

◆ testJava()

ilSetup::testJava (   $a_java_path)

Check JVM.

Parameters
stringjava path
Returns
boolean true -> OK | false -> not OK

Definition at line 1729 of file class.ilSetup.php.

Referenced by checkToolsSetup().

1730  {
1731  // java is optional, so empty path is ok
1732  if (trim($a_java_path) == "")
1733  {
1734  return "";
1735  }
1736 
1737  if (!is_file($a_java_path))
1738  {
1739  return "check_failed_java";
1740  }
1741 
1742  return "";
1743 /*
1744  exec($a_java_path, $out, $back);
1745 
1746  unset($out);
1747 
1748  return ($back != 1) ? false : true;
1749 */
1750  }
+ Here is the caller graph for this function:

◆ testLatex()

ilSetup::testLatex (   $a_latex_url)

Check latex cgi script.

Parameters
stringlatex cgi url
Returns
boolean true -> OK | false -> not OK

Definition at line 1758 of file class.ilSetup.php.

References $result, and ilUtil\stripSlashes().

Referenced by checkToolsSetup().

1759  {
1760  // latex is optional, so empty path is ok
1761  if (trim($a_latex_url) == "")
1762  {
1763  return "";
1764  }
1765 
1766  // open the URL
1767  include_once "./setup/classes/class.ilHttpRequest.php";
1768  $http = new ilHttpRequest(ilUtil::stripSlashes($a_latex_url) . "?x_0");
1769  $result = @$http->downloadToString();
1770  if ((strpos((substr($result, 0, 5)), "PNG") !== FALSE) || (strpos((substr($result, 0, 5)), "GIF") !== FALSE))
1771  {
1772  return "";
1773  }
1774  else
1775  {
1776  return "check_failed_latex";;
1777  }
1778  }
$result
ilHttpRequest class
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testUnzip()

ilSetup::testUnzip (   $a_unzip_path)

Check unzip program.

Parameters
stringunzip_path
Returns
boolean true -> OK | false -> not OK

Definition at line 1839 of file class.ilSetup.php.

Referenced by checkToolsSetup().

1840  {
1841  if (trim($a_unzip_path) == "")
1842  {
1843  return "no_path_unzip";
1844  }
1845  if (!is_file($a_unzip_path))
1846  {
1847  return "check_failed_unzip";
1848  }
1849 
1850  return "";
1851 /*
1852  $curDir = getcwd();
1853 
1854  chdir(ILIAS_ABSOLUTE_PATH);
1855 
1856  if (file_exists(ILIAS_ABSOLUTE_PATH."/unzip_test_file.zip"))
1857  {
1858  $unzipCmd = $a_unzip_path." unzip_test_file.zip";
1859  exec($unzipCmd);
1860  }
1861 
1862  chdir($curDir);
1863 
1864  // check wether unzip extracted the test file or not
1865  if (file_exists(ILIAS_ABSOLUTE_PATH."/unzip_test_file.txt"))
1866  {
1867  unlink(ILIAS_ABSOLUTE_PATH."/unzip_test_file.txt");
1868 
1869  return true;
1870  }
1871  else
1872  {
1873  return false;
1874  }
1875 */
1876  }
+ Here is the caller graph for this function:

◆ testZip()

ilSetup::testZip (   $a_zip_path)

Check zip program.

Parameters
stringzip path
Returns
boolean true -> OK | false -> not OK

Definition at line 1786 of file class.ilSetup.php.

Referenced by checkToolsSetup().

1787  {
1788  if (trim($a_zip_path) == "")
1789  {
1790  return "no_path_zip";
1791  }
1792  if (!is_file($a_zip_path))
1793  {
1794  return "check_failed_zip";
1795  }
1796 
1797  return "";
1798 /*
1799  // create test file and run zip
1800  $fp = fopen(ILIAS_ABSOLUTE_PATH."/test.dat", "w");
1801 
1802  fwrite($fp, "test");
1803  fclose($fp);
1804 
1805  if (file_exists(ILIAS_ABSOLUTE_PATH."/test.dat"))
1806  {
1807  $curDir = getcwd();
1808  chdir(ILIAS_ABSOLUTE_PATH);
1809 
1810  $zipCmd = $a_zip_path." -m zip_test_file.zip test.dat";
1811 
1812  exec($zipCmd);
1813 
1814  chdir($curDir);
1815 
1816  }
1817 
1818  // check wether zip generated test file or not
1819  if (file_exists(ILIAS_ABSOLUTE_PATH."/zip_test_file.zip"))
1820  {
1821  unlink(ILIAS_ABSOLUTE_PATH."/zip_test_file.zip");
1822  return true;
1823  }
1824  else
1825  {
1826  unlink(ILIAS_ABSOLUTE_PATH."/test.dat");
1827  return false;
1828  }
1829 */
1830  }
+ Here is the caller graph for this function:

◆ unzip()

ilSetup::unzip (   $a_file,
  $overwrite = false 
)

unzip file

Parameters
string$a_filefull path/filename
boolean$overwritepass true to overwrite existing files

Definition at line 1951 of file class.ilSetup.php.

References $file, ilUtil\createDirectory(), and ilUtil\escapeShellArg().

1952  {
1953  //global $ilias;
1954 
1955  $pathinfo = pathinfo($a_file);
1956  $dir = $pathinfo["dirname"];
1957  $file = $pathinfo["basename"];
1958 
1959  // unzip
1960  $cdir = getcwd();
1961  chdir($dir);
1962  $unzip = $this->ini->readVariable("tools","unzip");
1963  $unzipcmd = $unzip." -Z -1 ".ilUtil::escapeShellArg($file);
1964  exec($unzipcmd, $arr);
1965  $zdirs = array();
1966 
1967  foreach($arr as $line)
1968  {
1969  if(is_int(strpos($line, "/")))
1970  {
1971  $zdir = substr($line, 0, strrpos($line, "/"));
1972  $nr = substr_count($zdir, "/");
1973  //echo $zdir." ".$nr."<br>";
1974  while ($zdir != "")
1975  {
1976  $nr = substr_count($zdir, "/");
1977  $zdirs[$zdir] = $nr; // collect directories
1978  //echo $dir." ".$nr."<br>";
1979  $zdir = substr($zdir, 0, strrpos($zdir, "/"));
1980  }
1981  }
1982  }
1983 
1984  asort($zdirs);
1985 
1986  foreach($zdirs as $zdir => $nr) // create directories
1987  {
1988  ilUtil::createDirectory($zdir);
1989  }
1990 
1991  // real unzip
1992  if ($overvwrite)
1993  {
1994  $unzipcmd = $unzip." ".ilUtil::escapeShellArg($file);
1995  }
1996  else
1997  {
1998  $unzipcmd = $unzip." -o ".ilUtil::escapeShellArg($file);
1999  }
2000  exec($unzipcmd);
2001 
2002  chdir($cdir);
2003  }
print $file
static createDirectory($a_dir, $a_mod=0755)
create directory
static escapeShellArg($a_arg)
+ Here is the call graph for this function:

◆ updateMasterSettings()

ilSetup::updateMasterSettings (   $a_formdata)

updates settings

Parameters
arrayform data
Returns
boolean

Definition at line 1328 of file class.ilSetup.php.

References ilFile\deleteTrailingSlash(), and ilUtil\stripSlashes().

1329  {
1330  $convert_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["convert_path"]));
1331  $zip_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["zip_path"]));
1332  $unzip_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["unzip_path"]));
1333  $ghostscript_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["ghostscript_path"]));
1334  $java_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["java_path"]));
1335  $htmldoc_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["htmldoc_path"]));
1336  //$mkisofs_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["mkisofs_path"]));
1337  $ffmpeg_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["ffmpeg_path"]));
1338  $latex_url = ilUtil::stripSlashes($a_formdata["latex_url"]);
1339  $fop_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["fop_path"]));
1340  $scan_type = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["vscanner_type"]));
1341  $scan_command = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["scan_command"]));
1342  $clean_command = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["clean_command"]));
1343 
1344  $this->ini->setVariable("tools", "convert", $convert_path);
1345  $this->ini->setVariable("tools", "zip", $zip_path);
1346  $this->ini->setVariable("tools", "unzip", $unzip_path);
1347  $this->ini->setVariable("tools", "ghostscript", $ghostscript_path);
1348  $this->ini->setVariable("tools", "java", $java_path);
1349  $this->ini->setVariable("tools", "htmldoc", $htmldoc_path);
1350  //$this->ini->setVariable("tools", "mkisofs", $mkisofs_path);
1351  $this->ini->setVariable("tools", "ffmpeg", $ffmpeg_path);
1352  $this->ini->setVariable("tools", "latex", $latex_url);
1353  $this->ini->setVariable("tools", "fop", $fop_path);
1354  $this->ini->setVariable("tools", "vscantype", $scan_type);
1355  $this->ini->setVariable("tools", "scancommand", $scan_command);
1356  $this->ini->setVariable("tools", "cleancommand", $clean_command);
1357 
1358  $form_log_path = preg_replace("/\\\\/","/",ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["log_path"])));
1359  $log_path = substr($form_log_path,0,strrpos($form_log_path,"/"));
1360  $log_file = substr($form_log_path,strlen($log_path)+1);
1361 
1362  $this->ini->setVariable("log", "path", $log_path);
1363  $this->ini->setVariable("log", "file", $log_file);
1364  $this->ini->setVariable("log", "enabled", ($a_formdata["chk_log_status"]) ? "0" : 1);
1365  $this->ini->setVariable("server","timezone",preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["time_zone"])));
1366 
1367  $this->ini->setVariable("https","auto_https_detect_enabled",($a_formdata["auto_https_detect_enabled"]) ? 1 : 0);
1368  $this->ini->setVariable("https","auto_https_detect_header_name", $a_formdata["auto_https_detect_header_name"]);
1369  $this->ini->setVariable("https","auto_https_detect_header_value", $a_formdata["auto_https_detect_header_value"]);
1370 
1371  if (!$this->ini->write())
1372  {
1373  $this->error = get_class($this).": ".$this->ini->getError();
1374  return false;
1375  }
1376 
1377  return true;
1378  }
deleteTrailingSlash($a_path)
delete trailing slash of path variables
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:

◆ updateNewClient()

ilSetup::updateNewClient (   $a_old_client_id)

update client.ini & move data dirs does not work correctly at this time - DISABLED

Returns
boolean

Definition at line 192 of file class.ilSetup.php.

References ilUtil\delDir(), ILIAS_ABSOLUTE_PATH, ILIAS_WEB_DIR, PEAR\raiseError(), and saveNewClient().

193  {
194  return true;
195  //var_dump("<pre>",$this->client,"</pre>");exit;
196 
197  if ($a_old_client_id != $this->client->getId())
198  {
199  // check for existing client dir
200  if (file_exists(ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR."/".$this->client->getId()))
201  {
202  $this->raiseError($this->lng->txt("client_id_already_exists"),$this->error_obj->MESSAGE);
203  }
204 
205  if (!$this->saveNewClient())
206  {
207  $this->raiseError($this->lng->txt("save_error"),$this->error_obj->MESSAGE);
208  }
209 
210  ilUtil::delDir(ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR."/".$a_old_client_id);
211  ilUtil::delDir(ILIAS_DATA_DIR."/".$a_old_client_id);
212  }
213 
214  //everything okay
215  $this->ini_client_exists = true;
216 
217  return true;
218  }
const ILIAS_WEB_DIR
const ILIAS_ABSOLUTE_PATH
& raiseError($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
This method is a wrapper that returns an instance of the configured error class with this object&#39;s de...
Definition: PEAR.php:524
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
saveNewClient()
saves client.ini & updates client list in ilias.ini
+ Here is the call graph for this function:

Field Documentation

◆ $access_mode

ilSetup::$access_mode

Definition at line 58 of file class.ilSetup.php.

◆ $auth

ilSetup::$auth

Definition at line 57 of file class.ilSetup.php.

Referenced by isAuthenticated().

◆ $client

◆ $db

ilSetup::$db

Definition at line 49 of file class.ilSetup.php.

◆ $default_client

ilSetup::$default_client

Definition at line 52 of file class.ilSetup.php.

◆ $dsn

ilSetup::$dsn = ""

Definition at line 42 of file class.ilSetup.php.

◆ $error

ilSetup::$error = ""

Definition at line 19 of file class.ilSetup.php.

Referenced by getError().

◆ $ilias_nic_server

ilSetup::$ilias_nic_server = "https://www.ilias.de/ilias-nic/index.php"

Definition at line 25 of file class.ilSetup.php.

◆ $ini

ilSetup::$ini

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

◆ $ini_client_exists

ilSetup::$ini_client_exists = false

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

◆ $ini_file_path

ilSetup::$ini_file_path

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

◆ $ini_ilias_exists

ilSetup::$ini_ilias_exists = false

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

Referenced by isInstalled().

◆ $preliminaries

ilSetup::$preliminaries = true

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

◆ $preliminaries_result

ilSetup::$preliminaries_result = array()

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

◆ $safe_mode

ilSetup::$safe_mode

Definition at line 54 of file class.ilSetup.php.

◆ $safe_mode_exec_dir

ilSetup::$safe_mode_exec_dir

Definition at line 55 of file class.ilSetup.php.

◆ $setup_defaults

ilSetup::$setup_defaults

Definition at line 24 of file class.ilSetup.php.

◆ $setup_password

ilSetup::$setup_password

Definition at line 51 of file class.ilSetup.php.

◆ $SQL_FILE

ilSetup::$SQL_FILE = "./setup/sql/ilias3.sql"

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


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