ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 ()
 
 isDirectoryInOther ($directory, $other_directory)
 Checks if directory is subdirectory of other directory. More...
 

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 1689 of file class.ilSetup.php.

1690  {
1691  //if ($this->ini->readVariable("db","type") != "")
1692  //{
1693  // $this->db->disconnect();
1694  //}
1695  return true;
1696  }

◆ checkAccess()

ilSetup::checkAccess ( $client)

check client access status

Parameters
objectclient
Returns
boolean

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

References $client.

Referenced by getStatus().

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

◆ checkAuth()

ilSetup::checkAuth ( )

check authentication status

Returns
boolean

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

References $_SESSION.

Referenced by ilSetup().

519  {
520  if ($_SESSION["auth"] === true && $_SESSION["auth_path"] == ILIAS_HTTP_PATH)
521  {
522  return true;
523  }
524 
525  return false;
526  }
$_SESSION["AccountId"]
+ Here is the caller graph for this function:

◆ checkClientContact()

ilSetup::checkClientContact ( $client)

check client contact data status

Parameters
objectclient
Returns
boolean

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

References $client, and ilUtil\is_email().

Referenced by getStatus().

1162  {
1163  $arr["status"] = true;
1164  //$arr["comment"] = $this->lng->txt("filled_out");
1165 
1166  $settings = $client->getAllSettings();
1167  $client_name = $client->getName();
1168 
1169  // check required fields
1170  if (empty($settings["admin_firstname"]) or empty($settings["admin_lastname"]) or
1171  empty($settings["admin_email"]) or empty($client_name))
1172  {
1173  $arr["status"] = false;
1174  $arr["comment"] = $this->lng->txt("missing_data");
1175  }
1176 
1177  // admin email
1178  if (!ilUtil::is_email($settings["admin_email"]) and $arr["status"] != false)
1179  {
1180  $arr["status"] = false;
1181  $arr["comment"] = $this->lng->txt("email_not_valid");
1182  }
1183 
1184  return $arr;
1185  }
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 986 of file class.ilSetup.php.

References $client, and $ilDB.

Referenced by getStatus().

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

References $client.

Referenced by getStatus().

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

◆ checkClientLanguages()

ilSetup::checkClientLanguages ( $client)

check client installed languages status

Parameters
objectclient
Returns
boolean

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

Referenced by getStatus().

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

◆ checkClientNIC()

ilSetup::checkClientNIC ( $client)

check client nic status

Parameters
objectclient
Returns
boolean

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

References $client.

Referenced by getStatus().

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

◆ checkClientProxySettings()

ilSetup::checkClientProxySettings ( $client)

check client session config status

Parameters
objectclient

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

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

Referenced by getStatus().

1092  {
1093  global $ilDB;
1094  $db = $ilDB;
1095 
1096  $fields = array('proxy_status','proxy_host','proxy_port');
1097 
1098  $query = "SELECT keyword, value FROM settings WHERE ".$db->in('keyword', $fields, false, 'text');
1099  $res = $db->query($query);
1100 
1101  $proxy_settings = array();
1102  $already_saved = false;
1103  while($row = $db->fetchAssoc($res))
1104  {
1105  $already_saved = true;
1106  $proxy_settings[$row['keyword']] = $row['value'];
1107  }
1108 
1109  if(!$already_saved)
1110  {
1111  $arr["status"] = false;
1112  $arr["comment"] = $this->lng->txt("proxy");
1113  $arr["text"] = $this->lng->txt("proxy");
1114  }
1115  else if((bool)$proxy_settings["proxy_status"] == false)
1116  {
1117  $arr["status"] = true;
1118  $arr["comment"] = $this->lng->txt("proxy_disabled");
1119  $arr["text"] = $this->lng->txt("proxy_disabled");
1120  }
1121  else
1122  {
1123  $arr["status"] = true;
1124  $arr["comment"] = $this->lng->txt("proxy_activated_configurated");
1125  $arr["text"] = $this->lng->txt("proxy_activated_configurated");
1126 
1127  }
1128  return $arr;
1129  }
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 1051 of file class.ilSetup.php.

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

1052  {
1053  require_once('Services/Authentication/classes/class.ilSessionControl.php');
1054 
1055  global $ilDB;
1056  $db = $ilDB;
1057 
1059 
1060  $query = "SELECT keyword, value FROM settings WHERE ".$db->in('keyword', $fields, false, 'text');
1061  $res = $db->query($query);
1062 
1063  $rows = array();
1064  while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
1065  {
1066  if( $row['value'] != '' )
1067  $rows[] = $row;
1068  else break;
1069  }
1070 
1071  if (count($rows) != count($fields))
1072  {
1073  if($a_as_bool) return false;
1074  $arr["status"] = false;
1075  $arr["comment"] = $this->lng->txt("session_management_not_configured");
1076  }
1077  else
1078  {
1079  if($a_as_bool) return true;
1080  $arr["status"] = true;
1081  $arr["comment"] = $this->lng->txt("session_management_configured");
1082  }
1083 
1084  return $arr;
1085  }
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 455 of file class.ilSetup.php.

References $sess.

Referenced by queryPreliminaries().

456  {
457  global $sess;
458 
459  if ($sess->usesCookies)
460  {
461  $arr["status"] = true;
462  $arr["comment"] = "";
463  }
464  else
465  {
466  $arr["status"] = false;
467  $arr["comment"] = $this->lng->txt("pre_cookies_disabled");
468  }
469 
470  return $arr;
471  }
+ 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 429 of file class.ilSetup.php.

Referenced by queryPreliminaries().

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

◆ checkDataDirSetup()

ilSetup::checkDataDirSetup (   $a_formdata)

check datadir path

Parameters
arrayform data
Returns
boolean

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

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

