4 include_once(
"./setup/classes/class.ilDBConnections.php");
85 define(
"ILIAS_MODULE",
"setup");
87 $this->auth = ($this->
checkAuth()) ?
true :
false;
88 $this->access_mode = $a_auth_type;
91 if ($this->safe_mode = ini_get(
"safe_mode")) {
96 $this->ini_file_path = ILIAS_ABSOLUTE_PATH .
"/ilias.ini.php";
97 $this->setup_defaults = ILIAS_ABSOLUTE_PATH .
"/setup/ilias.master.ini.php";
100 $this->ini_ilias_exists = $this->
init();
135 $this->client = $a_cl;
155 $this->ini =
new ilIniFile($this->ini_file_path);
157 if (!$this->ini->read()) {
158 $this->ini->GROUPS = parse_ini_file($this->setup_defaults,
true);
159 $this->error = get_class($this) .
": " . $this->ini->getError();
163 $this->setup_password = $this->ini->readVariable(
"setup",
"pass");
164 $this->default_client = $this->ini->readVariable(
"clients",
"default");
166 define(
"ILIAS_DATA_DIR", $this->ini->readVariable(
"clients",
"datadir"));
167 define(
"ILIAS_WEB_DIR", $this->ini->readVariable(
"clients",
"path"));
179 $_SESSION[
"ClientId"] = $this->client->getId();
182 if (!$this->client->create()) {
183 $this->error = $this->client->getError();
188 $this->ini_client_exists =
true;
203 if ($a_old_client_id != $this->client->getId()) {
206 ilUtil::delDir(ILIAS_ABSOLUTE_PATH .
"/" . ILIAS_WEB_DIR .
"/" . $a_old_client_id);
211 $this->ini_client_exists =
true;
222 if ($this->client->getDBSetup()->isDatabaseInstalled()) {
223 $this->error = $this->lng->txt(
"database_exists");
228 $db_setup = $this->client->getDBSetup();
229 return $db_setup->createDatabase($a_collation);
239 if (!$this->client->getDBSetup()->isDatabaseConnectable()) {
243 if ($this->client->getDBSetup()->installDatabase()) {
244 $this->client->db_installed =
true;
259 $a = @file_exists($this->INI_FILE);
271 if (is_writable(
".")) {
272 $arr[
"status"] =
true;
275 $arr[
"comment"] = getcwd();
278 $arr[
"status"] =
false;
279 $arr[
"comment"] = $this->lng->txt(
"pre_folder_write_error");
282 $arr[
"comment"] = getcwd() .
": " . $arr[
"comment"];
297 if (@mkdir($a_dir .
"/crst879dldsk9d", 0774)) {
298 $arr[
"status"] =
true;
299 $arr[
"comment"] =
"";
301 @rmdir($a_dir .
"/crst879dldsk9d");
303 $arr[
"status"] =
false;
306 $arr[
"comment"] = getcwd() .
": " . $this->lng->txt(
"pre_folder_create_error");
321 if ($sess->usesCookies) {
322 $arr[
"status"] =
true;
323 $arr[
"comment"] =
"";
325 $arr[
"status"] =
false;
326 $arr[
"comment"] = $this->lng->txt(
"pre_cookies_disabled");
340 $arr[
"status"] =
true;
341 $arr[
"comment"] =
"PHP " .
$version;
342 if (version_compare(
$version,
'5.3.0',
'<')) {
343 $arr[
"status"] =
false;
344 $arr[
"comment"] =
"PHP " .
$version .
". " . $this->lng->txt(
"pre_php_version_too_low");
358 if (function_exists(
"mysql_query")) {
359 $arr[
"status"] =
true;
360 $arr[
"comment"] = $this->lng->txt(
"pre_mysql_4_1_or_higher");
362 $arr[
"status"] =
false;
363 $arr[
"comment"] = $this->lng->txt(
"pre_mysql_missing");
391 if (class_exists(
"DOMDocument")) {
392 $arr[
"status"] =
true;
394 $arr[
"status"] =
false;
395 $arr[
"comment"] = $this->lng->txt(
"pre_dom_missing");
409 if (class_exists(
"XSLTProcessor")) {
410 $arr[
"status"] =
true;
412 $arr[
"status"] =
false;
413 $arr[
"comment"] = sprintf(
414 $this->lng->txt(
"pre_xsl_missing"),
415 "http://php.net/manual/en/book.xsl.php" 430 if (function_exists(
"imagefill") && function_exists(
"imagecolorallocate")) {
431 $arr[
"status"] =
true;
433 $arr[
"status"] =
false;
434 $arr[
"comment"] = sprintf(
435 $this->lng->txt(
"pre_gd_missing"),
436 "http://php.net/manual/en/book.image.php" 451 $limit = ini_get(
"memory_limit");
454 if (is_int(strpos($limit,
"M"))) {
455 $limit_n = (int) $limit;
462 $arr[
"status"] =
true;
463 $arr[
"comment"] = $limit .
". " . $this->lng->txt(
"pre_memory_limit_recommend");
465 $arr[
"status"] =
false;
466 $arr[
"comment"] = $limit .
". " . $this->lng->txt(
"pre_memory_limit_too_low");
480 if (version_compare(PHP_VERSION,
'7.0.0',
'>=')) {
481 $arr[
"status"] =
true;
487 $load_comments = ini_get(
"opcache.load_comments");
488 if ($load_comments == 1) {
489 $arr[
"status"] =
true;
491 $arr[
"status"] =
false;
492 $arr[
"comment"] = $this->lng->txt(
"pre_opcache_comments");
533 foreach ($this->preliminaries_result as $val) {
534 if ($val[
"status"] ===
false) {
535 $this->preliminaries =
false;
548 return $this->ini->readVariable(
'setup',
'pass');
557 $this->ini->setVariable(
'setup',
'pass', $this->passwordManager->encodePassword($raw));
559 if ($this->ini->write() ==
false) {
560 $this->error = $this->ini->getError();
574 $passwordReHashCallback =
function ($raw) {
578 return $this->passwordManager->verifyPassword(
581 $passwordReHashCallback
594 if (empty($a_auth_data[
"client_id"])) {
595 $this->error =
"no_client_id";
599 if (empty($a_auth_data[
"username"])) {
600 $this->error =
"no_username";
604 if (empty($a_auth_data[
"password"])) {
605 $this->error =
"no_password";
609 if (!$this->
newClient($a_auth_data[
"client_id"])) {
610 $this->error =
"unknown_client_id";
611 unset($this->client);
615 if (!$this->client->db_exists) {
616 $this->error =
"no_db_connect_consult_admin";
617 unset($this->client);
621 $s1 = $this->client->db->query(
"SELECT value from settings WHERE keyword = " .
622 $this->client->db->quote(
'system_role_id',
'text'));
623 $r1 = $this->client->db->fetchAssoc($s1);
624 $system_role_id = $r1[
"value"];
627 if ($this->client->db->tableColumnExists(
'usr_data',
'passwd_enc_type')) {
628 $add_usrfields .=
' , usr_data.passwd_enc_type, usr_data.passwd_salt ';
630 $q =
"SELECT usr_data.usr_id, usr_data.passwd $add_usrfields " .
632 "LEFT JOIN rbac_ua ON rbac_ua.usr_id=usr_data.usr_id " .
633 "WHERE rbac_ua.rol_id = " . $this->client->db->quote((
int) $system_role_id,
'integer') .
" " .
634 "AND usr_data.login=" . $this->client->db->quote($a_auth_data[
"username"],
'text');
635 $r = $this->client->db->query($q);
636 if (!$this->client->db->numRows(
$r)) {
637 $this->error =
'login_invalid';
641 $data = $this->client->db->fetchAssoc(
$r);
643 global $ilClientIniFile;
645 $ilClientIniFile = $this->client->ini;
647 require_once
'Services/User/classes/class.ilUserPasswordManager.php';
650 require_once
'setup/classes/class.ilObjSetupUser.php';
653 $user->setPasswordEncodingType(
$data[
'passwd_enc_type']);
658 $password_valid =
$data[
'passwd'] == md5($a_auth_data[
'password']);
661 if ($password_valid) {
664 $_SESSION[
'auth_path'] = ILIAS_HTTP_PATH;
666 $_SESSION[
'ClientId'] = $this->client->getId();
669 $this->error =
'login_invalid';
682 $passwordReHashCallback =
function ($raw) {
686 if ($this->passwordManager->verifyPassword($this->getMasterPassword(), $raw, $passwordReHashCallback)) {
688 $_SESSION[
'auth_path'] = ILIAS_HTTP_PATH;
707 $this->client =
new ilClient($a_client_id, $this->db_connections);
709 if (!$this->client->init()) {
711 $this->error = get_class($this) .
": " . $this->client->getError();
729 if ($this->ini_client_exists) {
739 if ($status[
"db"][
"status"] ===
false and $status[
"db"][
"update"] !==
true) {
742 $status[
"lang"][
"status"] =
false;
743 $status[
"lang"][
"comment"] = $status[
"db"][
"comment"];
744 $status[
"contact"][
"status"] =
false;
745 $status[
"contact"][
"comment"] = $status[
"db"][
"comment"];
747 $status[
"proxy"][
"status"] =
false;
748 $status[
"proxy"][
"comment"] = $status[
"db"][
"comment"];
750 $status[
"nic"][
"status"] =
false;
751 $status[
"nic"][
"comment"] = $status[
"db"][
"comment"];
773 if (
$client->getSetting(
"setup_ok")) {
774 $arr[
"status"] =
true;
777 $arr[
"status"] =
false;
778 $arr[
"comment"] = $this->lng->txt(
"setup_not_finished");
791 if (
$client->ini->readVariable(
"client",
"access") ==
"1") {
792 $arr[
"status"] =
true;
793 $arr[
"comment"] = $this->lng->txt(
"online");
795 $arr[
"status"] =
false;
796 $arr[
"comment"] = $this->lng->txt(
"disabled");
809 if (!$arr[
"status"] =
$client->init()) {
810 $arr[
"comment"] =
$client->getError();
827 if (!$arr[
"status"] = $client->db_exists) {
828 $arr[
"comment"] = $this->lng->txt(
"no_database");
833 if (!$arr[
"status"] = $client->db_installed) {
834 $arr[
"comment"] = $this->lng->txt(
"db_not_installed");
839 $client->setup_ok = (bool) $client->
getSetting(
"setup_ok");
841 include_once
"./Services/Database/classes/class.ilDBUpdate.php";
842 $this->lng->setDbHandler($client->db);
845 if (!$arr[
"status"] = $dbupdate->getDBVersionStatus()) {
846 $arr[
"comment"] = $this->lng->txt(
"db_needs_update");
847 $arr[
"update"] =
true;
851 if ($dbupdate->hotfixAvailable()) {
852 $arr[
"status"] =
false;
853 $arr[
"comment"] = $this->lng->txt(
"hotfix_available");
854 $arr[
"update"] =
true;
858 if ($dbupdate->customUpdatesAvailable()) {
859 $arr[
"status"] =
false;
860 $arr[
"comment"] = $this->lng->txt(
"custom_updates_available");
861 $arr[
"update"] =
true;
870 $cset = $ilDB->query(
"SELECT count(*) as cnt FROM ctrl_calls");
871 $crec = $ilDB->fetchAssoc($cset);
873 if ($crec[
"cnt"] == 0) {
874 $arr[
"status"] =
false;
875 $arr[
"comment"] = $this->lng->txt(
"db_control_structure_missing");
876 $arr[
"update"] =
true;
891 require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
898 $query =
"SELECT keyword, value FROM settings WHERE " .
$db->in(
'keyword', $fields,
false,
'text');
903 if (
$row[
'value'] !=
'') {
910 if (count(
$rows) != count($fields)) {
914 $arr[
"status"] =
false;
915 $arr[
"comment"] = $this->lng->txt(
"session_management_not_configured");
920 $arr[
"status"] =
true;
921 $arr[
"comment"] = $this->lng->txt(
"session_management_configured");
937 $fields = array(
'proxy_status',
'proxy_host',
'proxy_port' );
939 $query =
"SELECT keyword, value FROM settings WHERE " . $ilDB->in(
'keyword', $fields,
false,
'text');
942 $proxy_settings = array();
943 $already_saved =
false;
944 while (
$row = $ilDB->fetchAssoc(
$res)) {
945 $already_saved =
true;
946 $proxy_settings[
$row[
'keyword']] = $row[
'value'];
949 if (!$already_saved) {
950 $arr[
"status"] =
false;
951 $arr[
"comment"] = $this->lng->txt(
"proxy");
952 $arr[
"text"] = $this->lng->txt(
"proxy");
954 if ((
bool) $proxy_settings[
"proxy_status"] ==
false) {
955 $arr[
"status"] =
true;
956 $arr[
"comment"] = $this->lng->txt(
"proxy_disabled");
957 $arr[
"text"] = $this->lng->txt(
"proxy_disabled");
959 $arr[
"status"] =
true;
960 $arr[
"comment"] = $this->lng->txt(
"proxy_activated_configurated");
961 $arr[
"text"] = $this->lng->txt(
"proxy_activated_configurated");
976 $installed_langs = $this->lng->getInstalledLanguages();
978 $count = count($installed_langs);
981 $arr[
"status"] =
false;
982 $arr[
"comment"] = $this->lng->txt(
"lang_none_installed");
984 $arr[
"status"] =
true;
998 $arr[
"status"] =
true;
1001 $settings =
$client->getAllSettings();
1002 $client_name =
$client->getName();
1005 if (empty($settings[
"admin_firstname"])
or empty($settings[
"admin_lastname"])
or 1006 empty($settings[
"admin_email"])
or empty($client_name)) {
1007 $arr[
"status"] =
false;
1008 $arr[
"comment"] = $this->lng->txt(
"missing_data");
1013 $arr[
"status"] =
false;
1014 $arr[
"comment"] = $this->lng->txt(
"email_not_valid");
1027 $settings =
$client->getAllSettings();
1029 if (!isset($settings[
"nic_enabled"])) {
1030 $arr[
"status"] =
false;
1031 $arr[
"comment"] = $this->lng->txt(
"nic_not_disabled");
1035 $arr[
"status"] =
true;
1037 if ($settings[
"nic_enabled"] ==
"-1") {
1038 $arr[
"comment"] = $this->lng->txt(
"nic_reg_failed");
1042 if (!$settings[
"nic_enabled"]) {
1043 $arr[
"comment"] = $this->lng->txt(
"nic_reg_disabled");
1045 $arr[
"comment"] = $this->lng->txt(
"nic_reg_enabled");
1046 if ($settings[
"inst_id"] <= 0) {
1047 $arr[
"status"] =
false;
1078 return ($this->access_mode ==
"admin") ? true :
false;
1090 if ($a_formdata[
"chk_datadir_path"] == 1) {
1092 $this->error =
"create_datadir_failed";
1098 if (!@file_exists(ILIAS_ABSOLUTE_PATH .
"/" . $this->ini->readVariable(
"clients",
"path"))
and !@is_dir(ILIAS_ABSOLUTE_PATH .
"/" . $this->ini->readVariable(
"clients",
"path"))) {
1099 if (!
ilUtil::makeDir(ILIAS_ABSOLUTE_PATH .
"/" . $this->ini->readVariable(
"clients",
"path"))) {
1100 $this->error =
"create_webdir_failed";
1106 $log_path = substr($form_log_path, 0, strrpos($form_log_path,
"/"));
1107 $log_file = substr($form_log_path, strlen($log_path) + 1);
1110 $this->ini->setVariable(
"server",
"http_path", ILIAS_HTTP_PATH);
1111 $this->ini->setVariable(
"server",
"absolute_path", ILIAS_ABSOLUTE_PATH);
1112 $this->ini->setVariable(
"server",
"timezone", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"time_zone"])));
1113 $this->ini->setVariable(
"clients",
"datadir", $datadir_path);
1114 $this->ini->setVariable(
"tools",
"convert", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"convert_path"])));
1115 $this->ini->setVariable(
"tools",
"zip", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"zip_path"])));
1116 $this->ini->setVariable(
"tools",
"unzip", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"unzip_path"])));
1117 $this->ini->setVariable(
"tools",
"ghostscript", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"ghostscript_path"])));
1118 $this->ini->setVariable(
"tools",
"java", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"java_path"])));
1120 $this->ini->setVariable(
"tools",
"ffmpeg", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"ffmpeg_path"])));
1122 $this->ini->setVariable(
"tools",
"vscantype", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"vscanner_type"])));
1123 $this->ini->setVariable(
"tools",
"scancommand", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"scan_command"])));
1124 $this->ini->setVariable(
"tools",
"cleancommand", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"clean_command"])));
1125 $this->ini->setVariable(
"tools",
"enable_system_styles_management", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"enable_system_styles_management"])));
1126 $this->ini->setVariable(
"tools",
"lessc", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"lessc_path"])));
1127 $this->ini->setVariable(
"tools",
"phantomjs", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"phantomjs_path"])));
1129 $this->ini->setVariable(
'setup',
'pass', $this->passwordManager->encodePassword($a_formdata[
'setup_pass']));
1130 $this->ini->setVariable(
"log",
"path", $log_path);
1131 $this->ini->setVariable(
"log",
"file", $log_file);
1132 $this->ini->setVariable(
"log",
"enabled", ($a_formdata[
"chk_log_status"]) ?
"0" : 1);
1133 $this->ini->setVariable(
"log",
"error_path", $error_log_path);
1135 $this->ini->setVariable(
"https",
"auto_https_detect_enabled", ($a_formdata[
"auto_https_detect_enabled"]) ? 1 : 0);
1136 $this->ini->setVariable(
"https",
"auto_https_detect_header_name", $a_formdata[
"auto_https_detect_header_name"]);
1137 $this->ini->setVariable(
"https",
"auto_https_detect_header_value", $a_formdata[
"auto_https_detect_header_value"]);
1139 if (!$this->ini->write()) {
1140 $this->error = get_class($this) .
": " . $this->ini->getError();
1146 $_SESSION[
"auth_path"] = ILIAS_HTTP_PATH;
1159 $convert_path = preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"convert_path"]));
1162 $ghostscript_path = preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"ghostscript_path"]));
1169 $scan_command = preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"scan_command"]));
1170 $clean_command = preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"clean_command"]));
1171 $enable_system_styles_management = preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"enable_system_styles_management"]));
1173 $phantomjs_path = preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"phantomjs_path"]));
1175 $this->ini->setVariable(
"tools",
"convert", $convert_path);
1176 $this->ini->setVariable(
"tools",
"zip", $zip_path);
1177 $this->ini->setVariable(
"tools",
"unzip", $unzip_path);
1178 $this->ini->setVariable(
"tools",
"ghostscript", $ghostscript_path);
1179 $this->ini->setVariable(
"tools",
"java", $java_path);
1181 $this->ini->setVariable(
"tools",
"ffmpeg", $ffmpeg_path);
1182 $this->ini->setVariable(
"tools",
"latex", $latex_url);
1183 $this->ini->setVariable(
"tools",
"fop", $fop_path);
1184 $this->ini->setVariable(
"tools",
"vscantype", $scan_type);
1185 $this->ini->setVariable(
"tools",
"scancommand", $scan_command);
1186 $this->ini->setVariable(
"tools",
"cleancommand", $clean_command);
1187 $this->ini->setVariable(
"tools",
"lessc", $lessc_path);
1188 $this->ini->setVariable(
"tools",
"enable_system_styles_management", $enable_system_styles_management);
1189 $this->ini->setVariable(
"tools",
"phantomjs", $phantomjs_path);
1192 $log_path = substr($form_log_path, 0, strrpos($form_log_path,
"/"));
1193 $log_file = substr($form_log_path, strlen($log_path) + 1);
1197 $this->ini->setVariable(
"log",
"path", $log_path);
1198 $this->ini->setVariable(
"log",
"file", $log_file);
1199 $this->ini->setVariable(
"log",
"enabled", ($a_formdata[
"chk_log_status"]) ?
"0" : 1);
1200 $this->ini->setVariable(
"log",
"error_path", $error_log_path);
1201 $this->ini->setVariable(
"server",
"timezone", preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"time_zone"])));
1203 $this->ini->setVariable(
"https",
"auto_https_detect_enabled", ($a_formdata[
"auto_https_detect_enabled"]) ? 1 : 0);
1204 $this->ini->setVariable(
"https",
"auto_https_detect_header_name", $a_formdata[
"auto_https_detect_header_name"]);
1205 $this->ini->setVariable(
"https",
"auto_https_detect_header_value", $a_formdata[
"auto_https_detect_header_value"]);
1207 if (!$this->ini->write()) {
1208 $this->error = get_class($this) .
": " . $this->ini->getError();
1223 if (!isset($a_formdata[
"chk_convert_path"])) {
1225 $convert_path = preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"convert_path"]));
1227 if (($err = $this->
testConvert($convert_path)) !=
"") {
1228 $this->error = $err;
1234 if (!isset($a_formdata[
"chk_zip_path"])) {
1238 if (empty($zip_path)) {
1239 $this->error =
"no_path_zip";
1243 if (!$this->
testZip($zip_path)) {
1244 $this->error =
"check_failed_zip";
1250 if (!isset($a_formdata[
"chk_unzip_path"])) {
1254 if (empty($unzip_path)) {
1255 $this->error =
"no_path_unzip";
1260 $this->error =
"check_failed_unzip";
1266 if (!isset($a_formdata[
"chk_ghostscript_path"])) {
1268 $ghostscript_path = preg_replace(
"/\\\\/",
"/",
ilUtil::stripSlashes($a_formdata[
"ghostscript_path"]));
1271 $this->error = $err;
1277 if (!isset($a_formdata[
"chk_java_path"])) {
1281 if (empty($java_path)) {
1282 $this->error =
"no_path_java";
1286 if (!$this->
testJava($java_path)) {
1287 $this->error =
"check_failed_java";
1304 if (!isset($a_formdata[
"chk_ffmpeg_path"])) {
1308 if (empty($ffmpeg_path)) {
1309 $this->error =
"no_path_ffmpeg";
1313 if (!$this->testFFMpeg($ffmpeg_path)) {
1314 $this->error =
"check_failed_ffmpeg";
1320 if (!isset($a_formdata[
"chk_latex_url"])) {
1322 if (empty($latex_url)) {
1323 $this->error =
"no_latex_url";
1328 $this->error =
"check_failed_latex";
1346 if (empty($datadir_path)) {
1347 $this->error =
"no_path_datadir";
1351 $webspace_dir = ILIAS_ABSOLUTE_PATH .
"/data";
1354 if (strpos($datadir_path, $webspace_dir) !==
false) {
1355 $this->error =
"datadir_webspacedir_match";
1360 if ($a_formdata[
"chk_datadir_path"] == 1) {
1361 $dir_to_create = substr(strrchr($datadir_path,
"/"), 1);
1362 $dir_to_check = substr($datadir_path, 0, -strlen($dir_to_create) - 1);
1365 $this->error =
"cannot_create_datadir_inside_webdir";
1369 if (is_writable($datadir_path)) {
1370 $this->error =
"dir_exists_create";
1374 if (!is_writable($dir_to_check)) {
1375 $this->error =
"cannot_create_datadir_no_write_access";
1380 $this->error =
"cannot_create_datadir_inside_webdir";
1384 if (!is_writable($datadir_path)) {
1385 $this->error =
"cannot_create_datadir_no_write_access";
1400 if (!$a_formdata[
"setup_pass"]) {
1401 $this->error =
"no_setup_pass_given";
1405 if ($a_formdata[
"setup_pass"] != $a_formdata[
"setup_pass2"]) {
1406 $this->error =
"pass_does_not_match";
1421 if (!$a_formdata[
"chk_log_status"]) {
1425 if (empty($log_path)) {
1426 $this->error =
"no_path_log";
1430 if (is_dir($log_path)) {
1431 $this->error =
'could_not_create_logfile';
1436 $this->error =
"cannot_create_logdir_inside_webdir";
1440 if (!@touch($log_path)) {
1441 $this->error =
"could_not_create_logfile";
1461 if (!empty($clean_error_log_path)) {
1463 $this->error =
"could_not_create_error_directory";
1477 if (empty($this->error)) {
1509 if (trim($a_convert_path) ==
"") {
1510 return "no_path_convert";
1512 if (!is_file($a_convert_path)) {
1513 return "check_failed_convert";
1528 if (trim($a_ghostscript_path) ==
"") {
1531 if (!is_file($a_ghostscript_path)) {
1532 return "check_failed_ghostscript";
1547 if (trim($a_java_path) ==
"") {
1551 if (!is_file($a_java_path)) {
1552 return "check_failed_java";
1574 if (trim($a_latex_url) ==
"") {
1579 include_once
"./setup/classes/class.ilHttpRequest.php";
1582 if ((strpos((substr(
$result, 0, 5)),
"PNG") !==
false) || (strpos((substr(
$result, 0, 5)),
"GIF") !==
false)) {
1585 return "check_failed_latex";
1598 if (trim($a_zip_path) ==
"") {
1599 return "no_path_zip";
1601 if (!is_file($a_zip_path)) {
1602 return "check_failed_zip";
1649 if (trim($a_unzip_path) ==
"") {
1650 return "no_path_unzip";
1652 if (!is_file($a_unzip_path)) {
1653 return "check_failed_unzip";
1690 public function unzip($a_file, $overwrite =
false)
1694 $pathinfo = pathinfo($a_file);
1695 $dir = $pathinfo[
"dirname"];
1696 $file = $pathinfo[
"basename"];
1701 $unzip = $this->ini->readVariable(
"tools",
"unzip");
1703 exec($unzipcmd, $arr);
1706 foreach ($arr as $line) {
1707 if (is_int(strpos($line,
"/"))) {
1708 $zdir = substr($line, 0, strrpos($line,
"/"));
1709 $nr = substr_count($zdir,
"/");
1711 while ($zdir !=
"") {
1712 $nr = substr_count($zdir,
"/");
1713 $zdirs[$zdir] = $nr;
1715 $zdir = substr($zdir, 0, strrpos($zdir,
"/"));
1722 foreach ($zdirs as $zdir => $nr) {
1744 require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
1746 $db = $this->client->getDB();
1751 foreach ($setting_fields as $field) {
1752 if (isset($session_settings[$field])) {
1753 $query =
"SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
1756 array(
'text',
'text'),
1757 array(
'common', $field)
1765 if (count(
$row) > 0) {
1769 'value' => array(
'text', $session_settings[$field])
1772 'module' => array(
'text',
'common'),
1773 'keyword' => array(
'text', $field)
1780 'module' => array(
'text',
'common'),
1781 'keyword' => array(
'text', $field),
1782 'value' => array(
'text', $session_settings[$field])
1792 $message = $this->lng->txt(
"session_settings_not_saved");
1794 $message = $this->lng->txt(
"settings_saved");
1807 require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
1809 $db = $this->client->getDB();
1813 $query =
"SELECT * FROM settings WHERE module = %s " .
1814 "AND " .
$db->in(
'keyword', $setting_fields,
false,
'text');
1818 $session_settings = array();
1820 $session_settings[
$row[
'keyword']] = $row[
'value'];
1823 foreach ($setting_fields as $field) {
1824 if (!isset($session_settings[$field])) {
1828 case 'session_max_count':
1833 case 'session_min_idle':
1838 case 'session_max_idle':
1843 case 'session_max_idle_after_first_request':
1848 case 'session_allow_client_maintenance':
1854 $session_settings[$field] = $value;
1858 return $session_settings;
1878 $this->error =
"Could not delete data dir $target->getDataDir()";
1884 $this->error =
"could_not_create_base_data_dir :" .
$target->getDataDir();
1890 $this->error =
"clone_datadircopyfail";
1897 $this->error =
"Could not delete webspace dir $target->getWebspaceDir()";
1903 $this->error =
"could_not_create_base_webspace_dir :" .
$target->getWebspaceDir();
1909 $this->error =
"clone_websipacedircopyfail";
1922 $this->error =
"Source database connection failed.";
1928 $this->error =
"Target database connection failed.";
1933 $srcTables =
$source->db->query(
"SHOW TABLES");
1937 $tarTables =
$target->db->query(
"SHOW TABLES");
1938 foreach ($tarTables->fetchAll() as $cTable) {
1939 $target->db->query(
"DROP TABLE IF EXISTS " . $cTable[0]);
1942 foreach ($srcTables->fetchAll() as $cTable) {
1943 $drop =
$target->db->query(
"DROP TABLE IF EXISTS " . $cTable[0]);
1944 $create =
$target->db->query(
"CREATE TABLE " . $cTable[0] .
" LIKE " .
$source->getDbName() .
"." . $cTable[0]);
1948 $insert =
$target->db->query(
"INSERT INTO " . $cTable[0] .
" SELECT * FROM " .
$source->getDbName() .
"." . $cTable[0]);
1951 $target->db->query(
"UPDATE settings SET VALUE = " .
$target->db->quote(0,
"integer") .
" WHERE keyword = " .
$target->db->quote(
"inst_id",
"text"));
1952 $target->db->query(
"UPDATE settings SET VALUE = " .
$target->db->quote(0,
"integer") .
" WHERE keyword = " .
$target->db->quote(
"nic_enabled",
"text"));
1964 require_once
'./Services/Http/exceptions/class.ilProxyException.php';
1965 $settings =
$client->getAllSettings();
1967 if ((
bool) $settings[
'proxy_status'] ==
true) {
1970 $wait_timeout = 100;
1972 $fp = @fsockopen($settings[
'proxy_host'], $settings[
'proxy_port'], $err_code, $err_str, $wait_timeout);
1980 ilUtil::sendSuccess($this->lng->txt(
'proxy_connectable'));
1989 $db = $this->client->getDB();
1990 $proxy_fields = array(
'proxy_status',
'proxy_host',
'proxy_port');
1992 foreach ($proxy_fields as $field) {
1993 if (isset($proxy_settings[$field])) {
1994 $query =
"SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
1997 array(
'text',
'text'),
1998 array(
'common', $field)
2006 if (is_array(
$row) && count(
$row) > 0) {
2010 'value' => array(
'text', $proxy_settings[$field])
2013 'module' => array(
'text',
'common'),
2014 'keyword' => array(
'text', $field)
2021 'module' => array(
'text',
'common'),
2022 'keyword' => array(
'text', $field),
2023 'value' => array(
'text', $proxy_settings[$field])
2036 $ini_get = ini_get(
'opcache.enable');
2038 return ($ini_get === 1
or $ini_get ===
'1' or strtolower($ini_get) ===
'on');
2049 if (!preg_match(
"/^[A-Za-z0-9]+$/", $a_client_id)) {
2064 $other_directory = $other_directory .
"/";
2066 return !(strpos($directory, $other_directory) !== 0);
const DEFAULT_MAX_COUNT
default value for settings that have not been defined in setup or administration yet ...
static makeDirParents($a_dir)
Create a new directory and all parent directories.
isAuthenticated()
check if current user is authenticated
checkClientIni(&$client)
check client ini status
isDirectoryInOther($directory, $other_directory)
Checks if directory is subdirectory of other directory.
getStatus($client=0)
coumpute client status
checkClientLanguages(ilClient $client)
checkCreatable($a_dir=".")
check for permission to create new folders in specified directory
Administrates DB connections in setup.
queryPreliminaries()
preliminaries
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static is_email($a_email, ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid.
cloneFromSource($source_id)
Clone source client into current client.
checkLogSetup($a_formdata)
check log path
checkWritable()
check for writable directory
isAdmin()
check if current user is admin
testLatex($a_latex_url)
Check latex cgi script.
checkPreliminaries()
check all prliminaries
loginAsAdmin(string $raw)
Process setup admin login.
updateNewClient($a_old_client_id)
update client.ini & move data dirs does not work correctly at this time - DISABLED ...
saveProxySettings($proxy_settings)
checkMemoryLimit()
Check Memory Limit.
static getSettingFields()
returns the array of setting fields
Class for proxy related exception handling in ILIAS.
checkIniFileExists()
check if inifile exists
testZip($a_zip_path)
Check zip program.
unzip($a_file, $overwrite=false)
unzip file
testJava($a_java_path)
Check JVM.
checkClientDatabase(ilClient $client)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
createDatabase($a_collation="")
create client database
testConvert($a_convert_path)
Check convert program.
isInstalled()
check if client's db is installed
catch(Exception $e) $message
checkErrorLogSetup($error_log_path)
check error log path
foreach($_POST as $key=> $value) $res
deleteTrailingSlash($a_path)
delete trailing slash of path variables
checkClientContact(&$client)
check client contact data status
installDatabase()
set the database data
checkPasswordSetup($a_formdata)
check setup password
setSessionSettings($session_settings)
saves session settings to db
loginAsClient($a_auth_data)
process client login
checkCookiesEnabled()
check cookies enabled
saveMasterSetup($a_formdata)
saves intial settings
printProxyStatus($client)
Print proxy settings.
static createDirectory($a_dir, $a_mod=0755)
create directory
init()
init setup load settings from ilias.ini if exists and sets some constants
getError()
get Error message
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
newClient($a_client_id=0)
creates a client object in $this->client
updateMasterSettings($a_formdata)
updates settings
Class ilObjSetupUser A class derived from ilObjUser for authentication purposes in the ILIAS setup...
getSessionSettings()
reads session settings from db
checkToolsSetup($a_formdata)
check pathes to 3rd party software
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
checkFinish(&$client)
check if client setup was finished
storeMasterPassword(string $raw)
verifyMasterPassword(string $raw)
__construct(\ilSetupPasswordManager $passwordManager, $a_auth, $a_auth_type)
constructor
isValidClientId($a_client_id)
Is valid client id.
checkAuth()
check authentication status
checkClientNIC(&$client)
check client nic status
testGhostscript($a_ghostscript_path)
Check ghostscript program.
static escapeShellArg($a_arg)
getSetting($a_keyword)
read one value from settings table
checkPHPVersion()
check for PHP version
checkClientProxySettings(ilClient $client)
checkClientSessionSettings(&$client, $a_as_bool=false)
check client session config status
const DEFAULT_ALLOW_CLIENT_MAINTENANCE
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
checkAccess(&$client)
check client access status
static getInstance()
Single method to reduce footprint (included files, created instances)
const DEFAULT_MAX_IDLE_AFTER_FIRST_REQUEST
testUnzip($a_unzip_path)
Check unzip program.
checkDataDirSetup($a_formdata)
check datadir path
Class ilSetupPasswordManager.
saveNewClient()
saves client.ini & updates client list in ilias.ini