ILIAS  release_4-4 Revision
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)
 Set Client. More...
 
 getClient ()
 Get Client. More...
 
 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)
 
- 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 = "http://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
 
- 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()
 

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

1607  {
1608  //if ($this->ini->readVariable("db","type") != "")
1609  //{
1610  // $this->db->disconnect();
1611  //}
1612  return true;
1613  }

◆ checkAccess()

ilSetup::checkAccess ( $client)

check client access status

Parameters
objectclient
Returns
boolean

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

References $client.

Referenced by getStatus().

887  {
888  if ($client->ini->readVariable("client","access") == "1")
889  {
890  $arr["status"] = true;
891  $arr["comment"] = $this->lng->txt("online");
892  }
893  else
894  {
895  $arr["status"] = false;
896  $arr["comment"] = $this->lng->txt("disabled");
897  }
898 
899  return $arr;
900  }
+ Here is the caller graph for this function:

◆ checkAuth()

ilSetup::checkAuth ( )

check authentication status

Returns
boolean

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

References $_SESSION.

Referenced by ilSetup().

515  {
516  if ($_SESSION["auth"] === true && $_SESSION["auth_path"] == ILIAS_HTTP_PATH)
517  {
518  return true;
519  }
520 
521  return false;
522  }
< 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 1101 of file class.ilSetup.php.

References $client, and ilUtil\is_email().

Referenced by getStatus().

1102  {
1103  $arr["status"] = true;
1104  //$arr["comment"] = $this->lng->txt("filled_out");
1105 
1106  $settings = $client->getAllSettings();
1107  $client_name = $client->getName();
1108 
1109  // check required fields
1110  if (empty($settings["admin_firstname"]) or empty($settings["admin_lastname"]) or
1111  empty($settings["admin_email"]) or empty($client_name))
1112  {
1113  $arr["status"] = false;
1114  $arr["comment"] = $this->lng->txt("missing_data");
1115  }
1116 
1117  // admin email
1118  if (!ilUtil::is_email($settings["admin_email"]) and $arr["status"] != false)
1119  {
1120  $arr["status"] = false;
1121  $arr["comment"] = $this->lng->txt("email_not_valid");
1122  }
1123 
1124  return $arr;
1125  }
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 926 of file class.ilSetup.php.

References $client.

Referenced by getStatus().

927  {
928  if (!$arr["status"] = $client->db_exists)
929  {
930  $arr["comment"] = $this->lng->txt("no_database");
931  return $arr;
932  }
933 
934  if (!$arr["status"] = $client->db_installed)
935  {
936  $arr["comment"] = $this->lng->txt("db_not_installed");
937  return $arr;
938  }
939 
940  // TODO: move this to client class!!
941  $client->setup_ok = (bool) $client->getSetting("setup_ok");
942 
943  //$this->lng->setDbHandler($client->db);
944  include_once "./Services/Database/classes/class.ilDBUpdate.php";
945  $ilDB = $client->db;
946  $this->lng->setDbHandler($client->db);
947  $dbupdate = new ilDBUpdate($client->db);
948 
949  if (!$arr["status"] = $dbupdate->getDBVersionStatus())
950  {
951  $arr["comment"] = $this->lng->txt("db_needs_update");
952  $arr["update"] = true;
953  return $arr;
954  }
955  else if ($dbupdate->hotfixAvailable())
956  {
957  $arr["status"] = false;
958  $arr["comment"] = $this->lng->txt("hotfix_available");
959  $arr["update"] = true;
960  return $arr;
961  }
962  else if ($dbupdate->customUpdatesAvailable())
963  {
964  $arr["status"] = false;
965  $arr["comment"] = $this->lng->txt("custom_updates_available");
966  $arr["update"] = true;
967  return $arr;
968  }
969 
970  // check control information
971 
972  $cset = $ilDB->query("SELECT count(*) as cnt FROM ctrl_calls");
973  $crec = $ilDB->fetchAssoc($cset);
974  if ($crec["cnt"] == 0)
975  {
976  $arr["status"] = false;
977  $arr["comment"] = $this->lng->txt("db_control_structure_missing");
978  $arr["update"] = true;
979  return $arr;
980  }
981 
982  //$arr["comment"] = "version ".$dbupdate->getCurrentVersion();
983  return $arr;
984  }
Database Update class.
+ Here is the caller graph for this function:

◆ checkClientIni()

ilSetup::checkClientIni ( $client)

check client ini status

Parameters
objectclient
Returns
boolean

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

References $client.

Referenced by getStatus().

908  {
909  if (!$arr["status"] = $client->init())
910  {
911  $arr["comment"] = $client->getError();
912  }
913  else
914  {
915  //$arr["comment"] = "dir: /".ILIAS_WEB_DIR."/".$client->getId();
916  }
917 
918  return $arr;
919  }
+ Here is the caller graph for this function:

◆ checkClientLanguages()

ilSetup::checkClientLanguages ( $client)

check client installed languages status

Parameters
objectclient
Returns
boolean

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

Referenced by getStatus().

1077  {
1078  $installed_langs = $this->lng->getInstalledLanguages();
1079 
1080  $count = count($installed_langs);
1081 
1082  if ($count < 1)
1083  {
1084  $arr["status"] = false;
1085  $arr["comment"] = $this->lng->txt("lang_none_installed");
1086  }
1087  else
1088  {
1089  $arr["status"] = true;
1090  //$arr["comment"] = $count." ".$this->lng->txt("languages_installed");
1091  }
1092 
1093  return $arr;
1094  }
+ Here is the caller graph for this function:

◆ checkClientNIC()

ilSetup::checkClientNIC ( $client)

check client nic status

Parameters
objectclient
Returns
boolean

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

References $client.

Referenced by getStatus().

1133  {
1134  $settings = $client->getAllSettings();
1135 
1136  if (!isset($settings["nic_enabled"]))
1137  {
1138  $arr["status"] = false;
1139  $arr["comment"] = $this->lng->txt("nic_not_disabled");
1140  return $arr;
1141  }
1142 
1143  $arr["status"] = true;
1144 
1145  if ($settings["nic_enabled"] == "-1")
1146  {
1147  $arr["comment"] = $this->lng->txt("nic_reg_failed");
1148  return $arr;
1149  }
1150 
1151  if (!$settings["nic_enabled"])
1152  {
1153  $arr["comment"] = $this->lng->txt("nic_reg_disabled");
1154  }
1155  else
1156  {
1157  $arr["comment"] = $this->lng->txt("nic_reg_enabled");
1158  if ($settings["inst_id"] <= 0)
1159  {
1160  $arr["status"] = false;
1161  }
1162  }
1163 
1164  return $arr;
1165  }
+ Here is the caller graph for this function:

