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");
124 $this->client = $a_cl;
145 $this->ini =
new ilIniFile($this->ini_file_path);
147 if (!$this->ini->read())
149 $this->ini->GROUPS = parse_ini_file($this->setup_defaults,
true);
150 $this->error = get_class($this).
": ".$this->ini->getError();
154 $this->setup_password = $this->ini->readVariable(
"setup",
"pass");
155 $this->default_client = $this->ini->readVariable(
"clients",
"default");
157 define(
"ILIAS_DATA_DIR",$this->ini->readVariable(
"clients",
"datadir"));
158 define(
"ILIAS_WEB_DIR",$this->ini->readVariable(
"clients",
"path"));
170 $_SESSION[
"ClientId"] = $this->client->getId();
173 if (!$this->client->create())
175 $this->error = $this->client->getError();
180 $this->ini_client_exists =
true;
195 if ($a_old_client_id != $this->client->getId())
200 $this->
raiseError($this->lng->txt(
"client_id_already_exists"),$this->error_obj->MESSAGE);
205 $this->
raiseError($this->lng->txt(
"save_error"),$this->error_obj->MESSAGE);
213 $this->ini_client_exists =
true;
224 if ($this->client->checkDatabaseExists())
226 $this->error = $this->lng->txt(
"database_exists");
230 $this->client->getDB()->connectHost(
true);
233 $db = $this->client->getDB();
236 $this->error =
"connection_failed";
240 $r =
$db->createDatabase($this->client->getdbName(),
241 "utf8", $a_collation);
245 $this->error =
"create_database_failed";
252 $this->client->db_exists =
true;
268 if (!$this->client->connect())
274 if ($this->
readDump($this->client->db, $this->SQL_FILE))
276 $this->client->db_installed =
true;
288 while( !feof( $fp ) )
307 if (
$db->getDBType() ==
"mysql")
309 $fp = fopen(
$file,
'r');
314 $line = trim($this->
getline($fp,
"\n"));
316 if ($line !=
"" && substr($line,0,1)!=
"#"
317 && substr($line,0,1)!=
"-")
320 if (substr($line,-1)==
";")
323 $q .=
" ".substr($line,0,-1);
326 if (
$db->getErrorNo() > 0)
328 echo
"<br />ERROR: ".$db->getError().
345 #echo 'Start Memory: '.memory_get_usage().' peak: '.memory_get_peak_usage();
346 if (in_array(
$db->getDBType(), array(
"oracle",
"postgres",
"innodb")))
348 if(@is_dir(
'./setup/sql/ilDBTemplate'))
350 include_once
'./Services/Database/classes/class.ilArrayTableDataParser.php';
351 include_once
'./Services/Xml/exceptions/class.ilSaxParserException.php';
355 eval(file_get_contents(
'./setup/sql/ilDBTemplate/'.$file));
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();
372 include_once(
"./setup/sql/ilDBTemplate.php");
373 setupILIASDatabase();
376 #echo 'Start Memory: '.memory_get_usage().' peak: '.memory_get_peak_usage();
387 $a = @file_exists($this->INI_FILE);
399 if (is_writable(
"."))
401 $arr[
"status"] =
true;
404 $arr[
"comment"] = getcwd();
409 $arr[
"status"] =
false;
410 $arr[
"comment"] = $this->lng->txt(
"pre_folder_write_error");
413 $arr[
"comment"] = getcwd().
": ".$arr[
"comment"];
428 if (@mkdir($a_dir.
"/crst879dldsk9d", 0774))
430 $arr[
"status"] =
true;
431 $arr[
"comment"] =
"";
433 @rmdir($a_dir.
"/crst879dldsk9d");
437 $arr[
"status"] =
false;
440 $arr[
"comment"] = getcwd().
": ".$this->lng->txt(
"pre_folder_create_error");
455 if ($sess->usesCookies)
457 $arr[
"status"] =
true;
458 $arr[
"comment"] =
"";
462 $arr[
"status"] =
false;
463 $arr[
"comment"] = $this->lng->txt(
"pre_cookies_disabled");
475 $version = PHP_VERSION;
477 $arr[
"status"] =
true;
478 $arr[
"comment"] =
"PHP ".$version;
479 if (version_compare($version,
'5.2.6',
'<'))
481 $arr[
"status"] =
false;
482 $arr[
"comment"] =
"PHP ".$version.
". ".$this->lng->txt(
"pre_php_version_too_low");
496 if (function_exists(
"mysql_query"))
498 $arr[
"status"] =
true;
499 $arr[
"comment"] = $this->lng->txt(
"pre_mysql_4_1_or_higher");
503 $arr[
"status"] =
false;
504 $arr[
"comment"] = $this->lng->txt(
"pre_mysql_missing");
533 if (class_exists(
"DOMDocument"))
535 $arr[
"status"] =
true;
539 $arr[
"status"] =
false;
540 $arr[
"comment"] = $this->lng->txt(
"pre_dom_missing");
554 if (class_exists(
"XSLTProcessor"))
556 $arr[
"status"] =
true;
560 $arr[
"status"] =
false;
561 $arr[
"comment"] = sprintf($this->lng->txt(
"pre_xsl_missing"),
562 "http://php.net/manual/en/book.xsl.php");
576 if (function_exists(
"imagefill") && function_exists(
"imagecolorallocate"))
578 $arr[
"status"] =
true;
582 $arr[
"status"] =
false;
583 $arr[
"comment"] = sprintf($this->lng->txt(
"pre_gd_missing"),
584 "http://php.net/manual/en/book.image.php");
598 $limit = ini_get(
"memory_limit");
601 if (is_int(strpos($limit,
"M")))
603 $limit_n = (int) $limit;
612 $arr[
"status"] =
true;
613 $arr[
"comment"] = $limit.
". ".$this->lng->txt(
"pre_memory_limit_recommend");
617 $arr[
"status"] =
false;
618 $arr[
"comment"] = $limit.
". ".$this->lng->txt(
"pre_memory_limit_too_low");
655 foreach ($this->preliminaries_result as $val)
657 if ($val[
"status"] ===
false)
659 $this->preliminaries =
false;
673 return $this->ini->readVariable(
"setup",
"pass");
683 $this->ini->setVariable(
"setup",
"pass",md5($a_password));
685 if ($this->ini->write() ==
false)
687 $this->error = $this->ini->getError();
703 if (empty($a_auth_data[
"client_id"]))
705 $this->error =
"no_client_id";
709 if (empty($a_auth_data[
"username"]))
711 $this->error =
"no_username";
715 if (empty($a_auth_data[
"password"]))
717 $this->error =
"no_password";
721 if (!$this->
newClient($a_auth_data[
"client_id"]))
723 $this->error =
"unknown_client_id";
724 unset($this->client);
728 if (!$this->client->db_exists)
730 $this->error =
"no_db_connect_consult_admin";
731 unset($this->client);
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');
745 $r = $this->client->db->query($q);
749 $this->error =
"login_invalid";
755 $_SESSION[
"auth_path"] = ILIAS_HTTP_PATH;
757 $_SESSION[
"ClientId"] = $this->client->getId();
768 $a_password = md5($a_password);
770 if ($this->ini->readVariable(
"setup",
"pass") == $a_password)
773 $_SESSION[
"auth_path"] = ILIAS_HTTP_PATH;
793 $this->client =
new ilClient($a_client_id, $this->db_connections);
795 if (!$this->client->init())
798 $this->error = get_class($this).
": ".$this->client->getError();
817 if ($this->ini_client_exists)
830 if ($status[
"db"][
"status"] ===
false and $status[
"db"][
"update"] !==
true)
834 $status[
"lang"][
"status"] =
false;
835 $status[
"lang"][
"comment"] = $status[
"db"][
"comment"];
836 $status[
"contact"][
"status"] =
false;
837 $status[
"contact"][
"comment"] = $status[
"db"][
"comment"];
839 $status[
"proxy"][
"status"] =
false;
840 $status[
"proxy"][
"comment"] = $status[
"db"][
"comment"];
842 $status[
"nic"][
"status"] =
false;
843 $status[
"nic"][
"comment"] = $status[
"db"][
"comment"];
867 if (
$client->getSetting(
"setup_ok"))
869 $arr[
"status"] =
true;
874 $arr[
"status"] =
false;
875 $arr[
"comment"] = $this->lng->txt(
"setup_not_finished");
888 if (
$client->ini->readVariable(
"client",
"access") ==
"1")
890 $arr[
"status"] =
true;
891 $arr[
"comment"] = $this->lng->txt(
"online");
895 $arr[
"status"] =
false;
896 $arr[
"comment"] = $this->lng->txt(
"disabled");
909 if (!$arr[
"status"] =
$client->init())
911 $arr[
"comment"] =
$client->getError();
928 if (!$arr[
"status"] =
$client->db_exists)
930 $arr[
"comment"] = $this->lng->txt(
"no_database");
934 if (!$arr[
"status"] =
$client->db_installed)
936 $arr[
"comment"] = $this->lng->txt(
"db_not_installed");
944 include_once
"./Services/Database/classes/class.ilDBUpdate.php";
946 $this->lng->setDbHandler(
$client->db);
949 if (!$arr[
"status"] = $dbupdate->getDBVersionStatus())
951 $arr[
"comment"] = $this->lng->txt(
"db_needs_update");
952 $arr[
"update"] =
true;
955 else if ($dbupdate->hotfixAvailable())
957 $arr[
"status"] =
false;
958 $arr[
"comment"] = $this->lng->txt(
"hotfix_available");
959 $arr[
"update"] =
true;
962 else if ($dbupdate->customUpdatesAvailable())
964 $arr[
"status"] =
false;
965 $arr[
"comment"] = $this->lng->txt(
"custom_updates_available");
966 $arr[
"update"] =
true;
972 $cset = $ilDB->query(
"SELECT count(*) as cnt FROM ctrl_calls");
973 $crec = $ilDB->fetchAssoc($cset);
974 if ($crec[
"cnt"] == 0)
976 $arr[
"status"] =
false;
977 $arr[
"comment"] = $this->lng->txt(
"db_control_structure_missing");
978 $arr[
"update"] =
true;
993 require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
1000 $query =
"SELECT keyword, value FROM settings WHERE ".$db->in(
'keyword', $fields,
false,
'text');
1006 if(
$row[
'value'] !=
'' )
1011 if (count($rows) != count($fields))
1013 if($a_as_bool)
return false;
1014 $arr[
"status"] =
false;
1015 $arr[
"comment"] = $this->lng->txt(
"session_management_not_configured");
1019 if($a_as_bool)
return true;
1020 $arr[
"status"] =
true;
1021 $arr[
"comment"] = $this->lng->txt(
"session_management_configured");
1036 $fields = array(
'proxy_status',
'proxy_host',
'proxy_port');
1038 $query =
"SELECT keyword, value FROM settings WHERE ".$db->in(
'keyword', $fields,
false,
'text');
1041 $proxy_settings = array();
1042 $already_saved =
false;
1045 $already_saved =
true;
1046 $proxy_settings[
$row[
'keyword']] = $row[
'value'];
1051 $arr[
"status"] =
false;
1052 $arr[
"comment"] = $this->lng->txt(
"proxy");
1053 $arr[
"text"] = $this->lng->txt(
"proxy");
1055 else if((
bool)$proxy_settings[
"proxy_status"] ==
false)
1057 $arr[
"status"] =
true;
1058 $arr[
"comment"] = $this->lng->txt(
"proxy_disabled");
1059 $arr[
"text"] = $this->lng->txt(
"proxy_disabled");
1063 $arr[
"status"] =
true;
1064 $arr[
"comment"] = $this->lng->txt(
"proxy_activated_configurated");
1065 $arr[
"text"] = $this->lng->txt(
"proxy_activated_configurated");
1078 $installed_langs = $this->lng->getInstalledLanguages();
1080 $count = count($installed_langs);
1084 $arr[
"status"] =
false;
1085 $arr[
"comment"] = $this->lng->txt(
"lang_none_installed");
1089 $arr[
"status"] =
true;
1103 $arr[
"status"] =
true;
1106 $settings =
$client->getAllSettings();
1107 $client_name =
$client->getName();
1110 if (empty($settings[
"admin_firstname"]) or empty($settings[
"admin_lastname"]) or
1111 empty($settings[
"admin_email"]) or empty($client_name))
1113 $arr[
"status"] =
false;
1114 $arr[
"comment"] = $this->lng->txt(
"missing_data");
1118 if (!
ilUtil::is_email($settings[
"admin_email"]) and $arr[
"status"] !=
false)
1120 $arr[
"status"] =
false;
1121 $arr[
"comment"] = $this->lng->txt(
"email_not_valid");
1134 $settings =
$client->getAllSettings();
1136 if (!isset($settings[
"nic_enabled"]))
1138 $arr[
"status"] =
false;
1139 $arr[
"comment"] = $this->lng->txt(
"nic_not_disabled");
1143 $arr[
"status"] =
true;
1145 if ($settings[
"nic_enabled"] ==
"-1")
1147 $arr[
"comment"] = $this->lng->txt(
"nic_reg_failed");
1151 if (!$settings[
"nic_enabled"])
1153 $arr[
"comment"] = $this->lng->txt(
"nic_reg_disabled");
1157 $arr[
"comment"] = $this->lng->txt(
"nic_reg_enabled");
1158 if ($settings[
"inst_id"] <= 0)
1160 $arr[
"status"] =
false;
1191 return ($this->access_mode ==
"admin") ?
true :
false;
1203 if ($a_formdata[
"chk_datadir_path"] == 1)
1207 $this->error =
"create_datadir_failed";
1217 $this->error =
"create_webdir_failed";
1223 $log_path = substr($form_log_path,0,strrpos($form_log_path,
"/"));
1224 $log_file = substr($form_log_path,strlen($log_path)+1);
1226 $this->ini->setVariable(
"server",
"http_path",ILIAS_HTTP_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",
"java", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"java_path"])));
1234 $this->ini->setVariable(
"tools",
"htmldoc", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"htmldoc_path"])));
1236 $this->ini->setVariable(
"tools",
"ffmpeg", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"ffmpeg_path"])));
1238 $this->ini->setVariable(
"tools",
"vscantype", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"vscanner_type"])));
1239 $this->ini->setVariable(
"tools",
"scancommand", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"scan_command"])));
1240 $this->ini->setVariable(
"tools",
"cleancommand", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"clean_command"])));
1241 $this->ini->setVariable(
"setup",
"pass", md5($a_formdata[
"setup_pass"]));
1242 $this->ini->setVariable(
"log",
"path", $log_path);
1243 $this->ini->setVariable(
"log",
"file", $log_file);
1244 $this->ini->setVariable(
"log",
"enabled", ($a_formdata[
"chk_log_status"]) ?
"0" : 1);
1246 if (!$this->ini->write())
1248 $this->error = get_class($this).
": ".$this->ini->getError();
1254 $_SESSION[
"auth_path"] = ILIAS_HTTP_PATH;
1278 $clean_command = preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"clean_command"]));
1280 $this->ini->setVariable(
"tools",
"convert", $convert_path);
1281 $this->ini->setVariable(
"tools",
"zip", $zip_path);
1282 $this->ini->setVariable(
"tools",
"unzip", $unzip_path);
1283 $this->ini->setVariable(
"tools",
"java", $java_path);
1284 $this->ini->setVariable(
"tools",
"htmldoc", $htmldoc_path);
1286 $this->ini->setVariable(
"tools",
"ffmpeg", $ffmpeg_path);
1287 $this->ini->setVariable(
"tools",
"latex", $latex_url);
1288 $this->ini->setVariable(
"tools",
"fop", $fop_path);
1289 $this->ini->setVariable(
"tools",
"vscantype", $scan_type);
1290 $this->ini->setVariable(
"tools",
"scancommand", $scan_command);
1291 $this->ini->setVariable(
"tools",
"cleancommand", $clean_command);
1294 $log_path = substr($form_log_path,0,strrpos($form_log_path,
"/"));
1295 $log_file = substr($form_log_path,strlen($log_path)+1);
1297 $this->ini->setVariable(
"log",
"path", $log_path);
1298 $this->ini->setVariable(
"log",
"file", $log_file);
1299 $this->ini->setVariable(
"log",
"enabled", ($a_formdata[
"chk_log_status"]) ?
"0" : 1);
1300 $this->ini->setVariable(
"server",
"timezone",preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"time_zone"])));
1302 if (!$this->ini->write())
1304 $this->error = get_class($this).
": ".$this->ini->getError();
1319 if (!isset($a_formdata[
"chk_convert_path"]))
1324 if (($err = $this->
testConvert($convert_path)) !=
"")
1326 $this->error = $err;
1332 if (!isset($a_formdata[
"chk_zip_path"]))
1337 if (empty($zip_path))
1339 $this->error =
"no_path_zip";
1343 if (!$this->
testZip($zip_path))
1345 $this->error =
"check_failed_zip";
1351 if (!isset($a_formdata[
"chk_unzip_path"]))
1356 if (empty($unzip_path))
1358 $this->error =
"no_path_unzip";
1364 $this->error =
"check_failed_unzip";
1370 if (!isset($a_formdata[
"chk_java_path"]))
1375 if (empty($java_path))
1377 $this->error =
"no_path_java";
1383 $this->error =
"check_failed_java";
1389 if (!isset($a_formdata[
"chk_htmldoc_path"]))
1394 if (empty($htmldoc_path))
1396 $this->error =
"no_path_htmldoc";
1402 $this->error =
"check_failed_htmldoc";
1424 if (!isset($a_formdata[
"chk_ffmpeg_path"]))
1429 if (empty($ffmpeg_path))
1431 $this->error =
"no_path_ffmpeg";
1435 if (!$this->testFFMpeg($ffmpeg_path))
1437 $this->error =
"check_failed_ffmpeg";
1443 if (!isset($a_formdata[
"chk_latex_url"]))
1446 if (empty($latex_url))
1448 $this->error =
"no_latex_url";
1454 $this->error =
"check_failed_latex";
1472 if (empty($datadir_path))
1474 $this->error =
"no_path_datadir";
1481 if (strpos($datadir_path,$webspace_dir) !==
false)
1483 $this->error =
"datadir_webspacedir_match";
1488 if ($a_formdata[
"chk_datadir_path"] == 1)
1490 $dir_to_create = substr(strrchr($datadir_path,
"/"), 1);
1491 $dir_to_check = substr($datadir_path,0,- strlen($dir_to_create)-1);
1493 if (is_writable($datadir_path))
1495 $this->error =
"dir_exists_create";
1499 if (!is_writable($dir_to_check))
1501 $this->error =
"cannot_create_datadir_no_write_access";
1507 if (!is_writable($datadir_path))
1509 $this->error =
"cannot_create_datadir_no_write_access";
1524 if (!$a_formdata[
"setup_pass"])
1526 $this->error =
"no_setup_pass_given";
1530 if ($a_formdata[
"setup_pass"] != $a_formdata[
"setup_pass2"])
1532 $this->error =
"pass_does_not_match";
1547 if (!$a_formdata[
"chk_log_status"])
1552 if (empty($log_path))
1554 $this->error =
"no_path_log";
1558 if (!@touch($log_path))
1560 $this->error =
"could_not_create_logfile";
1574 if (empty($this->error))
1607 if (trim($a_convert_path) ==
"")
1609 return "no_path_convert";
1611 if (!is_file($a_convert_path))
1613 return "check_failed_convert";
1649 if (trim($a_java_path) ==
"")
1654 if (!is_file($a_java_path))
1656 return "check_failed_java";
1678 if (trim($a_latex_url) ==
"")
1684 include_once
"./setup/classes/class.ilHttpRequest.php";
1686 $result = @$http->downloadToString();
1687 if ((strpos((substr(
$result, 0, 5)),
"PNG") !== FALSE) || (strpos((substr(
$result, 0, 5)),
"GIF") !== FALSE))
1693 return "check_failed_latex";;
1705 if (trim($a_zip_path) ==
"")
1707 return "no_path_zip";
1709 if (!is_file($a_zip_path))
1711 return "check_failed_zip";
1758 if (trim($a_unzip_path) ==
"")
1760 return "no_path_unzip";
1762 if (!is_file($a_unzip_path))
1764 return "check_failed_unzip";
1804 if (trim($a_htmldoc_path) ==
"")
1809 if (!is_file($a_htmldoc_path))
1811 return "check_failed_htmldoc";
1821 $html =
"<html><head><title></title></head><body><p>test</p></body></html>";
1823 $html_file =
"htmldoc_test_file.html";
1825 $fp = fopen( $html_file ,
"wb");
1829 $htmldoc = $a_htmldoc_path.
" ";
1830 $htmldoc .=
"--no-toc ";
1831 $htmldoc .=
"--no-jpeg ";
1832 $htmldoc .=
"--webpage ";
1833 $htmldoc .=
"--outfile htmldoc_test_file.pdf ";
1834 $htmldoc .=
"--bodyfont Arial ";
1835 $htmldoc .=
"--charset iso-8859-15 ";
1836 $htmldoc .=
"--color ";
1837 $htmldoc .=
"--size A4 ";
1838 $htmldoc .=
"--format pdf ";
1839 $htmldoc .=
"--footer ... ";
1840 $htmldoc .=
"--header ... ";
1841 $htmldoc .=
"--left 60 ";
1843 $htmldoc .= $html_file;
1868 function unzip($a_file, $overwrite =
false)
1872 $pathinfo = pathinfo($a_file);
1873 $dir = $pathinfo[
"dirname"];
1874 $file = $pathinfo[
"basename"];
1879 $unzip = $this->ini->readVariable(
"tools",
"unzip");
1881 exec($unzipcmd, $arr);
1884 foreach($arr as $line)
1886 if(is_int(strpos($line,
"/")))
1888 $zdir = substr($line, 0, strrpos($line,
"/"));
1889 $nr = substr_count($zdir,
"/");
1893 $nr = substr_count($zdir,
"/");
1894 $zdirs[$zdir] = $nr;
1896 $zdir = substr($zdir, 0, strrpos($zdir,
"/"));
1903 foreach($zdirs as $zdir => $nr)
1929 require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
1931 $db = $this->client->getDB();
1936 foreach($setting_fields as $field)
1938 if( isset($session_settings[$field]) )
1940 $query =
"SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
1942 array(
'text',
'text'), array(
'common', $field));
1947 if( count(
$row) > 0 )
1952 'value' => array(
'text', $session_settings[$field])
1955 'module' => array(
'text',
'common'),
1956 'keyword' => array(
'text', $field)
1965 'module' => array(
'text',
'common'),
1966 'keyword' => array(
'text', $field),
1967 'value' => array(
'text', $session_settings[$field])
1976 if($i < 4) $message = $this->lng->txt(
"session_settings_not_saved");
1977 else $message = $this->lng->txt(
"settings_saved");
1989 require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
1991 $db = $this->client->getDB();
1995 $query =
"SELECT * FROM settings WHERE module = %s " .
1996 "AND ".$db->in(
'keyword', $setting_fields,
false,
'text');
2000 $session_settings = array();
2003 $session_settings[
$row[
'keyword']] = $row[
'value'];
2006 foreach( $setting_fields as $field )
2008 if( !isset($session_settings[$field]) )
2014 case 'session_max_count':
2019 case 'session_min_idle':
2024 case 'session_max_idle':
2029 case 'session_max_idle_after_first_request':
2034 case 'session_allow_client_maintenance':
2040 $session_settings[$field] = $value;
2044 return $session_settings;
2055 $source =
new ilClient($source_id, $this->db_connections);
2064 $this->error =
"Could not delete data dir $target->getDataDir()";
2071 $this->error =
"could_not_create_base_data_dir :".$target->getDataDir();
2076 if (!
ilUtil::rCopy($source->getDataDir(),$target->getDataDir())) {
2077 $this->error =
"clone_datadircopyfail";
2078 $target->ini->write();
2084 $this->error =
"Could not delete webspace dir $target->getWebspaceDir()";
2091 $this->error =
"could_not_create_base_webspace_dir :".$target->getWebspaceDir();
2096 if (!
ilUtil::rCopy($source->getWebspaceDir(),$target->getWebspaceDir())) {
2097 $this->error =
"clone_websipacedircopyfail";
2098 $target->ini->write();
2103 $target->ini->write();
2111 $this->error =
"Source database connection failed.";
2118 $this->error =
"Target database connection failed.";
2123 $srcTables = $source->db->query(
"SHOW TABLES");
2127 $tarTables = $target->db->query(
"SHOW TABLES");
2128 foreach($tarTables->fetchAll() as $cTable)
2130 $target->db->query(
"DROP TABLE IF EXISTS " . $cTable[0]);
2133 foreach($srcTables->fetchAll() as $cTable){
2134 $drop = $target->db->query(
"DROP TABLE IF EXISTS " . $cTable[0]);
2135 $create = $target->db->query(
"CREATE TABLE " . $cTable[0] .
" LIKE " . $source->getDbName() .
"." . $cTable[0]);
2139 $insert = $target->db->query(
"INSERT INTO " . $cTable[0] .
" SELECT * FROM ".$source->getDbName().
".".$cTable[0]);
2152 require_once
'./Services/Http/exceptions/class.ilProxyException.php';
2153 $settings =
$client->getAllSettings();
2155 if((
bool)$settings[
'proxy_status'] ==
true)
2164 require_once
'Services/PEAR/lib/Net/Socket.php';
2168 $response = $socket->connect($settings[
'proxy_host'], $settings[
'proxy_port']);
2169 if(!is_bool($response))
2172 throw new ilProxyException(strlen($response) ? $response : $lng->txt(
'proxy_not_connectable'));
2180 ilUtil::sendFailure($this->lng->txt(
'proxy_pear_net_socket_error').
': '.$e->getMessage());
2188 $db = $this->client->getDB();
2189 $proxy_fields = array(
'proxy_status',
'proxy_host',
'proxy_port');
2191 foreach($proxy_fields as $field)
2193 if( isset($proxy_settings[$field]) )
2195 $query =
"SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
2197 array(
'text',
'text'), array(
'common', $field));
2202 if( count(
$row) > 0 )
2207 'value' => array(
'text', $proxy_settings[$field])
2210 'module' => array(
'text',
'common'),
2211 'keyword' => array(
'text', $field)
2220 'module' => array(
'text',
'common'),
2221 'keyword' => array(
'text', $field),
2222 'value' => array(
'text', $proxy_settings[$field])
2237 return parent::getFileName();
2242 if(!parent::valid())
2246 if($this->isFile() and substr(parent::getFileName(),-4) ==
'.xml')
2250 if($this->isFile() and substr(parent::getFileName(),-8) !=
'_inserts')
2255 return $this->
valid();