1552  {
1553  // remove trailing slash & convert backslashes to forwardslashes
1554  $datadir_path = preg_replace("/\\\\/","/",ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["datadir_path"])));
1555 
1556  if (empty($datadir_path))
1557  {
1558  $this->error = "no_path_datadir";
1559  return false;
1560  }
1561 
1562  $webspace_dir = ILIAS_ABSOLUTE_PATH . "/data";
1563 
1564  // datadir may not point to webspace dir or to any place under webspace_dir
1565  if (strpos($datadir_path,$webspace_dir) !== false)
1566  {
1567  $this->error = "datadir_webspacedir_match";
1568  return false;
1569  }
1570 
1571  // create dir
1572  if ($a_formdata["chk_datadir_path"] == 1)
1573  {
1574  $dir_to_create = substr(strrchr($datadir_path, "/"), 1);
1575  $dir_to_check = substr($datadir_path,0,- strlen($dir_to_create)-1);
1576 
1577  if ($this->isDirectoryInOther($dir_to_create, ILIAS_ABSOLUTE_PATH)) {
1578  $this->error = "cannot_create_datadir_inside_webdir";
1579  return false;
1580  }
1581 
1582  if (is_writable($datadir_path))
1583  {
1584  $this->error = "dir_exists_create";
1585  return false;
1586  }
1587 
1588  if (!is_writable($dir_to_check))
1589  {
1590  $this->error = "cannot_create_datadir_no_write_access";
1591  return false;
1592  }
1593  }
1594  else // check set target dir
1595  {
1596  if ($this->isDirectoryInOther($datadir_path, ILIAS_ABSOLUTE_PATH)) {
1597  $this->error = "cannot_create_datadir_inside_webdir";
1598  return false;
1599  }
1600 
1601  if (!is_writable($datadir_path))
1602  {
1603  $this->error = "cannot_create_datadir_no_write_access";
1604  return false;
1605  }
1606  }
1607 
1608  return true;
1609  }
isDirectoryInOther($directory, $other_directory)
Checks if directory is subdirectory of other directory.
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 533 of file class.ilSetup.php.

References $ilDB.

Referenced by queryPreliminaries().

534  {
535  global $ilDB;
536 
537  if (class_exists("DOMDocument"))
538  {
539  $arr["status"] = true;
540  }
541  else
542  {
543  $arr["status"] = false;
544  $arr["comment"] = $this->lng->txt("pre_dom_missing");
545  }
546 
547  return $arr;
548  }
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 925 of file class.ilSetup.php.

References $client.

Referenced by getStatus().

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

◆ checkGd()

ilSetup::checkGd ( )

Check MySQL.

Returns
boolean

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

References $ilDB.

Referenced by queryPreliminaries().

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

◆ checkIniFileExists()

ilSetup::checkIniFileExists ( )

check if inifile exists

Returns
boolean

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

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

◆ checkLogSetup()

ilSetup::checkLogSetup (   $a_formdata)

check log path

Parameters
arrayform data
Returns
boolean

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

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

1639  {
1640  // log path
1641  if (!$a_formdata["chk_log_status"])
1642  {
1643  // remove trailing slash & convert backslashes to forwardslashes
1644  $log_path = preg_replace("/\\\\/","/",ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["log_path"])));
1645 
1646  if (empty($log_path))
1647  {
1648  $this->error = "no_path_log";
1649  return false;
1650  }
1651 
1652  if ($this->isDirectoryInOther($log_path, ILIAS_ABSOLUTE_PATH)) {
1653  $this->error = "cannot_create_logdir_inside_webdir";
1654  return false;
1655  }
1656 
1657  if (!@touch($log_path))
1658  {
1659  $this->error = "could_not_create_logfile";
1660  return false;
1661  }
1662  }
1663 
1664  return true;
1665  }
isDirectoryInOther($directory, $other_directory)
Checks if directory is subdirectory of other directory.
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:

◆ checkMemoryLimit()

ilSetup::checkMemoryLimit ( )

Check Memory Limit.

Returns
boolean

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

References $ilDB.

Referenced by queryPreliminaries().

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

◆ checkMySQL()

ilSetup::checkMySQL ( )

Check MySQL.

Returns
boolean

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

References $ilDB.

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

◆ checkOpcacheSettings()

ilSetup::checkOpcacheSettings ( )
protected
Returns
array

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

Referenced by queryPreliminaries().

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

◆ checkPasswordSetup()

ilSetup::checkPasswordSetup (   $a_formdata)

check setup password

Parameters
arrayform data
Returns
boolean

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

1617  {
1618  if (!$a_formdata["setup_pass"])
1619  {
1620  $this->error = "no_setup_pass_given";
1621  return false;
1622  }
1623 
1624  if ($a_formdata["setup_pass"] != $a_formdata["setup_pass2"])
1625  {
1626  $this->error = "pass_does_not_match";
1627  return false;
1628  }
1629 
1630  return true;
1631  }

◆ checkPHPVersion()

ilSetup::checkPHPVersion ( )

check for PHP version

Returns
array

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

Referenced by queryPreliminaries().

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

◆ checkPreliminaries()

ilSetup::checkPreliminaries ( )

check all prliminaries

Returns
boolean

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

References queryPreliminaries().

677  {
678  $this->preliminaries_result = $this->queryPreliminaries();
679 
680  foreach ($this->preliminaries_result as $val)
681  {
682  if ($val["status"] === false)
683  {
684  $this->preliminaries = false;
685  return false;
686  }
687  }
688 
689  return true;
690  }
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 1387 of file class.ilSetup.php.

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

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

Referenced by queryPreliminaries().

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

◆ checkXsl()

ilSetup::checkXsl ( )

Check MySQL.

Returns
boolean

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

References $ilDB.

Referenced by queryPreliminaries().

555  {
556  global $ilDB;
557 
558  if (class_exists("XSLTProcessor"))
559  {
560  $arr["status"] = true;
561  }
562  else
563  {
564  $arr["status"] = false;
565  $arr["comment"] = sprintf($this->lng->txt("pre_xsl_missing"),
566  "http://php.net/manual/en/book.xsl.php");
567  }
568 
569  return $arr;
570  }
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 2152 of file class.ilSetup.php.

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

2153  {
2154  // Getting source and targets
2155  $source = new ilClient($source_id, $this->db_connections);
2156  $source->init();
2157  $target = $this->client;
2158 
2159  // ************************************************
2160  // ** COPY FILES
2161 
2162  // Cleaning up datadir
2163  if (! ilUtil::delDir($target->getDataDir())) {
2164  $this->error = "Could not delete data dir $target->getDataDir()";
2165  //return false;
2166  }
2167 
2168  // Create empty datadir
2169  if (!ilUtil::makeDir($target->getDataDir()))
2170  {
2171  $this->error = "could_not_create_base_data_dir :".$target->getDataDir();
2172  return false;
2173  }
2174 
2175  // Copying datadir
2176  if (! ilUtil::rCopy($source->getDataDir(),$target->getDataDir())) {
2177  $this->error = "clone_datadircopyfail";
2178  $target->ini->write();
2179  return false;
2180  }
2181 
2182  // Cleaning up Webspacedir
2183  if (! ilUtil::delDir($target->getWebspaceDir())) {
2184  $this->error = "Could not delete webspace dir $target->getWebspaceDir()";
2185  //return false;
2186  }
2187 
2188  // Create empty Webspacedir
2189  if (!ilUtil::makeDir($target->getWebspaceDir()))
2190  {
2191  $this->error = "could_not_create_base_webspace_dir :".$target->getWebspaceDir();
2192  return false;
2193  }
2194 
2195  // Copying Webspacedir
2196  if (! ilUtil::rCopy($source->getWebspaceDir(),$target->getWebspaceDir())) {
2197  $this->error = "clone_websipacedircopyfail";
2198  $target->ini->write();
2199  return false;
2200  }
2201 
2202  // Restore ini file
2203  $target->ini->write();
2204 
2205  // ************************************************
2206  // ** COPY DATABASE
2207 
2208  $source->connect();
2209  if (!$source->db)
2210  {
2211  $this->error = "Source database connection failed.";
2212  return false;
2213  }
2214 
2215  $target->connect();
2216  if (!$target->db)
2217  {
2218  $this->error = "Target database connection failed.";
2219  return false;
2220  }
2221 
2222  $source->connect();
2223  $srcTables = $source->db->query("SHOW TABLES");
2224  $target->connect();
2225 
2226  // drop all tables of the target db
2227  $tarTables = $target->db->query("SHOW TABLES");
2228  foreach($tarTables->fetchAll() as $cTable)
2229  {
2230  $target->db->query("DROP TABLE IF EXISTS " . $cTable[0]);
2231  }
2232 
2233  foreach($srcTables->fetchAll() as $cTable){
2234  $drop = $target->db->query("DROP TABLE IF EXISTS " . $cTable[0]);
2235  $create = $target->db->query("CREATE TABLE " . $cTable[0] . " LIKE " . $source->getDbName() . "." . $cTable[0]);
2236  if(!$create) {
2237  $error = true;
2238  }
2239  $insert = $target->db->query("INSERT INTO " . $cTable[0] . " SELECT * FROM ".$source->getDbName().".".$cTable[0]);
2240  }
2241 
2242  $target->db->query("UPDATE settings SET VALUE = ".$target->db->quote(0, "integer")." WHERE keyword = ".$target->db->quote("inst_id", "text"));
2243  $target->db->query("UPDATE settings SET VALUE = ".$target->db->quote(0, "integer")." WHERE keyword = ".$target->db->quote("nic_enabled", "text"));
2244  return true;
2245  }
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 226 of file class.ilSetup.php.

References $r, and MDB2\isError().

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

◆ getClient()

ilSetup::getClient ( )
Returns
ilClient

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

References $client.

137  {
138  return $this->client;
139  }

◆ getError()

ilSetup::getError ( )

get Error message

Returns
string error message

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

References $error.

1672  {
1673  if (empty($this->error))
1674  {
1675  return false;
1676  }
1677 
1678  $error = $this->error;
1679  $this->error = "";
1680 
1681  return $error;
1682  }

◆ getline()

ilSetup::getline (   $fp,
  $delim 
)

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

References $result.

Referenced by readDump().

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

◆ getPassword()

ilSetup::getPassword ( )

get setup master password

Returns
string

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

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

◆ getSessionSettings()

ilSetup::getSessionSettings ( )

reads session settings from db

Returns
array session_settings

Definition at line 2087 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().

2088  {
2089  require_once('Services/Authentication/classes/class.ilSessionControl.php');
2090 
2091  $db = $this->client->getDB();
2092 
2093  $setting_fields = ilSessionControl::getSettingFields();
2094 
2095  $query = "SELECT * FROM settings WHERE module = %s " .
2096  "AND ".$db->in('keyword', $setting_fields, false, 'text');
2097 
2098  $res = $db->queryF($query, array('text'), array('common'));
2099 
2100  $session_settings = array();
2101  while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
2102  {
2103  $session_settings[$row['keyword']] = $row['value'];
2104  }
2105 
2106  foreach( $setting_fields as $field )
2107  {
2108  if( !isset($session_settings[$field]) )
2109  {
2110  $value = 1;
2111 
2112  switch($field)
2113  {
2114  case 'session_max_count':
2115 
2117  break;
2118 
2119  case 'session_min_idle':
2120 
2122  break;
2123 
2124  case 'session_max_idle':
2125 
2127  break;
2128 
2129  case 'session_max_idle_after_first_request':
2130 
2132  break;
2133 
2134  case 'session_allow_client_maintenance':
2135 
2137  break;
2138  }
2139 
2140  $session_settings[$field] = $value;
2141  }
2142  }
2143 
2144  return $session_settings;
2145  }
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 873 of file class.ilSetup.php.

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

874  {
875  if (!is_object($client))
876  {
877  if ($this->ini_client_exists)
878  {
880  }
881  else
882  {
883  $client = new ilClient(0, $this->db_connections);
884  }
885  }
886 
887  $status = array();
888  $status["ini"] = $this->checkClientIni($client); // check this one
889  $status["db"] = $this->checkClientDatabase($client);
890  if ($status["db"]["status"] === false and $status["db"]["update"] !== true)
891  {
892  //$status["sess"]["status"] = false;
893  //$status["sess"]["comment"] = $status["db"]["comment"];
894  $status["lang"]["status"] = false;
895  $status["lang"]["comment"] = $status["db"]["comment"];
896  $status["contact"]["status"] = false;
897  $status["contact"]["comment"] = $status["db"]["comment"];
898 
899  $status["proxy"]["status"] = false;
900  $status["proxy"]["comment"] = $status["db"]["comment"];
901 
902  $status["nic"]["status"] = false;
903  $status["nic"]["comment"] = $status["db"]["comment"];
904  }
905  else
906  {
907  //$status["sess"] = $this->checkClientSessionSettings($client);
908  $status["lang"] = $this->checkClientLanguages($client);
909  $status["contact"] = $this->checkClientContact($client);
910  $status["proxy"] = $this->checkClientProxySettings($client);
911  $status["nic"] = $this->checkClientNIC($client);
912  $status["finish"] = $this->checkFinish($client);
913  $status["access"] = $this->checkAccess($client);
914  }
915 
916  //return value
917  return $status;
918  }
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 2336 of file class.ilSetup.php.

Referenced by queryPreliminaries().

2336  {
2337  $ini_get = ini_get('opcache.enable');
2338 
2339  return ($ini_get === 1 OR $ini_get === '1' OR strtolower($ini_get) === 'on');
2340  }
+ 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  /*
99  if ($this->ini_ilias_exists)
100  {
101  if ($this->ini->readVariable("log","path") != "")
102  {
103  $log->path = $this->ini->readVariable("log","path");
104  }
105 
106  if ($this->ini->readVariable("log","file") != "")
107  {
108  $log->filename = $this->ini->readVariable("log","file");
109  }
110 
111  if ($this->ini->readVariable("log","enabled") != "")
112  {
113  $log->enabled = $this->ini->readVariable("log","enabled");
114  }
115  }
116  */
117  }
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
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 146 of file class.ilSetup.php.

Referenced by ilSetup().

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

◆ installDatabase()

ilSetup::installDatabase ( )

set the database data

Returns
boolean

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

References readDump().

265  {
266 /* if (!$this->client->checkDatabaseHost())
267  {
268  $this->error = "no_connection_to_host";
269  return false;
270  }*/
271 
272  if (!$this->client->connect())
273  {
274  return false;
275  }
276 
277  //take sql dump an put it in
278  if ($this->readDump($this->client->db, $this->SQL_FILE))
279  {
280  $this->client->db_installed = true;
281  return true;
282  }
283  else
284  {
285  return false;
286  }
287  }
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 1249 of file class.ilSetup.php.

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

◆ isAuthenticated()

ilSetup::isAuthenticated ( )

check if current user is authenticated

Returns
boolean

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

References $auth.

1241  {
1242  return $this->auth;
1243  }

◆ isDirectoryInOther()

ilSetup::isDirectoryInOther (   $directory,
  $other_directory 
)
protected

Checks if directory is subdirectory of other directory.

Parameters
string$directory
string$other_directory
Returns
bool

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

Referenced by checkDataDirSetup(), and checkLogSetup().

2349  {
2350  $other_directory = $other_directory."/";
2351 
2352  return !(strpos($directory, $other_directory) !== 0);
2353  }
+ Here is the caller graph for this function:

◆ isInstalled()

ilSetup::isInstalled ( )

check if client's db is installed

Returns
boolean

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

References $ini_ilias_exists.

Referenced by newClient().

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

◆ loginAsAdmin()

ilSetup::loginAsAdmin (   $a_password)

process setup admin login

Parameters
stringpassword
Returns
boolean

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

References $_SESSION.

827  {
828  $a_password = md5($a_password);
829 
830  if ($this->ini->readVariable("setup","pass") == $a_password)
831  {
832  $_SESSION["auth"] = true;
833  $_SESSION["auth_path"] = ILIAS_HTTP_PATH;
834  $_SESSION["access_mode"] = "admin";
835  return true;
836  }
837 
838  return false;
839  }
$_SESSION["AccountId"]

◆ loginAsClient()

ilSetup::loginAsClient (   $a_auth_data)

process client login

Parameters
array
Returns
boolean

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

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

725  {
726  global $ilDB;
727 
728  if (empty($a_auth_data["client_id"]))
729  {
730  $this->error = "no_client_id";
731  return false;
732  }
733 
734  if (empty($a_auth_data["username"]))
735  {
736  $this->error = "no_username";
737  return false;
738  }
739 
740  if (empty($a_auth_data["password"]))
741  {
742  $this->error = "no_password";
743  return false;
744  }
745 
746  if (!$this->newClient($a_auth_data["client_id"]))
747  {
748  $this->error = "unknown_client_id";
749  unset($this->client);
750  return false;
751  }
752 
753  if (!$this->client->db_exists)
754  {
755  $this->error = "no_db_connect_consult_admin";
756  unset($this->client);
757  return false;
758  }
759 
760  $s1 = $this->client->db->query("SELECT value from settings WHERE keyword = ".
761  $this->client->db->quote('system_role_id','text'));
762  $r1 = $this->client->db->fetchAssoc($s1);
763  $system_role_id = $r1["value"];
764 
765  $add_usrfields = '';
766  if($this->client->db->tableColumnExists('usr_data', 'passwd_enc_type'))
767  {
768  $add_usrfields .= ' , usr_data.passwd_enc_type, usr_data.passwd_salt ';
769  }
770  $q = "SELECT usr_data.usr_id, usr_data.passwd $add_usrfields " .
771  "FROM usr_data " .
772  "LEFT JOIN rbac_ua ON rbac_ua.usr_id=usr_data.usr_id " .
773  "WHERE rbac_ua.rol_id = " . $this->client->db->quote((int)$system_role_id, 'integer') . " " .
774  "AND usr_data.login=" . $this->client->db->quote($a_auth_data["username"], 'text');
775  $r = $this->client->db->query($q);
776  if(!$this->client->db->numRows($r))
777  {
778  $this->error = 'login_invalid';
779  return false;
780  }
781 
782  $data = $this->client->db->fetchAssoc($r);
783 
784  global $ilClientIniFile;
785 
786  $ilClientIniFile = $this->client->ini;
787 
788  require_once 'Services/User/classes/class.ilUserPasswordManager.php';
789  $crypt_type = ilUserPasswordManager::getInstance()->getEncoderName();
790  if(strlen($add_usrfields) && ilUserPasswordManager::getInstance()->isEncodingTypeSupported($crypt_type))
791  {
792  require_once 'setup/classes/class.ilObjSetupUser.php';
793  $user = new ilObjSetupUser();
794  $user->setPasswd($data['passwd'], IL_PASSWD_CRYPTED);
795  $user->setPasswordEncodingType($data['passwd_enc_type']);
796  $user->setPasswordSalt($data['passwd_salt']);
797 
798  $password_valid = ilUserPasswordManager::getInstance()->verifyPassword($user, $a_auth_data['password'], false);
799  }
800  else
801  {
802  $password_valid = $data['passwd'] == md5($a_auth_data['password']);
803  }
804 
805  if($password_valid)
806  {
807  // all checks passed -> user valid
808  $_SESSION['auth'] = true;
809  $_SESSION['auth_path'] = ILIAS_HTTP_PATH;
810  $_SESSION['access_mode'] = 'client';
811  $_SESSION['ClientId'] = $this->client->getId();
812  return true;
813  }
814  else
815  {
816  $this->error = 'login_invalid';
817  return false;
818  }
819  }
$_SESSION["AccountId"]
const IL_PASSWD_CRYPTED
$r
Definition: example_031.php:79
$data
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)
+ 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 846 of file class.ilSetup.php.

References $_SESSION, and isInstalled().

Referenced by loginAsClient().

847  {
848  if (!$this->isInstalled())
849  {
850  return false;
851  }
852 
853  $this->client = new ilClient($a_client_id, $this->db_connections);
854 
855  if (!$this->client->init())
856  {
857 //echo "<br>noclientinit";
858  $this->error = get_class($this).": ".$this->client->getError();
859  $_SESSION["ClientId"] = "";
860  return false;
861  }
862 
863  $_SESSION["ClientId"] = $a_client_id;
864 
865  return true;
866  }
$_SESSION["AccountId"]
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 2253 of file class.ilSetup.php.

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

2254  {
2255  require_once './Services/Http/exceptions/class.ilProxyException.php';
2256  $settings = $client->getAllSettings();
2257 
2258  if((bool)$settings['proxy_status'] == true)
2259  {
2260  try
2261  {
2267  require_once 'Services/PEAR/lib/Net/Socket.php';
2268 
2269  $socket = new Net_Socket();
2270  $socket->setErrorHandling(PEAR_ERROR_RETURN);
2271  $response = $socket->connect($settings['proxy_host'], $settings['proxy_port']);
2272  if(!is_bool($response))
2273  {
2274  global $lng;
2275  throw new ilProxyException(strlen($response) ? $response : $lng->txt('proxy_not_connectable'));
2276  }
2277 
2278  ilUtil::sendSuccess($this->lng->txt('proxy_connectable'));
2279 
2280  }
2281  catch(ilProxyException $e)
2282  {
2283  ilUtil::sendFailure($this->lng->txt('proxy_pear_net_socket_error').': '.$e->getMessage());
2284  }
2285  }
2286 
2287  }
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 652 of file class.ilSetup.php.

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

Referenced by checkPreliminaries().

653  {
654  $a = array();
655  $a["php"] = $this->checkPHPVersion();
656 // $a["mysql"] = $this->checkMySQL();
657  $a["root"] = $this->checkWritable();
658  $a["folder_create"] = $this->checkCreatable();
659  $a["cookies_enabled"] = $this->checkCookiesEnabled();
660  $a["dom"] = $this->checkDom();
661  $a["xsl"] = $this->checkXsl();
662  $a["gd"] = $this->checkGd();
663  $a["memory"] = $this->checkMemoryLimit();
664 // var_dump(ini_get('opcache.enable') ); // FSX
665  if ($this->hasOpCacheEnabled()) {
666  $a["load_comments"] = $this->checkOpcacheSettings();
667  }
668 
669  return $a;
670  }
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 308 of file class.ilSetup.php.

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

Referenced by installDatabase().

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

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