◆ checkClientProxySettings()

ilSetup::checkClientProxySettings ( $client)

check client session config status

Parameters
objectclient

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

References $query, $res, and $row.

Referenced by getStatus().

1032  {
1033  global $ilDB;
1034  $db = $ilDB;
1035 
1036  $fields = array('proxy_status','proxy_host','proxy_port');
1037 
1038  $query = "SELECT keyword, value FROM settings WHERE ".$db->in('keyword', $fields, false, 'text');
1039  $res = $db->query($query);
1040 
1041  $proxy_settings = array();
1042  $already_saved = false;
1043  while($row = $db->fetchAssoc($res))
1044  {
1045  $already_saved = true;
1046  $proxy_settings[$row['keyword']] = $row['value'];
1047  }
1048 
1049  if(!$already_saved)
1050  {
1051  $arr["status"] = false;
1052  $arr["comment"] = $this->lng->txt("proxy");
1053  $arr["text"] = $this->lng->txt("proxy");
1054  }
1055  else if((bool)$proxy_settings["proxy_status"] == false)
1056  {
1057  $arr["status"] = true;
1058  $arr["comment"] = $this->lng->txt("proxy_disabled");
1059  $arr["text"] = $this->lng->txt("proxy_disabled");
1060  }
1061  else
1062  {
1063  $arr["status"] = true;
1064  $arr["comment"] = $this->lng->txt("proxy_activated_configurated");
1065  $arr["text"] = $this->lng->txt("proxy_activated_configurated");
1066 
1067  }
1068  return $arr;
1069  }
+ 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 991 of file class.ilSetup.php.

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

992  {
993  require_once('Services/Authentication/classes/class.ilSessionControl.php');
994 
995  global $ilDB;
996  $db = $ilDB;
997 
999 
1000  $query = "SELECT keyword, value FROM settings WHERE ".$db->in('keyword', $fields, false, 'text');
1001  $res = $db->query($query);
1002 
1003  $rows = array();
1004  while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
1005  {
1006  if( $row['value'] != '' )
1007  $rows[] = $row;
1008  else break;
1009  }
1010 
1011  if (count($rows) != count($fields))
1012  {
1013  if($a_as_bool) return false;
1014  $arr["status"] = false;
1015  $arr["comment"] = $this->lng->txt("session_management_not_configured");
1016  }
1017  else
1018  {
1019  if($a_as_bool) return true;
1020  $arr["status"] = true;
1021  $arr["comment"] = $this->lng->txt("session_management_configured");
1022  }
1023 
1024  return $arr;
1025  }
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:

◆ checkCookiesEnabled()

ilSetup::checkCookiesEnabled ( )

check cookies enabled

Returns
array

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

References $sess.

Referenced by queryPreliminaries().

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

Referenced by queryPreliminaries().

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

◆ checkDataDirSetup()

ilSetup::checkDataDirSetup (   $a_formdata)

check datadir path

Parameters
arrayform data
Returns
boolean

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

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

1484  {
1485  // remove trailing slash & convert backslashes to forwardslashes
1486  $datadir_path = preg_replace("/\\\\/","/",ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["datadir_path"])));
1487 
1488  if (empty($datadir_path))
1489  {
1490  $this->error = "no_path_datadir";
1491  return false;
1492  }
1493 
1494  $webspace_dir = ILIAS_ABSOLUTE_PATH . "/data";
1495 
1496  // datadir may not point to webspace dir or to any place under webspace_dir
1497  if (strpos($datadir_path,$webspace_dir) !== false)
1498  {
1499  $this->error = "datadir_webspacedir_match";
1500  return false;
1501  }
1502 
1503  // create dir
1504  if ($a_formdata["chk_datadir_path"] == 1)
1505  {
1506  $dir_to_create = substr(strrchr($datadir_path, "/"), 1);
1507  $dir_to_check = substr($datadir_path,0,- strlen($dir_to_create)-1);
1508 
1509  if (is_writable($datadir_path))
1510  {
1511  $this->error = "dir_exists_create";
1512  return false;
1513  }
1514 
1515  if (!is_writable($dir_to_check))
1516  {
1517  $this->error = "cannot_create_datadir_no_write_access";
1518  return false;
1519  }
1520  }
1521  else // check set target dir
1522  {
1523  if (!is_writable($datadir_path))
1524  {
1525  $this->error = "cannot_create_datadir_no_write_access";
1526  return false;
1527  }
1528  }
1529 
1530  return true;
1531  }
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 529 of file class.ilSetup.php.

Referenced by queryPreliminaries().

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

References $client.

Referenced by getStatus().

866  {
867  if ($client->getSetting("setup_ok"))
868  {
869  $arr["status"] = true;
870  //$arr["comment"] = $this->lng->txt("setup_finished");
871  }
872  else
873  {
874  $arr["status"] = false;
875  $arr["comment"] = $this->lng->txt("setup_not_finished");
876  }
877 
878  return $arr;
879  }
+ Here is the caller graph for this function:

◆ checkGd()

ilSetup::checkGd ( )

Check MySQL.

Returns
boolean

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

Referenced by queryPreliminaries().

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

◆ checkIniFileExists()

ilSetup::checkIniFileExists ( )

check if inifile exists

Returns
boolean

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

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

◆ checkLogSetup()

ilSetup::checkLogSetup (   $a_formdata)

check log path

Parameters
arrayform data
Returns
boolean

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

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

1561  {
1562  // log path
1563  if (!$a_formdata["chk_log_status"])
1564  {
1565  // remove trailing slash & convert backslashes to forwardslashes
1566  $log_path = preg_replace("/\\\\/","/",ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["log_path"])));
1567 
1568  if (empty($log_path))
1569  {
1570  $this->error = "no_path_log";
1571  return false;
1572  }
1573 
1574  if (!@touch($log_path))
1575  {
1576  $this->error = "could_not_create_logfile";
1577  return false;
1578  }
1579  }
1580 
1581  return true;
1582  }
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 594 of file class.ilSetup.php.

Referenced by queryPreliminaries().

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

◆ checkMySQL()

ilSetup::checkMySQL ( )

Check MySQL.

Returns
boolean

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

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

◆ checkPasswordSetup()

ilSetup::checkPasswordSetup (   $a_formdata)

check setup password

Parameters
arrayform data
Returns
boolean

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

1539  {
1540  if (!$a_formdata["setup_pass"])
1541  {
1542  $this->error = "no_setup_pass_given";
1543  return false;
1544  }
1545 
1546  if ($a_formdata["setup_pass"] != $a_formdata["setup_pass2"])
1547  {
1548  $this->error = "pass_does_not_match";
1549  return false;
1550  }
1551 
1552  return true;
1553  }

◆ checkPHPVersion()

ilSetup::checkPHPVersion ( )

check for PHP version

Returns
array

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

Referenced by queryPreliminaries().

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

◆ checkPreliminaries()

ilSetup::checkPreliminaries ( )

check all prliminaries

Returns
boolean

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

References queryPreliminaries().

652  {
653  $this->preliminaries_result = $this->queryPreliminaries();
654 
655  foreach ($this->preliminaries_result as $val)
656  {
657  if ($val["status"] === false)
658  {
659  $this->preliminaries = false;
660  return false;
661  }
662  }
663 
664  return true;
665  }
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 1319 of file class.ilSetup.php.

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

1320  {
1321  // convert path
1322  if (!isset($a_formdata["chk_convert_path"]))
1323  {
1324  // convert backslashes to forwardslashes
1325  $convert_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["convert_path"]));
1326 
1327  if (($err = $this->testConvert($convert_path)) != "")
1328  {
1329  $this->error = $err;
1330  return false;
1331  }
1332  }
1333 
1334  // zip path
1335  if (!isset($a_formdata["chk_zip_path"]))
1336  {
1337  // convert backslashes to forwardslashes
1338  $zip_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["zip_path"]));
1339 
1340  if (empty($zip_path))
1341  {
1342  $this->error = "no_path_zip";
1343  return false;
1344  }
1345 
1346  if (!$this->testZip($zip_path))
1347  {
1348  $this->error = "check_failed_zip";
1349  return false;
1350  }
1351  }
1352 
1353  // unzip path
1354  if (!isset($a_formdata["chk_unzip_path"]))
1355  {
1356  // convert backslashes to forwardslashes
1357  $unzip_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["unzip_path"]));
1358 
1359  if (empty($unzip_path))
1360  {
1361  $this->error = "no_path_unzip";
1362  return false;
1363  }
1364 
1365  if (!$this->testUnzip($unzip_path))
1366  {
1367  $this->error = "check_failed_unzip";
1368  return false;
1369  }
1370  }
1371 
1372  // ghostscript path
1373  if (!isset($a_formdata["chk_ghostscript_path"]))
1374  {
1375  // convert backslashes to forwardslashes
1376  $ghostscript_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["ghostscript_path"]));
1377 
1378  if (($err = $this->testGhostscript($ghostscript_path)) != "")
1379  {
1380  $this->error = $err;
1381  return false;
1382  }
1383  }
1384 
1385  // java path
1386  if (!isset($a_formdata["chk_java_path"]))
1387  {
1388  // convert backslashes to forwardslashes
1389  $java_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["java_path"]));
1390 
1391  if (empty($java_path))
1392  {
1393  $this->error = "no_path_java";
1394  return false;
1395  }
1396 
1397  if (!$this->testJava($java_path))
1398  {
1399  $this->error = "check_failed_java";
1400  return false;
1401  }
1402  }
1403 
1404  // htmldoc path
1405  if (!isset($a_formdata["chk_htmldoc_path"]))
1406  {
1407  // convert backslashes to forwardslashes
1408  $htmldoc_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["htmldoc_path"]));
1409 
1410  if (empty($htmldoc_path))
1411  {
1412  $this->error = "no_path_htmldoc";
1413  return false;
1414  }
1415 
1416  if (!$this->testHtmldoc($htmldoc_path))
1417  {
1418  $this->error = "check_failed_htmldoc";
1419  return false;
1420  }
1421  }
1422  /*if (!isset($a_formdata["chk_mkisofs_path"]))
1423  {
1424  // convert backslashes to forwardslashes
1425  $mkisofs_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["mkisofs_path"]));
1426 
1427  if (empty($mkisofs_path))
1428  {
1429  $this->error = "no_path_mkisofs";
1430  return false;
1431  }
1432 
1433  if (!$this->testHtmldoc($mkisofs_path))
1434  {
1435  $this->error = "check_failed_mkisofs";
1436  return false;
1437  }
1438  }*/
1439 
1440  if (!isset($a_formdata["chk_ffmpeg_path"]))
1441  {
1442  // convert backslashes to forwardslashes
1443  $ffmpeg_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["ffmpeg_path"]));
1444 
1445  if (empty($ffmpeg_path))
1446  {
1447  $this->error = "no_path_ffmpeg";
1448  return false;
1449  }
1450 
1451  if (!$this->testFFMpeg($ffmpeg_path))
1452  {
1453  $this->error = "check_failed_ffmpeg";
1454  return false;
1455  }
1456  }
1457 
1458  // latex url
1459  if (!isset($a_formdata["chk_latex_url"]))
1460  {
1461  $latex_url = ilUtil::stripSlashes($a_formdata["latex_url"]);
1462  if (empty($latex_url))
1463  {
1464  $this->error = "no_latex_url";
1465  return false;
1466  }
1467 
1468  if (!$this->testLatex($latex_url))
1469  {
1470  $this->error = "check_failed_latex";
1471  return false;
1472  }
1473  }
1474 
1475  return true;
1476  }
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 396 of file class.ilSetup.php.

Referenced by queryPreliminaries().

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

◆ checkXsl()

ilSetup::checkXsl ( )

Check MySQL.

Returns
boolean

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

Referenced by queryPreliminaries().

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

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

2090  {
2091  // Getting source and targets
2092  $source = new ilClient($source_id, $this->db_connections);
2093  $source->init();
2094  $target = $this->client;
2095 
2096  // ************************************************
2097  // ** COPY FILES
2098 
2099  // Cleaning up datadir
2100  if (! ilUtil::delDir($target->getDataDir())) {
2101  $this->error = "Could not delete data dir $target->getDataDir()";
2102  //return false;
2103  }
2104 
2105  // Create empty datadir
2106  if (!ilUtil::makeDir($target->getDataDir()))
2107  {
2108  $this->error = "could_not_create_base_data_dir :".$target->getDataDir();
2109  return false;
2110  }
2111 
2112  // Copying datadir
2113  if (! ilUtil::rCopy($source->getDataDir(),$target->getDataDir())) {
2114  $this->error = "clone_datadircopyfail";
2115  $target->ini->write();
2116  return false;
2117  }
2118 
2119  // Cleaning up Webspacedir
2120  if (! ilUtil::delDir($target->getWebspaceDir())) {
2121  $this->error = "Could not delete webspace dir $target->getWebspaceDir()";
2122  //return false;
2123  }
2124 
2125  // Create empty Webspacedir
2126  if (!ilUtil::makeDir($target->getWebspaceDir()))
2127  {
2128  $this->error = "could_not_create_base_webspace_dir :".$target->getWebspaceDir();
2129  return false;
2130  }
2131 
2132  // Copying Webspacedir
2133  if (! ilUtil::rCopy($source->getWebspaceDir(),$target->getWebspaceDir())) {
2134  $this->error = "clone_websipacedircopyfail";
2135  $target->ini->write();
2136  return false;
2137  }
2138 
2139  // Restore ini file
2140  $target->ini->write();
2141 
2142  // ************************************************
2143  // ** COPY DATABASE
2144 
2145  $source->connect();
2146  if (!$source->db)
2147  {
2148  $this->error = "Source database connection failed.";
2149  return false;
2150  }
2151 
2152  $target->connect();
2153  if (!$target->db)
2154  {
2155  $this->error = "Target database connection failed.";
2156  return false;
2157  }
2158 
2159  $source->connect();
2160  $srcTables = $source->db->query("SHOW TABLES");
2161  $target->connect();
2162 
2163  // drop all tables of the target db
2164  $tarTables = $target->db->query("SHOW TABLES");
2165  foreach($tarTables->fetchAll() as $cTable)
2166  {
2167  $target->db->query("DROP TABLE IF EXISTS " . $cTable[0]);
2168  }
2169 
2170  foreach($srcTables->fetchAll() as $cTable){
2171  $drop = $target->db->query("DROP TABLE IF EXISTS " . $cTable[0]);
2172  $create = $target->db->query("CREATE TABLE " . $cTable[0] . " LIKE " . $source->getDbName() . "." . $cTable[0]);
2173  if(!$create) {
2174  $error = true;
2175  }
2176  $insert = $target->db->query("INSERT INTO " . $cTable[0] . " SELECT * FROM ".$source->getDbName().".".$cTable[0]);
2177  }
2178  return true;
2179  }
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 222 of file class.ilSetup.php.

References $r, and MDB2\isError().

223  {
224  if ($this->client->checkDatabaseExists())
225  {
226  $this->error = $this->lng->txt("database_exists");
227  return false;
228  }
229 
230  $this->client->getDB()->connectHost(true);
231 
232  //create database
233  $db = $this->client->getDB();
234  if (MDB2::isError($db))
235  {
236  $this->error = "connection_failed";
237  return false;
238  }
239 
240  $r = $db->createDatabase($this->client->getdbName(),
241  "utf8", $a_collation);
242 
243  if (MDB2::isError($r))
244  {
245  $this->error = "create_database_failed";
246  return false;
247  }
248 
249  //database is created, now disconnect and reconnect
250  $db->disconnect();
251 
252  $this->client->db_exists = true;
253  return true;
254  }
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 ( )

Get Client.

Returns
object client

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

References $client.

133  {
134  return $this->client;
135  }

◆ getError()

ilSetup::getError ( )

get Error message

Returns
string error message

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

References $error.

1589  {
1590  if (empty($this->error))
1591  {
1592  return false;
1593  }
1594 
1595  $error = $this->error;
1596  $this->error = "";
1597 
1598  return $error;
1599  }

◆ getline()

ilSetup::getline (   $fp,
  $delim 
)

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

References $result.

Referenced by readDump().

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

◆ getPassword()

ilSetup::getPassword ( )

get setup master password

Returns
string

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

672  {
673  return $this->ini->readVariable("setup","pass");
674  }

◆ getSessionSettings()

ilSetup::getSessionSettings ( )

reads session settings from db

Returns
array session_settings

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

2025  {
2026  require_once('Services/Authentication/classes/class.ilSessionControl.php');
2027 
2028  $db = $this->client->getDB();
2029 
2030  $setting_fields = ilSessionControl::getSettingFields();
2031 
2032  $query = "SELECT * FROM settings WHERE module = %s " .
2033  "AND ".$db->in('keyword', $setting_fields, false, 'text');
2034 
2035  $res = $db->queryF($query, array('text'), array('common'));
2036 
2037  $session_settings = array();
2038  while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
2039  {
2040  $session_settings[$row['keyword']] = $row['value'];
2041  }
2042 
2043  foreach( $setting_fields as $field )
2044  {
2045  if( !isset($session_settings[$field]) )
2046  {
2047  $value = 1;
2048 
2049  switch($field)
2050  {
2051  case 'session_max_count':
2052 
2054  break;
2055 
2056  case 'session_min_idle':
2057 
2059  break;
2060 
2061  case 'session_max_idle':
2062 
2064  break;
2065 
2066  case 'session_max_idle_after_first_request':
2067 
2069  break;
2070 
2071  case 'session_allow_client_maintenance':
2072 
2074  break;
2075  }
2076 
2077  $session_settings[$field] = $value;
2078  }
2079  }
2080 
2081  return $session_settings;
2082  }
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 813 of file class.ilSetup.php.

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

814  {
815  if (!is_object($client))
816  {
817  if ($this->ini_client_exists)
818  {
820  }
821  else
822  {
823  $client = new ilClient(0, $this->db_connections);
824  }
825  }
826 
827  $status = array();
828  $status["ini"] = $this->checkClientIni($client); // check this one
829  $status["db"] = $this->checkClientDatabase($client);
830  if ($status["db"]["status"] === false and $status["db"]["update"] !== true)
831  {
832  //$status["sess"]["status"] = false;
833  //$status["sess"]["comment"] = $status["db"]["comment"];
834  $status["lang"]["status"] = false;
835  $status["lang"]["comment"] = $status["db"]["comment"];
836  $status["contact"]["status"] = false;
837  $status["contact"]["comment"] = $status["db"]["comment"];
838 
839  $status["proxy"]["status"] = false;
840  $status["proxy"]["comment"] = $status["db"]["comment"];
841 
842  $status["nic"]["status"] = false;
843  $status["nic"]["comment"] = $status["db"]["comment"];
844  }
845  else
846  {
847  //$status["sess"] = $this->checkClientSessionSettings($client);
848  $status["lang"] = $this->checkClientLanguages($client);
849  $status["contact"] = $this->checkClientContact($client);
850  $status["proxy"] = $this->checkClientProxySettings($client);
851  $status["nic"] = $this->checkClientNIC($client);
852  $status["finish"] = $this->checkFinish($client);
853  $status["access"] = $this->checkAccess($client);
854  }
855 
856  //return value
857  return $status;
858  }
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:

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

Referenced by ilSetup().

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

◆ installDatabase()

ilSetup::installDatabase ( )

set the database data

Returns
boolean

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

References readDump().

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

1190  {
1191  return ($this->access_mode == "admin") ? true : false;
1192  }

◆ isAuthenticated()

ilSetup::isAuthenticated ( )

check if current user is authenticated

Returns
boolean

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

References $auth.

1181  {
1182  return $this->auth;
1183  }

◆ isInstalled()

ilSetup::isInstalled ( )

check if client's db is installed

Returns
boolean

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

References $ini_ilias_exists.

Referenced by newClient().

1172  {
1173  return $this->ini_ilias_exists;
1174  }
+ Here is the caller graph for this function:

◆ loginAsAdmin()

ilSetup::loginAsAdmin (   $a_password)

process setup admin login

Parameters
stringpassword
Returns
boolean

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

References $_SESSION.

767  {
768  $a_password = md5($a_password);
769 
770  if ($this->ini->readVariable("setup","pass") == $a_password)
771  {
772  $_SESSION["auth"] = true;
773  $_SESSION["auth_path"] = ILIAS_HTTP_PATH;
774  $_SESSION["access_mode"] = "admin";
775  return true;
776  }
777 
778  return false;
779  }
< 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 699 of file class.ilSetup.php.

References $_SESSION, $r, and newClient().

700  {
701  global $ilDB;
702 
703  if (empty($a_auth_data["client_id"]))
704  {
705  $this->error = "no_client_id";
706  return false;
707  }
708 
709  if (empty($a_auth_data["username"]))
710  {
711  $this->error = "no_username";
712  return false;
713  }
714 
715  if (empty($a_auth_data["password"]))
716  {
717  $this->error = "no_password";
718  return false;
719  }
720 
721  if (!$this->newClient($a_auth_data["client_id"]))
722  {
723  $this->error = "unknown_client_id";
724  unset($this->client);
725  return false;
726  }
727 
728  if (!$this->client->db_exists)
729  {
730  $this->error = "no_db_connect_consult_admin";
731  unset($this->client);
732  return false;
733  }
734 
735  $s1 = $this->client->db->query("SELECT value from settings WHERE keyword = ".
736  $this->client->db->quote('system_role_id','text'));
737  $r1 = $this->client->db->fetchAssoc($s1);
738  $system_role_id = $r1["value"];
739  $q = "SELECT usr_data.usr_id FROM usr_data ".
740  "LEFT JOIN rbac_ua ON rbac_ua.usr_id=usr_data.usr_id ".
741  "WHERE rbac_ua.rol_id = ".$this->client->db->quote((int) $system_role_id,'integer')." ".
742  "AND usr_data.login=".$this->client->db->quote($a_auth_data["username"],'text')." ".
743  "AND usr_data.passwd=".$this->client->db->quote(md5($a_auth_data["password"]),'text');
744 
745  $r = $this->client->db->query($q);
746 
747  if (!$r->numRows())
748  {
749  $this->error = "login_invalid";
750  return false;
751  }
752 
753  // all checks passed -> user valid
754  $_SESSION["auth"] = true;
755  $_SESSION["auth_path"] = ILIAS_HTTP_PATH;
756  $_SESSION["access_mode"] = "client";
757  $_SESSION["ClientId"] = $this->client->getId();
758  return true;
759  }
< 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']
newClient($a_client_id=0)
creates a client object in $this->client
$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 786 of file class.ilSetup.php.

References $_SESSION, and isInstalled().

Referenced by loginAsClient().

787  {
788  if (!$this->isInstalled())
789  {
790  return false;
791  }
792 
793  $this->client = new ilClient($a_client_id, $this->db_connections);
794 
795  if (!$this->client->init())
796  {
797 //echo "<br>noclientinit";
798  $this->error = get_class($this).": ".$this->client->getError();
799  $_SESSION["ClientId"] = "";
800  return false;
801  }
802 
803  $_SESSION["ClientId"] = $a_client_id;
804 
805  return true;
806  }
< 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 2187 of file class.ilSetup.php.

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

2188  {
2189  require_once './Services/Http/exceptions/class.ilProxyException.php';
2190  $settings = $client->getAllSettings();
2191 
2192  if((bool)$settings['proxy_status'] == true)
2193  {
2194  try
2195  {
2201  require_once 'Services/PEAR/lib/Net/Socket.php';
2202 
2203  $socket = new Net_Socket();
2204  $socket->setErrorHandling(PEAR_ERROR_RETURN);
2205  $response = $socket->connect($settings['proxy_host'], $settings['proxy_port']);
2206  if(!is_bool($response))
2207  {
2208  global $lng;
2209  throw new ilProxyException(strlen($response) ? $response : $lng->txt('proxy_not_connectable'));
2210  }
2211 
2212  ilUtil::sendSuccess($this->lng->txt('proxy_connectable'));
2213 
2214  }
2215  catch(ilProxyException $e)
2216  {
2217  ilUtil::sendFailure($this->lng->txt('proxy_pear_net_socket_error').': '.$e->getMessage());
2218  }
2219  }
2220 
2221  }
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 631 of file class.ilSetup.php.

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

Referenced by checkPreliminaries().

632  {
633  $a = array();
634  $a["php"] = $this->checkPHPVersion();
635 // $a["mysql"] = $this->checkMySQL();
636  $a["root"] = $this->checkWritable();
637  $a["folder_create"] = $this->checkCreatable();
638  $a["cookies_enabled"] = $this->checkCookiesEnabled();
639  $a["dom"] = $this->checkDom();
640  $a["xsl"] = $this->checkXsl();
641  $a["gd"] = $this->checkGd();
642  $a["memory"] = $this->checkMemoryLimit();
643 
644  return $a;
645  }
checkXsl()
Check MySQL.
checkCreatable($a_dir=".")
check for permission to create new folders in specified directory
checkWritable()
check for writable directory
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 304 of file class.ilSetup.php.

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

Referenced by installDatabase().

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

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

1200  {
1201  $datadir_path = preg_replace("/\\\\/","/",ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["datadir_path"])));
1202 
1203  if ($a_formdata["chk_datadir_path"] == 1) // mode create dir
1204  {
1205  if (!ilUtil::makeDir($datadir_path))
1206  {
1207  $this->error = "create_datadir_failed";
1208  return false;
1209  }
1210  }
1211 
1212  // create webspace dir if it does not exist
1213  if (!@file_exists(ILIAS_ABSOLUTE_PATH."/".$this->ini->readVariable("clients","path")) and !@is_dir(ILIAS_ABSOLUTE_PATH."/".$this->ini->readVariable("clients","path")))
1214  {
1215  if (!ilUtil::makeDir(ILIAS_ABSOLUTE_PATH."/".$this->ini->readVariable("clients","path")))
1216  {
1217  $this->error = "create_webdir_failed";
1218  return false;
1219  }
1220  }
1221 
1222  $form_log_path = preg_replace("/\\\\/","/",ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["log_path"])));
1223  $log_path = substr($form_log_path,0,strrpos($form_log_path,"/"));
1224  $log_file = substr($form_log_path,strlen($log_path)+1);
1225 
1226  $this->ini->setVariable("server","http_path",ILIAS_HTTP_PATH);
1227  $this->ini->setVariable("server","absolute_path",ILIAS_ABSOLUTE_PATH);
1228  $this->ini->setVariable("server","timezone",preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["time_zone"])));
1229  $this->ini->setVariable("clients", "datadir", $datadir_path);
1230  $this->ini->setVariable("tools", "convert", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["convert_path"])));
1231  $this->ini->setVariable("tools", "zip", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["zip_path"])));
1232  $this->ini->setVariable("tools", "unzip", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["unzip_path"])));
1233  $this->ini->setVariable("tools", "ghostscript", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["ghostscript_path"])));
1234  $this->ini->setVariable("tools", "java", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["java_path"])));
1235  $this->ini->setVariable("tools", "htmldoc", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["htmldoc_path"])));
1236  //$this->ini->setVariable("tools", "mkisofs", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["mkisofs_path"])));
1237  $this->ini->setVariable("tools", "ffmpeg", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["ffmpeg_path"])));
1238  $this->ini->setVariable("tools", "latex", ilUtil::stripSlashes($a_formdata["latex_url"]));
1239  $this->ini->setVariable("tools", "vscantype", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["vscanner_type"])));
1240  $this->ini->setVariable("tools", "scancommand", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["scan_command"])));
1241  $this->ini->setVariable("tools", "cleancommand", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["clean_command"])));
1242  $this->ini->setVariable("setup", "pass", md5($a_formdata["setup_pass"]));
1243  $this->ini->setVariable("log", "path", $log_path);
1244  $this->ini->setVariable("log", "file", $log_file);
1245  $this->ini->setVariable("log", "enabled", ($a_formdata["chk_log_status"]) ? "0" : 1);
1246 
1247  if (!$this->ini->write())
1248  {
1249  $this->error = get_class($this).": ".$this->ini->getError();
1250  return false;
1251  }
1252 
1253  // everything is fine. so we authenticate the user and set access mode to 'admin'
1254  $_SESSION["auth"] = true;
1255  $_SESSION["auth_path"] = ILIAS_HTTP_PATH;
1256  $_SESSION["access_mode"] = "admin";
1257 
1258  return true;
1259  }
< 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 167 of file class.ilSetup.php.

References $_SESSION.

Referenced by updateNewClient().

168  {
169  // save client id to session
170  $_SESSION["ClientId"] = $this->client->getId();
171 
172  // create client
173  if (!$this->client->create())
174  {
175  $this->error = $this->client->getError();
176  return false;
177  }
178 
179  //everything okay
180  $this->ini_client_exists = true;
181 
182  return true;
183  }
< 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 2223 of file class.ilSetup.php.

References $query, $res, and $row.

2224  {
2225  $db = $this->client->getDB();
2226  $proxy_fields = array('proxy_status','proxy_host','proxy_port');
2227 
2228  foreach($proxy_fields as $field)
2229  {
2230  if( isset($proxy_settings[$field]) )
2231  {
2232  $query = "SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
2233  $res = $db->queryF($query,
2234  array('text', 'text'), array('common', $field));
2235 
2236  $row = array();
2237  while($row = $db->fetchAssoc($res)) break;
2238 
2239  if( count($row) > 0 )
2240  {
2241  $db->update(
2242  'settings',
2243  array(
2244  'value' => array('text', $proxy_settings[$field])
2245  ),
2246  array(
2247  'module' => array('text', 'common'),
2248  'keyword' => array('text', $field)
2249  )
2250  );
2251  }
2252  else
2253  {
2254  $db->insert(
2255  'settings',
2256  array(
2257  'module' => array('text', 'common'),
2258  'keyword' => array('text', $field),
2259  'value' => array('text', $proxy_settings[$field])
2260  )
2261  );
2262  }
2263  }
2264  }
2265  }

◆ setClient()

ilSetup::setClient (   $a_cl)

Set Client.

Parameters
objectclient

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

123  {
124  $this->client = $a_cl;
125  }

◆ setPassword()

ilSetup::setPassword (   $a_password)

set setup master password

Parameters
stringpassword
Returns
boolean

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

682  {
683  $this->ini->setVariable("setup","pass",md5($a_password));
684 
685  if ($this->ini->write() == false)
686  {
687  $this->error = $this->ini->getError();
688  return false;
689  }
690 
691  return true;
692  }

◆ setSessionSettings()

ilSetup::setSessionSettings (   $session_settings)

saves session settings to db

Parameters
array$session_settings

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

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

1965  {
1966  require_once('Services/Authentication/classes/class.ilSessionControl.php');
1967 
1968  $db = $this->client->getDB();
1969 
1970  $setting_fields = ilSessionControl::getSettingFields();
1971 
1972  $i = 0;
1973  foreach($setting_fields as $field)
1974  {
1975  if( isset($session_settings[$field]) )
1976  {
1977  $query = "SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
1978  $res = $db->queryF($query,
1979  array('text', 'text'), array('common', $field));
1980 
1981  $row = array();
1982  while($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) break;
1983 
1984  if( count($row) > 0 )
1985  {
1986  $db->update(
1987  'settings',
1988  array(
1989  'value' => array('text', $session_settings[$field])
1990  ),
1991  array(
1992  'module' => array('text', 'common'),
1993  'keyword' => array('text', $field)
1994  )
1995  );
1996  }
1997  else
1998  {
1999  $db->insert(
2000  'settings',
2001  array(
2002  'module' => array('text', 'common'),
2003  'keyword' => array('text', $field),
2004  'value' => array('text', $session_settings[$field])
2005  )
2006  );
2007  }
2008 
2009  $i++;
2010  }
2011  }
2012 
2013  if($i < 4) $message = $this->lng->txt("session_settings_not_saved");
2014  else $message = $this->lng->txt("settings_saved");
2015 
2016  ilUtil::sendInfo($message);
2017  }
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 1621 of file class.ilSetup.php.

Referenced by checkToolsSetup().

1622  {
1623  if (trim($a_convert_path) == "")
1624  {
1625  return "no_path_convert";
1626  }
1627  if (!is_file($a_convert_path))
1628  {
1629  return "check_failed_convert";
1630  }
1631 
1632  return "";
1633 
1634 /*
1635  // generate gif with convert
1636  if (file_exists(ILIAS_ABSOLUTE_PATH."/images/test.gif"))
1637  {
1638  unlink(ILIAS_ABSOLUTE_PATH."/images/test.png");
1639  }
1640 
1641  system($a_convert_path." ".ILIAS_ABSOLUTE_PATH."/setup/test/test.jpg GIF:".ILIAS_ABSOLUTE_PATH."/setup/test/test.png");
1642 
1643  // check wether convert generated file
1644  if (file_exists(ILIAS_ABSOLUTE_PATH."/setup/test/test.png"))
1645  {
1646  unlink(ILIAS_ABSOLUTE_PATH."/setup/test/test.png");
1647  return true;
1648  }
1649  else
1650  {
1651  return false;
1652  }
1653 */
1654  }
+ 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 1662 of file class.ilSetup.php.

Referenced by checkToolsSetup().

1663  {
1664  // ghostscript is optional, so empty path is ok
1665  if (trim($a_ghostscript_path) == "")
1666  {
1667  return "";
1668  }
1669  if (!is_file($a_ghostscript_path))
1670  {
1671  return "check_failed_ghostscript";
1672  }
1673 
1674  return "";
1675  }
+ 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 1838 of file class.ilSetup.php.

References ILIAS_ABSOLUTE_PATH.

Referenced by checkToolsSetup().

1839  {
1840  // java is optional, so empty path is ok
1841  if (trim($a_htmldoc_path) == "")
1842  {
1843  return "";
1844  }
1845 
1846  if (!is_file($a_htmldoc_path))
1847  {
1848  return "check_failed_htmldoc";
1849  }
1850 
1851  return "";
1852 
1853 
1854  $curDir = getcwd();
1855 
1856  chdir(ILIAS_ABSOLUTE_PATH);
1857 
1858  $html = "<html><head><title></title></head><body><p>test</p></body></html>";
1859 
1860  $html_file = "htmldoc_test_file.html";
1861 
1862  $fp = fopen( $html_file ,"wb");
1863  fwrite($fp, $html);
1864  fclose($fp);
1865 
1866  $htmldoc = $a_htmldoc_path." ";
1867  $htmldoc .= "--no-toc ";
1868  $htmldoc .= "--no-jpeg ";
1869  $htmldoc .= "--webpage ";
1870  $htmldoc .= "--outfile htmldoc_test_file.pdf ";
1871  $htmldoc .= "--bodyfont Arial ";
1872  $htmldoc .= "--charset iso-8859-15 ";
1873  $htmldoc .= "--color ";
1874  $htmldoc .= "--size A4 "; // --landscape
1875  $htmldoc .= "--format pdf ";
1876  $htmldoc .= "--footer ... ";
1877  $htmldoc .= "--header ... ";
1878  $htmldoc .= "--left 60 ";
1879  // $htmldoc .= "--right 200 ";
1880  $htmldoc .= $html_file;
1881  exec($htmldoc);
1882 
1883  unlink(ILIAS_ABSOLUTE_PATH."/".$html_file);
1884 
1885  chdir($curDir);
1886 
1887  if (file_exists(ILIAS_ABSOLUTE_PATH."/htmldoc_test_file.pdf"))
1888  {
1889  unlink(ILIAS_ABSOLUTE_PATH."/htmldoc_test_file.pdf");
1890  return true;
1891  }
1892  else
1893  {
1894  return false;
1895  }
1896  }
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 1683 of file class.ilSetup.php.

Referenced by checkToolsSetup().

1684  {
1685  // java is optional, so empty path is ok
1686  if (trim($a_java_path) == "")
1687  {
1688  return "";
1689  }
1690 
1691  if (!is_file($a_java_path))
1692  {
1693  return "check_failed_java";
1694  }
1695 
1696  return "";
1697 /*
1698  exec($a_java_path, $out, $back);
1699 
1700  unset($out);
1701 
1702  return ($back != 1) ? false : true;
1703 */
1704  }
+ 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 1712 of file class.ilSetup.php.

References $result, and ilUtil\stripSlashes().

Referenced by checkToolsSetup().

1713  {
1714  // latex is optional, so empty path is ok
1715  if (trim($a_latex_url) == "")
1716  {
1717  return "";
1718  }
1719 
1720  // open the URL
1721  include_once "./setup/classes/class.ilHttpRequest.php";
1722  $http = new ilHttpRequest(ilUtil::stripSlashes($a_latex_url) . "?x_0");
1723  $result = @$http->downloadToString();
1724  if ((strpos((substr($result, 0, 5)), "PNG") !== FALSE) || (strpos((substr($result, 0, 5)), "GIF") !== FALSE))
1725  {
1726  return "";
1727  }
1728  else
1729  {
1730  return "check_failed_latex";;
1731  }
1732  }
$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 1793 of file class.ilSetup.php.

Referenced by checkToolsSetup().

1794  {
1795  if (trim($a_unzip_path) == "")
1796  {
1797  return "no_path_unzip";
1798  }
1799  if (!is_file($a_unzip_path))
1800  {
1801  return "check_failed_unzip";
1802  }
1803 
1804  return "";
1805 /*
1806  $curDir = getcwd();
1807 
1808  chdir(ILIAS_ABSOLUTE_PATH);
1809 
1810  if (file_exists(ILIAS_ABSOLUTE_PATH."/unzip_test_file.zip"))
1811  {
1812  $unzipCmd = $a_unzip_path." unzip_test_file.zip";
1813  exec($unzipCmd);
1814  }
1815 
1816  chdir($curDir);
1817 
1818  // check wether unzip extracted the test file or not
1819  if (file_exists(ILIAS_ABSOLUTE_PATH."/unzip_test_file.txt"))
1820  {
1821  unlink(ILIAS_ABSOLUTE_PATH."/unzip_test_file.txt");
1822 
1823  return true;
1824  }
1825  else
1826  {
1827  return false;
1828  }
1829 */
1830  }
+ 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 1740 of file class.ilSetup.php.

Referenced by checkToolsSetup().

1741  {
1742  if (trim($a_zip_path) == "")
1743  {
1744  return "no_path_zip";
1745  }
1746  if (!is_file($a_zip_path))
1747  {
1748  return "check_failed_zip";
1749  }
1750 
1751  return "";
1752 /*
1753  // create test file and run zip
1754  $fp = fopen(ILIAS_ABSOLUTE_PATH."/test.dat", "w");
1755 
1756  fwrite($fp, "test");
1757  fclose($fp);
1758 
1759  if (file_exists(ILIAS_ABSOLUTE_PATH."/test.dat"))
1760  {
1761  $curDir = getcwd();
1762  chdir(ILIAS_ABSOLUTE_PATH);
1763 
1764  $zipCmd = $a_zip_path." -m zip_test_file.zip test.dat";
1765 
1766  exec($zipCmd);
1767 
1768  chdir($curDir);
1769 
1770  }
1771 
1772  // check wether zip generated test file or not
1773  if (file_exists(ILIAS_ABSOLUTE_PATH."/zip_test_file.zip"))
1774  {
1775  unlink(ILIAS_ABSOLUTE_PATH."/zip_test_file.zip");
1776  return true;
1777  }
1778  else
1779  {
1780  unlink(ILIAS_ABSOLUTE_PATH."/test.dat");
1781  return false;
1782  }
1783 */
1784  }
+ 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 1905 of file class.ilSetup.php.

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

1906  {
1907  //global $ilias;
1908 
1909  $pathinfo = pathinfo($a_file);
1910  $dir = $pathinfo["dirname"];
1911  $file = $pathinfo["basename"];
1912 
1913  // unzip
1914  $cdir = getcwd();
1915  chdir($dir);
1916  $unzip = $this->ini->readVariable("tools","unzip");
1917  $unzipcmd = $unzip." -Z -1 ".ilUtil::escapeShellArg($file);
1918  exec($unzipcmd, $arr);
1919  $zdirs = array();
1920 
1921  foreach($arr as $line)
1922  {
1923  if(is_int(strpos($line, "/")))
1924  {
1925  $zdir = substr($line, 0, strrpos($line, "/"));
1926  $nr = substr_count($zdir, "/");
1927  //echo $zdir." ".$nr."<br>";
1928  while ($zdir != "")
1929  {
1930  $nr = substr_count($zdir, "/");
1931  $zdirs[$zdir] = $nr; // collect directories
1932  //echo $dir." ".$nr."<br>";
1933  $zdir = substr($zdir, 0, strrpos($zdir, "/"));
1934  }
1935  }
1936  }
1937 
1938  asort($zdirs);
1939 
1940  foreach($zdirs as $zdir => $nr) // create directories
1941  {
1942  ilUtil::createDirectory($zdir);
1943  }
1944 
1945  // real unzip
1946  if ($overvwrite)
1947  {
1948  $unzipcmd = $unzip." ".ilUtil::escapeShellArg($file);
1949  }
1950  else
1951  {
1952  $unzipcmd = $unzip." -o ".ilUtil::escapeShellArg($file);
1953  }
1954  exec($unzipcmd);
1955 
1956  chdir($cdir);
1957  }
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 1266 of file class.ilSetup.php.

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

1267  {
1268  $convert_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["convert_path"]));
1269  $zip_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["zip_path"]));
1270  $unzip_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["unzip_path"]));
1271  $ghostscript_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["ghostscript_path"]));
1272  $java_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["java_path"]));
1273  $htmldoc_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["htmldoc_path"]));
1274  //$mkisofs_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["mkisofs_path"]));
1275  $ffmpeg_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["ffmpeg_path"]));
1276  $latex_url = ilUtil::stripSlashes($a_formdata["latex_url"]);
1277  $fop_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["fop_path"]));
1278  $scan_type = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["vscanner_type"]));
1279  $scan_command = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["scan_command"]));
1280  $clean_command = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["clean_command"]));
1281 
1282  $this->ini->setVariable("tools", "convert", $convert_path);
1283  $this->ini->setVariable("tools", "zip", $zip_path);
1284  $this->ini->setVariable("tools", "unzip", $unzip_path);
1285  $this->ini->setVariable("tools", "ghostscript", $ghostscript_path);
1286  $this->ini->setVariable("tools", "java", $java_path);
1287  $this->ini->setVariable("tools", "htmldoc", $htmldoc_path);
1288  //$this->ini->setVariable("tools", "mkisofs", $mkisofs_path);
1289  $this->ini->setVariable("tools", "ffmpeg", $ffmpeg_path);
1290  $this->ini->setVariable("tools", "latex", $latex_url);
1291  $this->ini->setVariable("tools", "fop", $fop_path);
1292  $this->ini->setVariable("tools", "vscantype", $scan_type);
1293  $this->ini->setVariable("tools", "scancommand", $scan_command);
1294  $this->ini->setVariable("tools", "cleancommand", $clean_command);
1295 
1296  $form_log_path = preg_replace("/\\\\/","/",ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["log_path"])));
1297  $log_path = substr($form_log_path,0,strrpos($form_log_path,"/"));
1298  $log_file = substr($form_log_path,strlen($log_path)+1);
1299 
1300  $this->ini->setVariable("log", "path", $log_path);
1301  $this->ini->setVariable("log", "file", $log_file);
1302  $this->ini->setVariable("log", "enabled", ($a_formdata["chk_log_status"]) ? "0" : 1);
1303  $this->ini->setVariable("server","timezone",preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["time_zone"])));
1304 
1305  if (!$this->ini->write())
1306  {
1307  $this->error = get_class($this).": ".$this->ini->getError();
1308  return false;
1309  }
1310 
1311  return true;
1312  }
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 190 of file class.ilSetup.php.

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

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

◆ $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 = "http://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: