4 include_once(
"./setup/classes/class.ilDBConnections.php");
76 define(
"ILIAS_MODULE",
"setup");
78 $this->auth = ($this->
checkAuth()) ?
true :
false;
79 $this->access_mode = $a_auth_type;
82 if ($this->safe_mode = ini_get(
"safe_mode"))
96 $this->ini_ilias_exists = $this->
init();
98 if ($this->ini_ilias_exists)
100 if ($this->ini->readVariable(
"log",
"path") !=
"")
102 $log->path = $this->ini->readVariable(
"log",
"path");
105 if ($this->ini->readVariable(
"log",
"file") !=
"")
107 $log->filename = $this->ini->readVariable(
"log",
"file");
110 if ($this->ini->readVariable(
"log",
"enabled") !=
"")
112 $log->enabled = $this->ini->readVariable(
"log",
"enabled");
128 $this->client = $a_cl;
147 $this->ini =
new ilIniFile($this->ini_file_path);
149 if (!$this->ini->read())
151 $this->ini->GROUPS = parse_ini_file($this->setup_defaults,
true);
152 $this->error = get_class($this).
": ".$this->ini->getError();
156 $this->setup_password = $this->ini->readVariable(
"setup",
"pass");
157 $this->default_client = $this->ini->readVariable(
"clients",
"default");
159 define(
"ILIAS_DATA_DIR",$this->ini->readVariable(
"clients",
"datadir"));
160 define(
"ILIAS_WEB_DIR",$this->ini->readVariable(
"clients",
"path"));
172 $_SESSION[
"ClientId"] = $this->client->getId();
175 if (!$this->client->create())
177 $this->error = $this->client->getError();
182 $this->ini_client_exists =
true;
197 if ($a_old_client_id != $this->client->getId())
202 $this->
raiseError($this->lng->txt(
"client_id_already_exists"),$this->error_obj->MESSAGE);
207 $this->
raiseError($this->lng->txt(
"save_error"),$this->error_obj->MESSAGE);
215 $this->ini_client_exists =
true;
226 if ($this->client->checkDatabaseExists())
228 $this->error = $this->lng->txt(
"database_exists");
232 $this->client->getDB()->connectHost(
true);
235 $db = $this->client->getDB();
238 $this->error =
"connection_failed";
242 $r =
$db->createDatabase($this->client->getdbName(),
243 "utf8", $a_collation);
247 $this->error =
"create_database_failed";
254 $this->client->db_exists =
true;
270 if (!$this->client->connect())
276 if ($this->
readDump($this->client->db, $this->SQL_FILE))
278 $this->client->db_installed =
true;
290 while( !feof( $fp ) )
309 if (
$db->getDBType() ==
"mysql")
311 $fp = fopen(
$file,
'r');
316 $line = trim($this->
getline($fp,
"\n"));
318 if ($line !=
"" && substr($line,0,1)!=
"#"
319 && substr($line,0,1)!=
"-")
322 if (substr($line,-1)==
";")
325 $q .=
" ".substr($line,0,-1);
328 if (
$db->getErrorNo() > 0)
330 echo
"<br />ERROR: ".$db->getError().
347 #echo 'Start Memory: '.memory_get_usage().' peak: '.memory_get_peak_usage();
348 if (in_array(
$db->getDBType(), array(
"oracle",
"postgres",
"innodb")))
350 if(@is_dir(
'./setup/sql/ilDBTemplate'))
352 include_once
'./Services/Database/classes/class.ilArrayTableDataParser.php';
353 include_once
'./Services/Xml/exceptions/class.ilSaxParserException.php';
357 eval(file_get_contents(
'./setup/sql/ilDBTemplate/'.$file));
361 #$parser = new ilSimpleXMLTableDataParser('./setup/sql/ilDBTemplate/'.$file.'.xml');
362 $parser->startParsing();
363 #echo 'Table: '.$file.', memory: '.memory_get_peak_usage().' peak: '.memory_get_peak_usage().'<br />';flush();
374 include_once(
"./setup/sql/ilDBTemplate.php");
375 setupILIASDatabase();
378 #echo 'Start Memory: '.memory_get_usage().' peak: '.memory_get_peak_usage();
389 $a = @file_exists($this->INI_FILE);
401 if (is_writable(
"."))
403 $arr[
"status"] =
true;
406 $arr[
"comment"] = getcwd();
411 $arr[
"status"] =
false;
412 $arr[
"comment"] = $this->lng->txt(
"pre_folder_write_error");
415 $arr[
"comment"] = getcwd().
": ".$arr[
"comment"];
430 if (@mkdir($a_dir.
"/crst879dldsk9d", 0774))
432 $arr[
"status"] =
true;
433 $arr[
"comment"] =
"";
435 @rmdir($a_dir.
"/crst879dldsk9d");
439 $arr[
"status"] =
false;
442 $arr[
"comment"] = getcwd().
": ".$this->lng->txt(
"pre_folder_create_error");
457 if ($sess->usesCookies)
459 $arr[
"status"] =
true;
460 $arr[
"comment"] =
"";
464 $arr[
"status"] =
false;
465 $arr[
"comment"] = $this->lng->txt(
"pre_cookies_disabled");
477 $version = PHP_VERSION;
479 $arr[
"status"] =
true;
480 $arr[
"comment"] =
"PHP ".$version;
481 if (version_compare($version,
'5.3.0',
'<'))
483 $arr[
"status"] =
false;
484 $arr[
"comment"] =
"PHP ".$version.
". ".$this->lng->txt(
"pre_php_version_too_low");
498 if (function_exists(
"mysql_query"))
500 $arr[
"status"] =
true;
501 $arr[
"comment"] = $this->lng->txt(
"pre_mysql_4_1_or_higher");
505 $arr[
"status"] =
false;
506 $arr[
"comment"] = $this->lng->txt(
"pre_mysql_missing");
535 if (class_exists(
"DOMDocument"))
537 $arr[
"status"] =
true;
541 $arr[
"status"] =
false;
542 $arr[
"comment"] = $this->lng->txt(
"pre_dom_missing");
556 if (class_exists(
"XSLTProcessor"))
558 $arr[
"status"] =
true;
562 $arr[
"status"] =
false;
563 $arr[
"comment"] = sprintf($this->lng->txt(
"pre_xsl_missing"),
564 "http://php.net/manual/en/book.xsl.php");
578 if (function_exists(
"imagefill") && function_exists(
"imagecolorallocate"))
580 $arr[
"status"] =
true;
584 $arr[
"status"] =
false;
585 $arr[
"comment"] = sprintf($this->lng->txt(
"pre_gd_missing"),
586 "http://php.net/manual/en/book.image.php");
600 $limit = ini_get(
"memory_limit");
603 if (is_int(strpos($limit,
"M")))
605 $limit_n = (int) $limit;
614 $arr[
"status"] =
true;
615 $arr[
"comment"] = $limit.
". ".$this->lng->txt(
"pre_memory_limit_recommend");
619 $arr[
"status"] =
false;
620 $arr[
"comment"] = $limit.
". ".$this->lng->txt(
"pre_memory_limit_too_low");
632 $load_comments = ini_get(
"opcache.load_comments");
633 if($load_comments == 1) {
634 $arr[
"status"] =
true;
636 $arr[
"status"] =
false;
637 $arr[
"comment"] = $this->lng->txt(
"pre_opcache_comments");
678 foreach ($this->preliminaries_result as $val)
680 if ($val[
"status"] ===
false)
682 $this->preliminaries =
false;
696 return $this->ini->readVariable(
"setup",
"pass");
706 $this->ini->setVariable(
"setup",
"pass",md5($a_password));
708 if ($this->ini->write() ==
false)
710 $this->error = $this->ini->getError();
726 if (empty($a_auth_data[
"client_id"]))
728 $this->error =
"no_client_id";
732 if (empty($a_auth_data[
"username"]))
734 $this->error =
"no_username";
738 if (empty($a_auth_data[
"password"]))
740 $this->error =
"no_password";
744 if (!$this->
newClient($a_auth_data[
"client_id"]))
746 $this->error =
"unknown_client_id";
747 unset($this->client);
751 if (!$this->client->db_exists)
753 $this->error =
"no_db_connect_consult_admin";
754 unset($this->client);
758 $s1 = $this->client->db->query(
"SELECT value from settings WHERE keyword = ".
759 $this->client->db->quote(
'system_role_id',
'text'));
760 $r1 = $this->client->db->fetchAssoc($s1);
761 $system_role_id = $r1[
"value"];
764 if($this->client->db->tableColumnExists(
'usr_data',
'passwd_enc_type'))
766 $add_usrfields .=
' , usr_data.passwd_enc_type, usr_data.passwd_salt ';
768 $q =
"SELECT usr_data.usr_id, usr_data.passwd $add_usrfields " .
770 "LEFT JOIN rbac_ua ON rbac_ua.usr_id=usr_data.usr_id " .
771 "WHERE rbac_ua.rol_id = " . $this->client->db->quote((
int)$system_role_id,
'integer') .
" " .
772 "AND usr_data.login=" . $this->client->db->quote($a_auth_data[
"username"],
'text');
773 $r = $this->client->db->query($q);
774 if(!$this->client->db->numRows($r))
776 $this->error =
'login_invalid';
780 $data = $this->client->db->fetchAssoc($r);
782 global $ilClientIniFile;
784 $ilClientIniFile = $this->client->ini;
786 require_once
'Services/User/classes/class.ilUserPasswordManager.php';
787 $crypt_type = ilUserPasswordManager::getInstance()->getEncoderName();
788 if(strlen($add_usrfields) && ilUserPasswordManager::getInstance()->isEncodingTypeSupported($crypt_type))
790 require_once
'setup/classes/class.ilObjSetupUser.php';
793 $user->setPasswordEncodingType($data[
'passwd_enc_type']);
794 $user->setPasswordSalt($data[
'passwd_salt']);
796 $password_valid = ilUserPasswordManager::getInstance()->verifyPassword($user, $a_auth_data[
'password']);
800 $password_valid = $data[
'passwd'] == md5($a_auth_data[
'password']);
807 $_SESSION[
'auth_path'] = ILIAS_HTTP_PATH;
809 $_SESSION[
'ClientId'] = $this->client->getId();
814 $this->error =
'login_invalid';
826 $a_password = md5($a_password);
828 if ($this->ini->readVariable(
"setup",
"pass") == $a_password)
831 $_SESSION[
"auth_path"] = ILIAS_HTTP_PATH;
851 $this->client =
new ilClient($a_client_id, $this->db_connections);
853 if (!$this->client->init())
856 $this->error = get_class($this).
": ".$this->client->getError();
875 if ($this->ini_client_exists)
888 if ($status[
"db"][
"status"] ===
false and $status[
"db"][
"update"] !==
true)
892 $status[
"lang"][
"status"] =
false;
893 $status[
"lang"][
"comment"] = $status[
"db"][
"comment"];
894 $status[
"contact"][
"status"] =
false;
895 $status[
"contact"][
"comment"] = $status[
"db"][
"comment"];
897 $status[
"proxy"][
"status"] =
false;
898 $status[
"proxy"][
"comment"] = $status[
"db"][
"comment"];
900 $status[
"passwd"][
"status"] =
false;
901 $status[
"passwd"][
"comment"] = $status[
"db"][
"comment"];
903 $status[
"nic"][
"status"] =
false;
904 $status[
"nic"][
"comment"] = $status[
"db"][
"comment"];
929 if (
$client->getSetting(
"setup_ok"))
931 $arr[
"status"] =
true;
936 $arr[
"status"] =
false;
937 $arr[
"comment"] = $this->lng->txt(
"setup_not_finished");
950 if (
$client->ini->readVariable(
"client",
"access") ==
"1")
952 $arr[
"status"] =
true;
953 $arr[
"comment"] = $this->lng->txt(
"online");
957 $arr[
"status"] =
false;
958 $arr[
"comment"] = $this->lng->txt(
"disabled");
971 if (!$arr[
"status"] =
$client->init())
973 $arr[
"comment"] =
$client->getError();
990 if (!$arr[
"status"] =
$client->db_exists)
992 $arr[
"comment"] = $this->lng->txt(
"no_database");
996 if (!$arr[
"status"] =
$client->db_installed)
998 $arr[
"comment"] = $this->lng->txt(
"db_not_installed");
1006 include_once
"./Services/Database/classes/class.ilDBUpdate.php";
1008 $this->lng->setDbHandler(
$client->db);
1011 if (!$arr[
"status"] = $dbupdate->getDBVersionStatus())
1013 $arr[
"comment"] = $this->lng->txt(
"db_needs_update");
1014 $arr[
"update"] =
true;
1017 else if ($dbupdate->hotfixAvailable())
1019 $arr[
"status"] =
false;
1020 $arr[
"comment"] = $this->lng->txt(
"hotfix_available");
1021 $arr[
"update"] =
true;
1024 else if ($dbupdate->customUpdatesAvailable())
1026 $arr[
"status"] =
false;
1027 $arr[
"comment"] = $this->lng->txt(
"custom_updates_available");
1028 $arr[
"update"] =
true;
1034 $cset =
$ilDB->query(
"SELECT count(*) as cnt FROM ctrl_calls");
1035 $crec =
$ilDB->fetchAssoc($cset);
1036 if ($crec[
"cnt"] == 0)
1038 $arr[
"status"] =
false;
1039 $arr[
"comment"] = $this->lng->txt(
"db_control_structure_missing");
1040 $arr[
"update"] =
true;
1055 require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
1062 $query =
"SELECT keyword, value FROM settings WHERE ".$db->in(
'keyword', $fields,
false,
'text');
1068 if(
$row[
'value'] !=
'' )
1073 if (count($rows) != count($fields))
1075 if($a_as_bool)
return false;
1076 $arr[
"status"] =
false;
1077 $arr[
"comment"] = $this->lng->txt(
"session_management_not_configured");
1081 if($a_as_bool)
return true;
1082 $arr[
"status"] =
true;
1083 $arr[
"comment"] = $this->lng->txt(
"session_management_configured");
1098 $fields = array(
'proxy_status',
'proxy_host',
'proxy_port');
1100 $query =
"SELECT keyword, value FROM settings WHERE ".$db->in(
'keyword', $fields,
false,
'text');
1103 $proxy_settings = array();
1104 $already_saved =
false;
1107 $already_saved =
true;
1108 $proxy_settings[
$row[
'keyword']] = $row[
'value'];
1113 $arr[
"status"] =
false;
1114 $arr[
"comment"] = $this->lng->txt(
"proxy");
1115 $arr[
"text"] = $this->lng->txt(
"proxy");
1117 else if((
bool)$proxy_settings[
"proxy_status"] ==
false)
1119 $arr[
"status"] =
true;
1120 $arr[
"comment"] = $this->lng->txt(
"proxy_disabled");
1121 $arr[
"text"] = $this->lng->txt(
"proxy_disabled");
1125 $arr[
"status"] =
true;
1126 $arr[
"comment"] = $this->lng->txt(
"proxy_activated_configurated");
1127 $arr[
"text"] = $this->lng->txt(
"proxy_activated_configurated");
1140 $installed_langs = $this->lng->getInstalledLanguages();
1142 $count = count($installed_langs);
1146 $arr[
"status"] =
false;
1147 $arr[
"comment"] = $this->lng->txt(
"lang_none_installed");
1151 $arr[
"status"] =
true;
1165 $arr[
"status"] =
true;
1168 $settings =
$client->getAllSettings();
1169 $client_name =
$client->getName();
1172 if (empty($settings[
"admin_firstname"]) or empty($settings[
"admin_lastname"]) or
1173 empty($settings[
"admin_email"]) or empty($client_name))
1175 $arr[
"status"] =
false;
1176 $arr[
"comment"] = $this->lng->txt(
"missing_data");
1180 if (!
ilUtil::is_email($settings[
"admin_email"]) and $arr[
"status"] !=
false)
1182 $arr[
"status"] =
false;
1183 $arr[
"comment"] = $this->lng->txt(
"email_not_valid");
1196 $settings =
$client->getAllSettings();
1198 if (!isset($settings[
"nic_enabled"]))
1200 $arr[
"status"] =
false;
1201 $arr[
"comment"] = $this->lng->txt(
"nic_not_disabled");
1205 $arr[
"status"] =
true;
1207 if ($settings[
"nic_enabled"] ==
"-1")
1209 $arr[
"comment"] = $this->lng->txt(
"nic_reg_failed");
1213 if (!$settings[
"nic_enabled"])
1215 $arr[
"comment"] = $this->lng->txt(
"nic_reg_disabled");
1219 $arr[
"comment"] = $this->lng->txt(
"nic_reg_enabled");
1220 if ($settings[
"inst_id"] <= 0)
1222 $arr[
"status"] =
false;
1253 return ($this->access_mode ==
"admin") ?
true :
false;
1265 if ($a_formdata[
"chk_datadir_path"] == 1)
1269 $this->error =
"create_datadir_failed";
1279 $this->error =
"create_webdir_failed";
1285 $log_path = substr($form_log_path,0,strrpos($form_log_path,
"/"));
1286 $log_file = substr($form_log_path,strlen($log_path)+1);
1288 $this->ini->setVariable(
"server",
"http_path",ILIAS_HTTP_PATH);
1290 $this->ini->setVariable(
"server",
"timezone",preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"time_zone"])));
1291 $this->ini->setVariable(
"clients",
"datadir", $datadir_path);
1292 $this->ini->setVariable(
"tools",
"convert", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"convert_path"])));
1293 $this->ini->setVariable(
"tools",
"zip", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"zip_path"])));
1294 $this->ini->setVariable(
"tools",
"unzip", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"unzip_path"])));
1295 $this->ini->setVariable(
"tools",
"ghostscript", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"ghostscript_path"])));
1296 $this->ini->setVariable(
"tools",
"java", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"java_path"])));
1297 $this->ini->setVariable(
"tools",
"htmldoc", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"htmldoc_path"])));
1299 $this->ini->setVariable(
"tools",
"ffmpeg", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"ffmpeg_path"])));
1301 $this->ini->setVariable(
"tools",
"vscantype", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"vscanner_type"])));
1302 $this->ini->setVariable(
"tools",
"scancommand", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"scan_command"])));
1303 $this->ini->setVariable(
"tools",
"cleancommand", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"clean_command"])));
1304 $this->ini->setVariable(
"setup",
"pass", md5($a_formdata[
"setup_pass"]));
1305 $this->ini->setVariable(
"log",
"path", $log_path);
1306 $this->ini->setVariable(
"log",
"file", $log_file);
1307 $this->ini->setVariable(
"log",
"enabled", ($a_formdata[
"chk_log_status"]) ?
"0" : 1);
1309 $this->ini->setVariable(
"https",
"auto_https_detect_enabled", ($a_formdata[
"auto_https_detect_enabled"]) ? 1 : 0);
1310 $this->ini->setVariable(
"https",
"auto_https_detect_header_name", $a_formdata[
"auto_https_detect_header_name"]);
1311 $this->ini->setVariable(
"https",
"auto_https_detect_header_value", $a_formdata[
"auto_https_detect_header_value"]);
1313 if (!$this->ini->write())
1315 $this->error = get_class($this).
": ".$this->ini->getError();
1321 $_SESSION[
"auth_path"] = ILIAS_HTTP_PATH;
1337 $ghostscript_path = preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"ghostscript_path"]));
1346 $clean_command = preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"clean_command"]));
1348 $this->ini->setVariable(
"tools",
"convert", $convert_path);
1349 $this->ini->setVariable(
"tools",
"zip", $zip_path);
1350 $this->ini->setVariable(
"tools",
"unzip", $unzip_path);
1351 $this->ini->setVariable(
"tools",
"ghostscript", $ghostscript_path);
1352 $this->ini->setVariable(
"tools",
"java", $java_path);
1353 $this->ini->setVariable(
"tools",
"htmldoc", $htmldoc_path);
1355 $this->ini->setVariable(
"tools",
"ffmpeg", $ffmpeg_path);
1356 $this->ini->setVariable(
"tools",
"latex", $latex_url);
1357 $this->ini->setVariable(
"tools",
"fop", $fop_path);
1358 $this->ini->setVariable(
"tools",
"vscantype", $scan_type);
1359 $this->ini->setVariable(
"tools",
"scancommand", $scan_command);
1360 $this->ini->setVariable(
"tools",
"cleancommand", $clean_command);
1363 $log_path = substr($form_log_path,0,strrpos($form_log_path,
"/"));
1364 $log_file = substr($form_log_path,strlen($log_path)+1);
1366 $this->ini->setVariable(
"log",
"path", $log_path);
1367 $this->ini->setVariable(
"log",
"file", $log_file);
1368 $this->ini->setVariable(
"log",
"enabled", ($a_formdata[
"chk_log_status"]) ?
"0" : 1);
1369 $this->ini->setVariable(
"server",
"timezone",preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"time_zone"])));
1371 $this->ini->setVariable(
"https",
"auto_https_detect_enabled",($a_formdata[
"auto_https_detect_enabled"]) ? 1 : 0);
1372 $this->ini->setVariable(
"https",
"auto_https_detect_header_name", $a_formdata[
"auto_https_detect_header_name"]);
1373 $this->ini->setVariable(
"https",
"auto_https_detect_header_value", $a_formdata[
"auto_https_detect_header_value"]);
1375 if (!$this->ini->write())
1377 $this->error = get_class($this).
": ".$this->ini->getError();
1392 if (!isset($a_formdata[
"chk_convert_path"]))
1397 if (($err = $this->
testConvert($convert_path)) !=
"")
1399 $this->error = $err;
1405 if (!isset($a_formdata[
"chk_zip_path"]))
1410 if (empty($zip_path))
1412 $this->error =
"no_path_zip";
1416 if (!$this->
testZip($zip_path))
1418 $this->error =
"check_failed_zip";
1424 if (!isset($a_formdata[
"chk_unzip_path"]))
1429 if (empty($unzip_path))
1431 $this->error =
"no_path_unzip";
1437 $this->error =
"check_failed_unzip";
1443 if (!isset($a_formdata[
"chk_ghostscript_path"]))
1446 $ghostscript_path = preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"ghostscript_path"]));
1450 $this->error = $err;
1456 if (!isset($a_formdata[
"chk_java_path"]))
1461 if (empty($java_path))
1463 $this->error =
"no_path_java";
1469 $this->error =
"check_failed_java";
1475 if (!isset($a_formdata[
"chk_htmldoc_path"]))
1480 if (empty($htmldoc_path))
1482 $this->error =
"no_path_htmldoc";
1488 $this->error =
"check_failed_htmldoc";
1510 if (!isset($a_formdata[
"chk_ffmpeg_path"]))
1515 if (empty($ffmpeg_path))
1517 $this->error =
"no_path_ffmpeg";
1521 if (!$this->testFFMpeg($ffmpeg_path))
1523 $this->error =
"check_failed_ffmpeg";
1529 if (!isset($a_formdata[
"chk_latex_url"]))
1532 if (empty($latex_url))
1534 $this->error =
"no_latex_url";
1540 $this->error =
"check_failed_latex";
1558 if (empty($datadir_path))
1560 $this->error =
"no_path_datadir";
1567 if (strpos($datadir_path,$webspace_dir) !==
false)
1569 $this->error =
"datadir_webspacedir_match";
1574 if ($a_formdata[
"chk_datadir_path"] == 1)
1576 $dir_to_create = substr(strrchr($datadir_path,
"/"), 1);
1577 $dir_to_check = substr($datadir_path,0,- strlen($dir_to_create)-1);
1579 if (is_writable($datadir_path))
1581 $this->error =
"dir_exists_create";
1585 if (!is_writable($dir_to_check))
1587 $this->error =
"cannot_create_datadir_no_write_access";
1593 if (!is_writable($datadir_path))
1595 $this->error =
"cannot_create_datadir_no_write_access";
1610 if (!$a_formdata[
"setup_pass"])
1612 $this->error =
"no_setup_pass_given";
1616 if ($a_formdata[
"setup_pass"] != $a_formdata[
"setup_pass2"])
1618 $this->error =
"pass_does_not_match";
1633 if (!$a_formdata[
"chk_log_status"])
1638 if (empty($log_path))
1640 $this->error =
"no_path_log";
1644 if (!@touch($log_path))
1646 $this->error =
"could_not_create_logfile";
1660 if (empty($this->error))
1693 if (trim($a_convert_path) ==
"")
1695 return "no_path_convert";
1697 if (!is_file($a_convert_path))
1699 return "check_failed_convert";
1715 if (trim($a_ghostscript_path) ==
"")
1719 if (!is_file($a_ghostscript_path))
1721 return "check_failed_ghostscript";
1736 if (trim($a_java_path) ==
"")
1741 if (!is_file($a_java_path))
1743 return "check_failed_java";
1765 if (trim($a_latex_url) ==
"")
1771 include_once
"./setup/classes/class.ilHttpRequest.php";
1773 $result = @$http->downloadToString();
1774 if ((strpos((substr(
$result, 0, 5)),
"PNG") !== FALSE) || (strpos((substr(
$result, 0, 5)),
"GIF") !== FALSE))
1780 return "check_failed_latex";;
1792 if (trim($a_zip_path) ==
"")
1794 return "no_path_zip";
1796 if (!is_file($a_zip_path))
1798 return "check_failed_zip";
1845 if (trim($a_unzip_path) ==
"")
1847 return "no_path_unzip";
1849 if (!is_file($a_unzip_path))
1851 return "check_failed_unzip";
1891 if (trim($a_htmldoc_path) ==
"")
1896 if (!is_file($a_htmldoc_path))
1898 return "check_failed_htmldoc";
1908 $html =
"<html><head><title></title></head><body><p>test</p></body></html>";
1910 $html_file =
"htmldoc_test_file.html";
1912 $fp = fopen( $html_file ,
"wb");
1916 $htmldoc = $a_htmldoc_path.
" ";
1917 $htmldoc .=
"--no-toc ";
1918 $htmldoc .=
"--no-jpeg ";
1919 $htmldoc .=
"--webpage ";
1920 $htmldoc .=
"--outfile htmldoc_test_file.pdf ";
1921 $htmldoc .=
"--bodyfont Arial ";
1922 $htmldoc .=
"--charset iso-8859-15 ";
1923 $htmldoc .=
"--color ";
1924 $htmldoc .=
"--size A4 ";
1925 $htmldoc .=
"--format pdf ";
1926 $htmldoc .=
"--footer ... ";
1927 $htmldoc .=
"--header ... ";
1928 $htmldoc .=
"--left 60 ";
1930 $htmldoc .= $html_file;
1955 function unzip($a_file, $overwrite =
false)
1959 $pathinfo = pathinfo($a_file);
1960 $dir = $pathinfo[
"dirname"];
1961 $file = $pathinfo[
"basename"];
1966 $unzip = $this->ini->readVariable(
"tools",
"unzip");
1968 exec($unzipcmd, $arr);
1971 foreach($arr as $line)
1973 if(is_int(strpos($line,
"/")))
1975 $zdir = substr($line, 0, strrpos($line,
"/"));
1976 $nr = substr_count($zdir,
"/");
1980 $nr = substr_count($zdir,
"/");
1981 $zdirs[$zdir] = $nr;
1983 $zdir = substr($zdir, 0, strrpos($zdir,
"/"));
1990 foreach($zdirs as $zdir => $nr)
2016 require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
2018 $db = $this->client->getDB();
2023 foreach($setting_fields as $field)
2025 if( isset($session_settings[$field]) )
2027 $query =
"SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
2029 array(
'text',
'text'), array(
'common', $field));
2034 if( count(
$row) > 0 )
2039 'value' => array(
'text', $session_settings[$field])
2042 'module' => array(
'text',
'common'),
2043 'keyword' => array(
'text', $field)
2052 'module' => array(
'text',
'common'),
2053 'keyword' => array(
'text', $field),
2054 'value' => array(
'text', $session_settings[$field])
2063 if($i < 4) $message = $this->lng->txt(
"session_settings_not_saved");
2064 else $message = $this->lng->txt(
"settings_saved");
2076 require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
2078 $db = $this->client->getDB();
2082 $query =
"SELECT * FROM settings WHERE module = %s " .
2083 "AND ".$db->in(
'keyword', $setting_fields,
false,
'text');
2087 $session_settings = array();
2090 $session_settings[
$row[
'keyword']] = $row[
'value'];
2093 foreach( $setting_fields as $field )
2095 if( !isset($session_settings[$field]) )
2101 case 'session_max_count':
2106 case 'session_min_idle':
2111 case 'session_max_idle':
2116 case 'session_max_idle_after_first_request':
2121 case 'session_allow_client_maintenance':
2127 $session_settings[$field] = $value;
2131 return $session_settings;
2142 $source =
new ilClient($source_id, $this->db_connections);
2151 $this->error =
"Could not delete data dir $target->getDataDir()";
2158 $this->error =
"could_not_create_base_data_dir :".$target->getDataDir();
2163 if (!
ilUtil::rCopy($source->getDataDir(),$target->getDataDir())) {
2164 $this->error =
"clone_datadircopyfail";
2165 $target->ini->write();
2171 $this->error =
"Could not delete webspace dir $target->getWebspaceDir()";
2178 $this->error =
"could_not_create_base_webspace_dir :".$target->getWebspaceDir();
2183 if (!
ilUtil::rCopy($source->getWebspaceDir(),$target->getWebspaceDir())) {
2184 $this->error =
"clone_websipacedircopyfail";
2185 $target->ini->write();
2190 $target->ini->write();
2198 $this->error =
"Source database connection failed.";
2205 $this->error =
"Target database connection failed.";
2210 $srcTables = $source->db->query(
"SHOW TABLES");
2214 $tarTables = $target->db->query(
"SHOW TABLES");
2215 foreach($tarTables->fetchAll() as $cTable)
2217 $target->db->query(
"DROP TABLE IF EXISTS " . $cTable[0]);
2220 foreach($srcTables->fetchAll() as $cTable){
2221 $drop = $target->db->query(
"DROP TABLE IF EXISTS " . $cTable[0]);
2222 $create = $target->db->query(
"CREATE TABLE " . $cTable[0] .
" LIKE " . $source->getDbName() .
"." . $cTable[0]);
2226 $insert = $target->db->query(
"INSERT INTO " . $cTable[0] .
" SELECT * FROM ".$source->getDbName().
".".$cTable[0]);
2229 $target->db->query(
"UPDATE settings SET VALUE = ".$target->db->quote(0,
"integer").
" WHERE keyword = ".$target->db->quote(
"inst_id",
"text"));
2230 $target->db->query(
"UPDATE settings SET VALUE = ".$target->db->quote(0,
"integer").
" WHERE keyword = ".$target->db->quote(
"nic_enabled",
"text"));
2242 require_once
'./Services/Http/exceptions/class.ilProxyException.php';
2243 $settings =
$client->getAllSettings();
2245 if((
bool)$settings[
'proxy_status'] ==
true)
2254 require_once
'Services/PEAR/lib/Net/Socket.php';
2258 $response = $socket->connect($settings[
'proxy_host'], $settings[
'proxy_port']);
2259 if(!is_bool($response))
2262 throw new ilProxyException(strlen($response) ? $response : $lng->txt(
'proxy_not_connectable'));
2270 ilUtil::sendFailure($this->lng->txt(
'proxy_pear_net_socket_error').
': '.$e->getMessage());
2278 $db = $this->client->getDB();
2279 $proxy_fields = array(
'proxy_status',
'proxy_host',
'proxy_port');
2281 foreach($proxy_fields as $field)
2283 if( isset($proxy_settings[$field]) )
2285 $query =
"SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
2287 array(
'text',
'text'), array(
'common', $field));
2292 if( count(
$row) > 0 )
2297 'value' => array(
'text', $proxy_settings[$field])
2300 'module' => array(
'text',
'common'),
2301 'keyword' => array(
'text', $field)
2310 'module' => array(
'text',
'common'),
2311 'keyword' => array(
'text', $field),
2312 'value' => array(
'text', $proxy_settings[$field])
2325 $this->
getClient()->ini->setVariable(
'auth',
'password_encoder', $passwd_settings[
'default_encoder']);
2336 'default_encoder' =>
2337 $this->
getClient()->ini->readVariable(
'auth',
'password_encoder') ?
2338 $this->
getClient()->ini->readVariable(
'auth',
'password_encoder') :
2349 $arr[
'status'] = strlen($client->ini->readVariable(
'auth',
'password_encoder'));
2352 $arr[
'comment'] = $this->lng->txt(
'passwd_encoding_configured');
2356 $arr[
'comment'] = $this->lng->txt(
'session_management_not_configured');
2366 $ini_get = ini_get(
'opcache.enable');
2368 return ($ini_get === 1 OR $ini_get ===
'1' OR strtolower($ini_get) ===
'on');
2376 return parent::getFileName();
2381 if(!parent::valid())
2385 if($this->isFile() and substr(parent::getFileName(),-4) ==
'.xml')
2389 if($this->isFile() and substr(parent::getFileName(),-8) !=
'_inserts')
2394 return $this->
valid();