1260  {
1261  $datadir_path = preg_replace("/\\\\/","/",ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["datadir_path"])));
1262 
1263  if ($a_formdata["chk_datadir_path"] == 1) // mode create dir
1264  {
1265  if (!ilUtil::makeDir($datadir_path))
1266  {
1267  $this->error = "create_datadir_failed";
1268  return false;
1269  }
1270  }
1271 
1272  // create webspace dir if it does not exist
1273  if (!@file_exists(ILIAS_ABSOLUTE_PATH."/".$this->ini->readVariable("clients","path")) and !@is_dir(ILIAS_ABSOLUTE_PATH."/".$this->ini->readVariable("clients","path")))
1274  {
1275  if (!ilUtil::makeDir(ILIAS_ABSOLUTE_PATH."/".$this->ini->readVariable("clients","path")))
1276  {
1277  $this->error = "create_webdir_failed";
1278  return false;
1279  }
1280  }
1281 
1282  $form_log_path = preg_replace("/\\\\/","/",ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["log_path"])));
1283  $log_path = substr($form_log_path,0,strrpos($form_log_path,"/"));
1284  $log_file = substr($form_log_path,strlen($log_path)+1);
1285 
1286  $this->ini->setVariable("server","http_path",ILIAS_HTTP_PATH);
1287  $this->ini->setVariable("server","absolute_path",ILIAS_ABSOLUTE_PATH);
1288  $this->ini->setVariable("server","timezone",preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["time_zone"])));
1289  $this->ini->setVariable("clients", "datadir", $datadir_path);
1290  $this->ini->setVariable("tools", "convert", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["convert_path"])));
1291  $this->ini->setVariable("tools", "zip", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["zip_path"])));
1292  $this->ini->setVariable("tools", "unzip", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["unzip_path"])));
1293  $this->ini->setVariable("tools", "ghostscript", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["ghostscript_path"])));
1294  $this->ini->setVariable("tools", "java", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["java_path"])));
1295  $this->ini->setVariable("tools", "htmldoc", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["htmldoc_path"])));
1296  //$this->ini->setVariable("tools", "mkisofs", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["mkisofs_path"])));
1297  $this->ini->setVariable("tools", "ffmpeg", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["ffmpeg_path"])));
1298  $this->ini->setVariable("tools", "latex", ilUtil::stripSlashes($a_formdata["latex_url"]));
1299  $this->ini->setVariable("tools", "vscantype", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["vscanner_type"])));
1300  $this->ini->setVariable("tools", "scancommand", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["scan_command"])));
1301  $this->ini->setVariable("tools", "cleancommand", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["clean_command"])));
1302  $this->ini->setVariable("setup", "pass", md5($a_formdata["setup_pass"]));
1303  $this->ini->setVariable("log", "path", $log_path);
1304  $this->ini->setVariable("log", "file", $log_file);
1305  $this->ini->setVariable("log", "enabled", ($a_formdata["chk_log_status"]) ? "0" : 1);
1306 
1307  $this->ini->setVariable("https","auto_https_detect_enabled", ($a_formdata["auto_https_detect_enabled"]) ? 1 : 0);
1308  $this->ini->setVariable("https","auto_https_detect_header_name", $a_formdata["auto_https_detect_header_name"]);
1309  $this->ini->setVariable("https","auto_https_detect_header_value", $a_formdata["auto_https_detect_header_value"]);
1310 
1311  if (!$this->ini->write())
1312  {
1313  $this->error = get_class($this).": ".$this->ini->getError();
1314  return false;
1315  }
1316 
1317  // everything is fine. so we authenticate the user and set access mode to 'admin'
1318  $_SESSION["auth"] = true;
1319  $_SESSION["auth_path"] = ILIAS_HTTP_PATH;
1320  $_SESSION["access_mode"] = "admin";
1321 
1322  return true;
1323  }
$_SESSION["AccountId"]
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 171 of file class.ilSetup.php.

References $_SESSION.

Referenced by updateNewClient().

172  {
173  // save client id to session
174  $_SESSION["ClientId"] = $this->client->getId();
175 
176  // create client
177  if (!$this->client->create())
178  {
179  $this->error = $this->client->getError();
180  return false;
181  }
182 
183  //everything okay
184  $this->ini_client_exists = true;
185 
186  return true;
187  }
$_SESSION["AccountId"]
+ Here is the caller graph for this function:

◆ saveProxySettings()

ilSetup::saveProxySettings (   $proxy_settings)

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

References $query, $res, and $row.

2290  {
2291  $db = $this->client->getDB();
2292  $proxy_fields = array('proxy_status','proxy_host','proxy_port');
2293 
2294  foreach($proxy_fields as $field)
2295  {
2296  if( isset($proxy_settings[$field]) )
2297  {
2298  $query = "SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
2299  $res = $db->queryF($query,
2300  array('text', 'text'), array('common', $field));
2301 
2302  $row = array();
2303  while($row = $db->fetchAssoc($res)) break;
2304 
2305  if( count($row) > 0 )
2306  {
2307  $db->update(
2308  'settings',
2309  array(
2310  'value' => array('text', $proxy_settings[$field])
2311  ),
2312  array(
2313  'module' => array('text', 'common'),
2314  'keyword' => array('text', $field)
2315  )
2316  );
2317  }
2318  else
2319  {
2320  $db->insert(
2321  'settings',
2322  array(
2323  'module' => array('text', 'common'),
2324  'keyword' => array('text', $field),
2325  'value' => array('text', $proxy_settings[$field])
2326  )
2327  );
2328  }
2329  }
2330  }
2331  }

◆ setClient()

ilSetup::setClient (   $a_cl)
Parameters
$a_cl

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

129  {
130  $this->client = $a_cl;
131  }

◆ setPassword()

ilSetup::setPassword (   $a_password)

set setup master password

Parameters
stringpassword
Returns
boolean

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

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

◆ setSessionSettings()

ilSetup::setSessionSettings (   $session_settings)

saves session settings to db

Parameters
array$session_settings

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

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

2028  {
2029  require_once('Services/Authentication/classes/class.ilSessionControl.php');
2030 
2031  $db = $this->client->getDB();
2032 
2033  $setting_fields = ilSessionControl::getSettingFields();
2034 
2035  $i = 0;
2036  foreach($setting_fields as $field)
2037  {
2038  if( isset($session_settings[$field]) )
2039  {
2040  $query = "SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
2041  $res = $db->queryF($query,
2042  array('text', 'text'), array('common', $field));
2043 
2044  $row = array();
2045  while($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) break;
2046 
2047  if( count($row) > 0 )
2048  {
2049  $db->update(
2050  'settings',
2051  array(
2052  'value' => array('text', $session_settings[$field])
2053  ),
2054  array(
2055  'module' => array('text', 'common'),
2056  'keyword' => array('text', $field)
2057  )
2058  );
2059  }
2060  else
2061  {
2062  $db->insert(
2063  'settings',
2064  array(
2065  'module' => array('text', 'common'),
2066  'keyword' => array('text', $field),
2067  'value' => array('text', $session_settings[$field])
2068  )
2069  );
2070  }
2071 
2072  $i++;
2073  }
2074  }
2075 
2076  if($i < 4) $message = $this->lng->txt("session_settings_not_saved");
2077  else $message = $this->lng->txt("settings_saved");
2078 
2079  ilUtil::sendInfo($message);
2080  }
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 1704 of file class.ilSetup.php.

Referenced by checkToolsSetup().

1705  {
1706  if (trim($a_convert_path) == "")
1707  {
1708  return "no_path_convert";
1709  }
1710  if (!is_file($a_convert_path))
1711  {
1712  return "check_failed_convert";
1713  }
1714 
1715  return "";
1716 
1717  }
+ 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 1725 of file class.ilSetup.php.

Referenced by checkToolsSetup().

1726  {
1727  // ghostscript is optional, so empty path is ok
1728  if (trim($a_ghostscript_path) == "")
1729  {
1730  return "";
1731  }
1732  if (!is_file($a_ghostscript_path))
1733  {
1734  return "check_failed_ghostscript";
1735  }
1736 
1737  return "";
1738  }
+ 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 1901 of file class.ilSetup.php.

References $html, and ILIAS_ABSOLUTE_PATH.

Referenced by checkToolsSetup().

1902  {
1903  // java is optional, so empty path is ok
1904  if (trim($a_htmldoc_path) == "")
1905  {
1906  return "";
1907  }
1908 
1909  if (!is_file($a_htmldoc_path))
1910  {
1911  return "check_failed_htmldoc";
1912  }
1913 
1914  return "";
1915 
1916 
1917  $curDir = getcwd();
1918 
1919  chdir(ILIAS_ABSOLUTE_PATH);
1920 
1921  $html = "<html><head><title></title></head><body><p>test</p></body></html>";
1922 
1923  $html_file = "htmldoc_test_file.html";
1924 
1925  $fp = fopen( $html_file ,"wb");
1926  fwrite($fp, $html);
1927  fclose($fp);
1928 
1929  $htmldoc = $a_htmldoc_path." ";
1930  $htmldoc .= "--no-toc ";
1931  $htmldoc .= "--no-jpeg ";
1932  $htmldoc .= "--webpage ";
1933  $htmldoc .= "--outfile htmldoc_test_file.pdf ";
1934  $htmldoc .= "--bodyfont Arial ";
1935  $htmldoc .= "--charset iso-8859-15 ";
1936  $htmldoc .= "--color ";
1937  $htmldoc .= "--size A4 "; // --landscape
1938  $htmldoc .= "--format pdf ";
1939  $htmldoc .= "--footer ... ";
1940  $htmldoc .= "--header ... ";
1941  $htmldoc .= "--left 60 ";
1942  // $htmldoc .= "--right 200 ";
1943  $htmldoc .= $html_file;
1944  exec($htmldoc);
1945 
1946  unlink(ILIAS_ABSOLUTE_PATH."/".$html_file);
1947 
1948  chdir($curDir);
1949 
1950  if (file_exists(ILIAS_ABSOLUTE_PATH."/htmldoc_test_file.pdf"))
1951  {
1952  unlink(ILIAS_ABSOLUTE_PATH."/htmldoc_test_file.pdf");
1953  return true;
1954  }
1955  else
1956  {
1957  return false;
1958  }
1959  }
const ILIAS_ABSOLUTE_PATH
$html
Definition: example_001.php:87
+ 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 1746 of file class.ilSetup.php.

Referenced by checkToolsSetup().

1747  {
1748  // java is optional, so empty path is ok
1749  if (trim($a_java_path) == "")
1750  {
1751  return "";
1752  }
1753 
1754  if (!is_file($a_java_path))
1755  {
1756  return "check_failed_java";
1757  }
1758 
1759  return "";
1760 /*
1761  exec($a_java_path, $out, $back);
1762 
1763  unset($out);
1764 
1765  return ($back != 1) ? false : true;
1766 */
1767  }
+ 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 1775 of file class.ilSetup.php.

References $result, and ilUtil\stripSlashes().

Referenced by checkToolsSetup().

1776  {
1777  // latex is optional, so empty path is ok
1778  if (trim($a_latex_url) == "")
1779  {
1780  return "";
1781  }
1782 
1783  // open the URL
1784  include_once "./setup/classes/class.ilHttpRequest.php";
1785  $http = new ilHttpRequest(ilUtil::stripSlashes($a_latex_url) . "?x_0");
1786  $result = @$http->downloadToString();
1787  if ((strpos((substr($result, 0, 5)), "PNG") !== FALSE) || (strpos((substr($result, 0, 5)), "GIF") !== FALSE))
1788  {
1789  return "";
1790  }
1791  else
1792  {
1793  return "check_failed_latex";;
1794  }
1795  }
$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 1856 of file class.ilSetup.php.

Referenced by checkToolsSetup().

1857  {
1858  if (trim($a_unzip_path) == "")
1859  {
1860  return "no_path_unzip";
1861  }
1862  if (!is_file($a_unzip_path))
1863  {
1864  return "check_failed_unzip";
1865  }
1866 
1867  return "";
1868 /*
1869  $curDir = getcwd();
1870 
1871  chdir(ILIAS_ABSOLUTE_PATH);
1872 
1873  if (file_exists(ILIAS_ABSOLUTE_PATH."/unzip_test_file.zip"))
1874  {
1875  $unzipCmd = $a_unzip_path." unzip_test_file.zip";
1876  exec($unzipCmd);
1877  }
1878 
1879  chdir($curDir);
1880 
1881  // check wether unzip extracted the test file or not
1882  if (file_exists(ILIAS_ABSOLUTE_PATH."/unzip_test_file.txt"))
1883  {
1884  unlink(ILIAS_ABSOLUTE_PATH."/unzip_test_file.txt");
1885 
1886  return true;
1887  }
1888  else
1889  {
1890  return false;
1891  }
1892 */
1893  }
+ 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 1803 of file class.ilSetup.php.

Referenced by checkToolsSetup().

1804  {
1805  if (trim($a_zip_path) == "")
1806  {
1807  return "no_path_zip";
1808  }
1809  if (!is_file($a_zip_path))
1810  {
1811  return "check_failed_zip";
1812  }
1813 
1814  return "";
1815 /*
1816  // create test file and run zip
1817  $fp = fopen(ILIAS_ABSOLUTE_PATH."/test.dat", "w");
1818 
1819  fwrite($fp, "test");
1820  fclose($fp);
1821 
1822  if (file_exists(ILIAS_ABSOLUTE_PATH."/test.dat"))
1823  {
1824  $curDir = getcwd();
1825  chdir(ILIAS_ABSOLUTE_PATH);
1826 
1827  $zipCmd = $a_zip_path." -m zip_test_file.zip test.dat";
1828 
1829  exec($zipCmd);
1830 
1831  chdir($curDir);
1832 
1833  }
1834 
1835  // check wether zip generated test file or not
1836  if (file_exists(ILIAS_ABSOLUTE_PATH."/zip_test_file.zip"))
1837  {
1838  unlink(ILIAS_ABSOLUTE_PATH."/zip_test_file.zip");
1839  return true;
1840  }
1841  else
1842  {
1843  unlink(ILIAS_ABSOLUTE_PATH."/test.dat");
1844  return false;
1845  }
1846 */
1847  }
+ 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 1968 of file class.ilSetup.php.

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

1969  {
1970  //global $ilias;
1971 
1972  $pathinfo = pathinfo($a_file);
1973  $dir = $pathinfo["dirname"];
1974  $file = $pathinfo["basename"];
1975 
1976  // unzip
1977  $cdir = getcwd();
1978  chdir($dir);
1979  $unzip = $this->ini->readVariable("tools","unzip");
1980  $unzipcmd = $unzip." -Z -1 ".ilUtil::escapeShellArg($file);
1981  exec($unzipcmd, $arr);
1982  $zdirs = array();
1983 
1984  foreach($arr as $line)
1985  {
1986  if(is_int(strpos($line, "/")))
1987  {
1988  $zdir = substr($line, 0, strrpos($line, "/"));
1989  $nr = substr_count($zdir, "/");
1990  //echo $zdir." ".$nr."<br>";
1991  while ($zdir != "")
1992  {
1993  $nr = substr_count($zdir, "/");
1994  $zdirs[$zdir] = $nr; // collect directories
1995  //echo $dir." ".$nr."<br>";
1996  $zdir = substr($zdir, 0, strrpos($zdir, "/"));
1997  }
1998  }
1999  }
2000 
2001  asort($zdirs);
2002 
2003  foreach($zdirs as $zdir => $nr) // create directories
2004  {
2005  ilUtil::createDirectory($zdir);
2006  }
2007 
2008  // real unzip
2009  if ($overvwrite)
2010  {
2011  $unzipcmd = $unzip." ".ilUtil::escapeShellArg($file);
2012  }
2013  else
2014  {
2015  $unzipcmd = $unzip." -o ".ilUtil::escapeShellArg($file);
2016  }
2017  exec($unzipcmd);
2018 
2019  chdir($cdir);
2020  }
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 1330 of file class.ilSetup.php.

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

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

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

195  {
196  return true;
197  //var_dump("<pre>",$this->client,"</pre>");exit;
198 
199  if ($a_old_client_id != $this->client->getId())
200  {
201  // check for existing client dir
202  if (file_exists(ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR."/".$this->client->getId()))
203  {
204  $this->raiseError($this->lng->txt("client_id_already_exists"),$this->error_obj->MESSAGE);
205  }
206 
207  if (!$this->saveNewClient())
208  {
209  $this->raiseError($this->lng->txt("save_error"),$this->error_obj->MESSAGE);
210  }
211 
212  ilUtil::delDir(ILIAS_ABSOLUTE_PATH."/".ILIAS_WEB_DIR."/".$a_old_client_id);
213  ilUtil::delDir(ILIAS_DATA_DIR."/".$a_old_client_id);
214  }
215 
216  //everything okay
217  $this->ini_client_exists = true;
218 
219  return true;
220  }
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: