ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilSetup Class Reference

Setup class. More...

+ Collaboration diagram for ilSetup:

Public Member Functions

 __construct (\ilSetupPasswordManager $passwordManager, $a_auth, $a_auth_type)
 constructor More...
 
 setClient ($a_cl)
 
 getClient ()
 
 init ()
 init setup load settings from ilias.ini if exists and sets some constants More...
 
 saveNewClient ()
 saves client.ini & updates client list in ilias.ini More...
 
 updateNewClient ($a_old_client_id)
 update client.ini & move data dirs does not work correctly at this time - DISABLED More...
 
 createDatabase ($a_collation="")
 create client database More...
 
 installDatabase ()
 set the database data More...
 
 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...
 
 getMasterPassword ()
 
 storeMasterPassword (string $raw)
 
 verifyMasterPassword (string $raw)
 
 loginAsClient ($a_auth_data)
 process client login More...
 
 loginAsAdmin (string $raw)
 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 (ilClient $client)
 
 checkClientSessionSettings (&$client, $a_as_bool=false)
 check client session config status More...
 
 checkClientProxySettings (ilClient $client)
 
 checkClientLanguages (ilClient $client)
 
 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...
 
 checkErrorLogSetup ($error_log_path)
 check error 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...
 
 unzip ($a_file, $overwrite=false)
 unzip file More...
 
 setSessionSettings ($session_settings)
 saves session settings to db More...
 
 getSessionSettings ()
 reads session settings from db More...
 
 cloneFromSource ($source_id)
 Clone source client into current client. More...
 
 printProxyStatus ($client)
 Print proxy settings. More...
 
 saveProxySettings ($proxy_settings)
 
 hasOpCacheEnabled ()
 
 isValidClientId ($a_client_id)
 Is valid client id. More...
 

Data Fields

 $ini
 
 $ini_file_path
 
 $error = ""
 
 $ini_ilias_exists = false
 
 $ini_client_exists = false
 
 $setup_defaults
 
 $ilias_nic_server = "https://nic.ilias.de/index.php"
 
 $preliminaries_result = array()
 
 $preliminaries = true
 
 $SQL_FILE = "./setup/sql/ilias3.sql"
 
 $dsn = ""
 
 $db
 
 $setup_password
 
 $default_client
 
 $safe_mode
 
 $safe_mode_exec_dir
 
 $auth
 
 $access_mode
 
 $client
 

Protected Member Functions

 checkOpcacheSettings ()
 
 isDirectoryInOther ($directory, $other_directory)
 Checks if directory is subdirectory of other directory. More...
 

Protected Attributes

 $passwordManager
 

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.

Constructor & Destructor Documentation

◆ __construct()

ilSetup::__construct ( \ilSetupPasswordManager  $passwordManager,
  $a_auth,
  $a_auth_type 
)

constructor

Parameters
$passwordManager\ilSetupPasswordManager
booleanuser is authenticated? (true) or not (false)
stringuser is admin or common user

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

76 {
77 global $lng;
78
79 $this->passwordManager = $passwordManager;
80
81 $this->lng = $lng;
82
83 $this->db_connections = new ilDBConnections();
84
85 define("ILIAS_MODULE", "setup");
86
87 $this->auth = ($this->checkAuth()) ? true : false;
88 $this->access_mode = $a_auth_type;
89
90 // safe mode status & exec_dir
91 if ($this->safe_mode = ini_get("safe_mode")) {
92 $this->safe_mode_exec_dir = ilFile::deleteTrailingSlash(ini_get("safe_mode_exec_dir"));
93 }
94
95 // set path to ilias.ini
96 $this->ini_file_path = ILIAS_ABSOLUTE_PATH . "/ilias.ini.php";
97 $this->setup_defaults = ILIAS_ABSOLUTE_PATH . "/setup/ilias.master.ini.php";
98
99 // init setup.ini
100 $this->ini_ilias_exists = $this->init();
101
102 /*
103 if ($this->ini_ilias_exists)
104 {
105 if ($this->ini->readVariable("log","path") != "")
106 {
107 $log->path = $this->ini->readVariable("log","path");
108 }
109
110 if ($this->ini->readVariable("log","file") != "")
111 {
112 $log->filename = $this->ini->readVariable("log","file");
113 }
114
115 if ($this->ini->readVariable("log","enabled") != "")
116 {
117 $log->enabled = $this->ini->readVariable("log","enabled");
118 }
119 }
120 */
121 }
Administrates DB connections in setup.
deleteTrailingSlash($a_path)
delete trailing slash of path variables
checkAuth()
check authentication status
init()
init setup load settings from ilias.ini if exists and sets some constants
$lng

References $lng, $passwordManager, checkAuth(), ilFile\deleteTrailingSlash(), and init().

+ Here is the call graph for this function:

Member Function Documentation

◆ _ilSetup()

ilSetup::_ilSetup ( )

destructor

Returns
boolean

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

1493 {
1494 //if ($this->ini->readVariable("db","type") != "")
1495 //{
1496 // $this->db->disconnect();
1497 //}
1498 return true;
1499 }

◆ checkAccess()

ilSetup::checkAccess ( $client)

check client access status

Parameters
objectclient
Returns
boolean

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

790 {
791 if ($client->ini->readVariable("client", "access") == "1") {
792 $arr["status"] = true;
793 $arr["comment"] = $this->lng->txt("online");
794 } else {
795 $arr["status"] = false;
796 $arr["comment"] = $this->lng->txt("disabled");
797 }
798
799 return $arr;
800 }

References $client.

Referenced by getStatus().

+ Here is the caller graph for this function:

◆ checkAuth()

ilSetup::checkAuth ( )

check authentication status

Returns
boolean

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

374 {
375 if ($_SESSION["auth"] === true && $_SESSION["auth_path"] == ILIAS_HTTP_PATH) {
376 return true;
377 }
378
379 return false;
380 }
$_SESSION["AccountId"]

References $_SESSION.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ checkClientContact()

ilSetup::checkClientContact ( $client)

check client contact data status

Parameters
objectclient
Returns
boolean

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

997 {
998 $arr["status"] = true;
999 //$arr["comment"] = $this->lng->txt("filled_out");
1000
1001 $settings = $client->getAllSettings();
1002 $client_name = $client->getName();
1003
1004 // check required fields
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");
1009 }
1010
1011 // admin email
1012 if (!ilUtil::is_email($settings["admin_email"]) and $arr["status"] != false) {
1013 $arr["status"] = false;
1014 $arr["comment"] = $this->lng->txt("email_not_valid");
1015 }
1016
1017 return $arr;
1018 }
static is_email($a_email, ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid.

References $client, and ilUtil\is_email().

Referenced by getStatus().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkClientDatabase()

ilSetup::checkClientDatabase ( ilClient  $client)
Parameters
\ilClient$client
Returns
array

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

824 {
825 $arr = array();
826 $client->provideGlobalDB();
827 if (!$arr["status"] = $client->db_exists) {
828 $arr["comment"] = $this->lng->txt("no_database");
829
830 return $arr;
831 }
832
833 if (!$arr["status"] = $client->db_installed) {
834 $arr["comment"] = $this->lng->txt("db_not_installed");
835
836 return $arr;
837 }
838 // TODO: move this to client class!!
839 $client->setup_ok = (bool) $client->getSetting("setup_ok");
840
841 include_once "./Services/Database/classes/class.ilDBUpdate.php";
842 $this->lng->setDbHandler($client->db);
843 $dbupdate = new ilDBUpdate($client->db);
844
845 if (!$arr["status"] = $dbupdate->getDBVersionStatus()) {
846 $arr["comment"] = $this->lng->txt("db_needs_update");
847 $arr["update"] = true;
848
849 return $arr;
850 } else {
851 if ($dbupdate->hotfixAvailable()) {
852 $arr["status"] = false;
853 $arr["comment"] = $this->lng->txt("hotfix_available");
854 $arr["update"] = true;
855
856 return $arr;
857 } else {
858 if ($dbupdate->customUpdatesAvailable()) {
859 $arr["status"] = false;
860 $arr["comment"] = $this->lng->txt("custom_updates_available");
861 $arr["update"] = true;
862
863 return $arr;
864 }
865 }
866 }
867
868 // check control information
869 global $ilDB;
870 $cset = $ilDB->query("SELECT count(*) as cnt FROM ctrl_calls");
871 $crec = $ilDB->fetchAssoc($cset);
872 $client->revokeGlobalDB();
873 if ($crec["cnt"] == 0) {
874 $arr["status"] = false;
875 $arr["comment"] = $this->lng->txt("db_control_structure_missing");
876 $arr["update"] = true;
877
878 return $arr;
879 }
880
881 return $arr;
882 }
Database Update class.
global $ilDB

References $client, and $ilDB.

Referenced by getStatus().

+ Here is the caller graph for this function:

◆ checkClientIni()

ilSetup::checkClientIni ( $client)

check client ini status

Parameters
objectclient
Returns
boolean

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

808 {
809 if (!$arr["status"] = $client->init()) {
810 $arr["comment"] = $client->getError();
811 } else {
812 //$arr["comment"] = "dir: /".ILIAS_WEB_DIR."/".$client->getId();
813 }
814
815 return $arr;
816 }

References $client.

Referenced by getStatus().

+ Here is the caller graph for this function:

◆ checkClientLanguages()

ilSetup::checkClientLanguages ( ilClient  $client)
Parameters
\ilClient$client
Returns
array

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

974 {
975 $client->provideGlobalDB();
976 $installed_langs = $this->lng->getInstalledLanguages();
977
978 $count = count($installed_langs);
979 $arr = array();
980 if ($count < 1) {
981 $arr["status"] = false;
982 $arr["comment"] = $this->lng->txt("lang_none_installed");
983 } else {
984 $arr["status"] = true;
985 //$arr["comment"] = $count." ".$this->lng->txt("languages_installed");
986 }
987 $client->revokeGlobalDB();
988 return $arr;
989 }

References $client.

Referenced by getStatus().

+ Here is the caller graph for this function:

◆ checkClientNIC()

ilSetup::checkClientNIC ( $client)

check client nic status

Parameters
objectclient
Returns
boolean

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

1026 {
1027 $settings = $client->getAllSettings();
1028
1029 if (!isset($settings["nic_enabled"])) {
1030 $arr["status"] = false;
1031 $arr["comment"] = $this->lng->txt("nic_not_disabled");
1032 return $arr;
1033 }
1034
1035 $arr["status"] = true;
1036
1037 if ($settings["nic_enabled"] == "-1") {
1038 $arr["comment"] = $this->lng->txt("nic_reg_failed");
1039 return $arr;
1040 }
1041
1042 if (!$settings["nic_enabled"]) {
1043 $arr["comment"] = $this->lng->txt("nic_reg_disabled");
1044 } else {
1045 $arr["comment"] = $this->lng->txt("nic_reg_enabled");
1046 if ($settings["inst_id"] <= 0) {
1047 $arr["status"] = false;
1048 }
1049 }
1050
1051 return $arr;
1052 }

References $client.

Referenced by getStatus().

+ Here is the caller graph for this function:

◆ checkClientProxySettings()

ilSetup::checkClientProxySettings ( ilClient  $client)
Parameters
\ilClient$client
Returns
array

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

933 {
934 $client->provideGlobalDB();
935 global $ilDB;
936 $arr = array();
937 $fields = array( 'proxy_status', 'proxy_host', 'proxy_port' );
938
939 $query = "SELECT keyword, value FROM settings WHERE " . $ilDB->in('keyword', $fields, false, 'text');
940 $res = $ilDB->query($query);
941
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'];
947 }
948
949 if (!$already_saved) {
950 $arr["status"] = false;
951 $arr["comment"] = $this->lng->txt("proxy");
952 $arr["text"] = $this->lng->txt("proxy");
953 } else {
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");
958 } else {
959 $arr["status"] = true;
960 $arr["comment"] = $this->lng->txt("proxy_activated_configurated");
961 $arr["text"] = $this->lng->txt("proxy_activated_configurated");
962 }
963 }
964
965 return $arr;
966 }
$row
$query
foreach($_POST as $key=> $value) $res

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

Referenced by getStatus().

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

890 {
891 require_once('Services/Authentication/classes/class.ilSessionControl.php');
892
893 global $ilDB;
894 $db = $ilDB;
895
897
898 $query = "SELECT keyword, value FROM settings WHERE " . $db->in('keyword', $fields, false, 'text');
899 $res = $db->query($query);
900
901 $rows = array();
902 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
903 if ($row['value'] != '') {
904 $rows[] = $row;
905 } else {
906 break;
907 }
908 }
909
910 if (count($rows) != count($fields)) {
911 if ($a_as_bool) {
912 return false;
913 }
914 $arr["status"] = false;
915 $arr["comment"] = $this->lng->txt("session_management_not_configured");
916 } else {
917 if ($a_as_bool) {
918 return true;
919 }
920 $arr["status"] = true;
921 $arr["comment"] = $this->lng->txt("session_management_configured");
922 }
923
924 return $arr;
925 }
static getSettingFields()
returns the array of setting fields
$rows
Definition: xhr_table.php:10

References $db, $ilDB, $query, $res, $row, $rows, ilDBConstants\FETCHMODE_ASSOC, and ilSessionControl\getSettingFields().

+ Here is the call graph for this function:

◆ checkCookiesEnabled()

ilSetup::checkCookiesEnabled ( )

check cookies enabled

Returns
array

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

318 {
319 global $sess;
320
321 if ($sess->usesCookies) {
322 $arr["status"] = true;
323 $arr["comment"] = "";
324 } else {
325 $arr["status"] = false;
326 $arr["comment"] = $this->lng->txt("pre_cookies_disabled");
327 }
328
329 return $arr;
330 }

References $sess.

Referenced by queryPreliminaries().

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

295 {
296 clearstatcache();
297 if (@mkdir($a_dir . "/crst879dldsk9d", 0774)) {
298 $arr["status"] = true;
299 $arr["comment"] = "";
300
301 @rmdir($a_dir . "/crst879dldsk9d");
302 } else {
303 $arr["status"] = false;
304 //$cdir = getcwd();
305 //chdir("..");
306 $arr["comment"] = getcwd() . ": " . $this->lng->txt("pre_folder_create_error");
307 //chdir($cdir);
308 }
309
310 return $arr;
311 }

Referenced by queryPreliminaries().

+ Here is the caller graph for this function:

◆ checkDataDirSetup()

ilSetup::checkDataDirSetup (   $a_formdata)

check datadir path

Parameters
arrayform data
Returns
boolean

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

1342 {
1343 // remove trailing slash & convert backslashes to forwardslashes
1344 $datadir_path = preg_replace("/\\\\/", "/", ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["datadir_path"])));
1345
1346 if (empty($datadir_path)) {
1347 $this->error = "no_path_datadir";
1348 return false;
1349 }
1350
1351 $webspace_dir = ILIAS_ABSOLUTE_PATH . "/data";
1352
1353 // datadir may not point to webspace dir or to any place under webspace_dir
1354 if (strpos($datadir_path, $webspace_dir) !== false) {
1355 $this->error = "datadir_webspacedir_match";
1356 return false;
1357 }
1358
1359 // create dir
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);
1363
1364 if ($this->isDirectoryInOther($dir_to_create, ILIAS_ABSOLUTE_PATH)) {
1365 $this->error = "cannot_create_datadir_inside_webdir";
1366 return false;
1367 }
1368
1369 if (is_writable($datadir_path)) {
1370 $this->error = "dir_exists_create";
1371 return false;
1372 }
1373
1374 if (!is_writable($dir_to_check)) {
1375 $this->error = "cannot_create_datadir_no_write_access";
1376 return false;
1377 }
1378 } else { // check set target dir
1379 if ($this->isDirectoryInOther($datadir_path, ILIAS_ABSOLUTE_PATH)) {
1380 $this->error = "cannot_create_datadir_inside_webdir";
1381 return false;
1382 }
1383
1384 if (!is_writable($datadir_path)) {
1385 $this->error = "cannot_create_datadir_no_write_access";
1386 return false;
1387 }
1388 }
1389
1390 return true;
1391 }
error($a_errmsg)
set error message @access public
isDirectoryInOther($directory, $other_directory)
Checks if directory is subdirectory of other directory.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

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

+ Here is the call graph for this function:

◆ checkDom()

ilSetup::checkDom ( )

Check MySQL.

Returns
boolean

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

388 {
389 global $ilDB;
390
391 if (class_exists("DOMDocument")) {
392 $arr["status"] = true;
393 } else {
394 $arr["status"] = false;
395 $arr["comment"] = $this->lng->txt("pre_dom_missing");
396 }
397
398 return $arr;
399 }

References $ilDB.

Referenced by queryPreliminaries().

+ Here is the caller graph for this function:

◆ checkErrorLogSetup()

ilSetup::checkErrorLogSetup (   $error_log_path)

check error log path

Parameters
string$error_log_pathpath to save error log files
Returns
boolean

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

1457 {
1458 // remove trailing slash & convert backslashes to forwardslashes
1459 $clean_error_log_path = preg_replace("/\\\\/", "/", ilFile::deleteTrailingSlash(ilUtil::stripSlashes($error_log_path)));
1460
1461 if (!empty($clean_error_log_path)) {
1462 if (!ilUtil::makeDirParents($clean_error_log_path)) {
1463 $this->error = "could_not_create_error_directory";
1464 return false;
1465 }
1466 }
1467
1468 return true;
1469 }
static makeDirParents($a_dir)
Create a new directory and all parent directories.

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

+ Here is the call graph for this function:

◆ checkFinish()

ilSetup::checkFinish ( $client)

check if client setup was finished

Parameters
objectclient
Returns
boolean

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

772 {
773 if ($client->getSetting("setup_ok")) {
774 $arr["status"] = true;
775 //$arr["comment"] = $this->lng->txt("setup_finished");
776 } else {
777 $arr["status"] = false;
778 $arr["comment"] = $this->lng->txt("setup_not_finished");
779 }
780
781 return $arr;
782 }

References $client.

Referenced by getStatus().

+ Here is the caller graph for this function:

◆ checkGd()

ilSetup::checkGd ( )

Check MySQL.

Returns
boolean

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

427 {
428 global $ilDB;
429
430 if (function_exists("imagefill") && function_exists("imagecolorallocate")) {
431 $arr["status"] = true;
432 } else {
433 $arr["status"] = false;
434 $arr["comment"] = sprintf(
435 $this->lng->txt("pre_gd_missing"),
436 "http://php.net/manual/en/book.image.php"
437 );
438 }
439
440 return $arr;
441 }

References $ilDB.

Referenced by queryPreliminaries().

+ Here is the caller graph for this function:

◆ checkIniFileExists()

ilSetup::checkIniFileExists ( )

check if inifile exists

Returns
boolean

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

258 {
259 $a = @file_exists($this->INI_FILE);
260 return $a;
261 }

◆ checkLogSetup()

ilSetup::checkLogSetup (   $a_formdata)

check log path

Parameters
arrayform data
Returns
boolean

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

1419 {
1420 // log path
1421 if (!$a_formdata["chk_log_status"]) {
1422 // remove trailing slash & convert backslashes to forwardslashes
1423 $log_path = preg_replace("/\\\\/", "/", ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["log_path"])));
1424
1425 if (empty($log_path)) {
1426 $this->error = "no_path_log";
1427 return false;
1428 }
1429
1430 if (is_dir($log_path)) {
1431 $this->error = 'could_not_create_logfile';
1432 return false;
1433 }
1434
1435 if ($this->isDirectoryInOther($log_path, ILIAS_ABSOLUTE_PATH)) {
1436 $this->error = "cannot_create_logdir_inside_webdir";
1437 return false;
1438 }
1439
1440 if (!@touch($log_path)) {
1441 $this->error = "could_not_create_logfile";
1442 return false;
1443 }
1444 }
1445
1446 return true;
1447 }

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

+ Here is the call graph for this function:

◆ checkMemoryLimit()

ilSetup::checkMemoryLimit ( )

Check Memory Limit.

Returns
boolean

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

448 {
449 global $ilDB;
450
451 $limit = ini_get("memory_limit");
452
453 $limit_ok = true;
454 if (is_int(strpos($limit, "M"))) {
455 $limit_n = (int) $limit;
456 if ($limit_n < 40) {
457 $limit_ok = false;
458 }
459 }
460
461 if ($limit_ok) {
462 $arr["status"] = true;
463 $arr["comment"] = $limit . ". " . $this->lng->txt("pre_memory_limit_recommend");
464 } else {
465 $arr["status"] = false;
466 $arr["comment"] = $limit . ". " . $this->lng->txt("pre_memory_limit_too_low");
467 }
468
469 return $arr;
470 }

References $ilDB.

Referenced by queryPreliminaries().

+ Here is the caller graph for this function:

◆ checkMySQL()

ilSetup::checkMySQL ( )

Check MySQL.

Returns
boolean

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

355 {
356 global $ilDB;
357
358 if (function_exists("mysql_query")) {
359 $arr["status"] = true;
360 $arr["comment"] = $this->lng->txt("pre_mysql_4_1_or_higher");
361 } else {
362 $arr["status"] = false;
363 $arr["comment"] = $this->lng->txt("pre_mysql_missing");
364 }
365
366 return $arr;
367 }

References $ilDB.

◆ checkOpcacheSettings()

ilSetup::checkOpcacheSettings ( )
protected
Returns
array

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

477 {
478 $arr = array();
479 // correct-with-php5-removal FSX start
480 if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
481 $arr["status"] = true;
482
483 return $arr;
484 }
485 // correct-with-php5-removal FSX end
486
487 $load_comments = ini_get("opcache.load_comments");
488 if ($load_comments == 1) {
489 $arr["status"] = true;
490 } else {
491 $arr["status"] = false;
492 $arr["comment"] = $this->lng->txt("pre_opcache_comments");
493 }
494
495 return $arr;
496 }

Referenced by queryPreliminaries().

+ Here is the caller graph for this function:

◆ checkPasswordSetup()

ilSetup::checkPasswordSetup (   $a_formdata)

check setup password

Parameters
arrayform data
Returns
boolean

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

1399 {
1400 if (!$a_formdata["setup_pass"]) {
1401 $this->error = "no_setup_pass_given";
1402 return false;
1403 }
1404
1405 if ($a_formdata["setup_pass"] != $a_formdata["setup_pass2"]) {
1406 $this->error = "pass_does_not_match";
1407 return false;
1408 }
1409
1410 return true;
1411 }

References error().

+ Here is the call graph for this function:

◆ checkPHPVersion()

ilSetup::checkPHPVersion ( )

check for PHP version

Returns
array

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

337 {
338 $version = PHP_VERSION;
339
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");
345 }
346
347 return $arr;
348 }
$version
Definition: build.php:27

References $version.

Referenced by queryPreliminaries().

+ Here is the caller graph for this function:

◆ checkPreliminaries()

ilSetup::checkPreliminaries ( )

check all prliminaries

Returns
boolean

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

530 {
531 $this->preliminaries_result = $this->queryPreliminaries();
532
533 foreach ($this->preliminaries_result as $val) {
534 if ($val["status"] === false) {
535 $this->preliminaries = false;
536 return false;
537 }
538 }
539
540 return true;
541 }
queryPreliminaries()
preliminaries

References queryPreliminaries().

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

1221 {
1222 // convert path
1223 if (!isset($a_formdata["chk_convert_path"])) {
1224 // convert backslashes to forwardslashes
1225 $convert_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["convert_path"]));
1226
1227 if (($err = $this->testConvert($convert_path)) != "") {
1228 $this->error = $err;
1229 return false;
1230 }
1231 }
1232
1233 // zip path
1234 if (!isset($a_formdata["chk_zip_path"])) {
1235 // convert backslashes to forwardslashes
1236 $zip_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["zip_path"]));
1237
1238 if (empty($zip_path)) {
1239 $this->error = "no_path_zip";
1240 return false;
1241 }
1242
1243 if (!$this->testZip($zip_path)) {
1244 $this->error = "check_failed_zip";
1245 return false;
1246 }
1247 }
1248
1249 // unzip path
1250 if (!isset($a_formdata["chk_unzip_path"])) {
1251 // convert backslashes to forwardslashes
1252 $unzip_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["unzip_path"]));
1253
1254 if (empty($unzip_path)) {
1255 $this->error = "no_path_unzip";
1256 return false;
1257 }
1258
1259 if (!$this->testUnzip($unzip_path)) {
1260 $this->error = "check_failed_unzip";
1261 return false;
1262 }
1263 }
1264
1265 // ghostscript path
1266 if (!isset($a_formdata["chk_ghostscript_path"])) {
1267 // convert backslashes to forwardslashes
1268 $ghostscript_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["ghostscript_path"]));
1269
1270 if (($err = $this->testGhostscript($ghostscript_path)) != "") {
1271 $this->error = $err;
1272 return false;
1273 }
1274 }
1275
1276 // java path
1277 if (!isset($a_formdata["chk_java_path"])) {
1278 // convert backslashes to forwardslashes
1279 $java_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["java_path"]));
1280
1281 if (empty($java_path)) {
1282 $this->error = "no_path_java";
1283 return false;
1284 }
1285
1286 if (!$this->testJava($java_path)) {
1287 $this->error = "check_failed_java";
1288 return false;
1289 }
1290 }
1291
1292 /*if (!isset($a_formdata["chk_mkisofs_path"]))
1293 {
1294 // convert backslashes to forwardslashes
1295 $mkisofs_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["mkisofs_path"]));
1296
1297 if (empty($mkisofs_path))
1298 {
1299 $this->error = "no_path_mkisofs";
1300 return false;
1301 }
1302 }*/
1303
1304 if (!isset($a_formdata["chk_ffmpeg_path"])) {
1305 // convert backslashes to forwardslashes
1306 $ffmpeg_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["ffmpeg_path"]));
1307
1308 if (empty($ffmpeg_path)) {
1309 $this->error = "no_path_ffmpeg";
1310 return false;
1311 }
1312
1313 if (!$this->testFFMpeg($ffmpeg_path)) {
1314 $this->error = "check_failed_ffmpeg";
1315 return false;
1316 }
1317 }
1318
1319 // latex url
1320 if (!isset($a_formdata["chk_latex_url"])) {
1321 $latex_url = ilUtil::stripSlashes($a_formdata["latex_url"]);
1322 if (empty($latex_url)) {
1323 $this->error = "no_latex_url";
1324 return false;
1325 }
1326
1327 if (!$this->testLatex($latex_url)) {
1328 $this->error = "check_failed_latex";
1329 return false;
1330 }
1331 }
1332
1333 return true;
1334 }
testLatex($a_latex_url)
Check latex cgi script.
testZip($a_zip_path)
Check zip program.
testUnzip($a_unzip_path)
Check unzip program.
testGhostscript($a_ghostscript_path)
Check ghostscript program.
testConvert($a_convert_path)
Check convert program.
testJava($a_java_path)
Check JVM.

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

+ Here is the call graph for this function:

◆ checkWritable()

ilSetup::checkWritable ( )

check for writable directory

Parameters
stringdirectory
Returns
array

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

269 {
270 clearstatcache();
271 if (is_writable(".")) {
272 $arr["status"] = true;
273 //$cdir = getcwd();
274 //chdir("..");
275 $arr["comment"] = getcwd();
276 //chdir($cdir);
277 } else {
278 $arr["status"] = false;
279 $arr["comment"] = $this->lng->txt("pre_folder_write_error");
280 //$cdir = getcwd();
281 //chdir("..");
282 $arr["comment"] = getcwd() . ": " . $arr["comment"];
283 //chdir($cdir);
284 }
285
286 return $arr;
287 }

Referenced by queryPreliminaries().

+ Here is the caller graph for this function:

◆ checkXsl()

ilSetup::checkXsl ( )

Check MySQL.

Returns
boolean

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

406 {
407 global $ilDB;
408
409 if (class_exists("XSLTProcessor")) {
410 $arr["status"] = true;
411 } else {
412 $arr["status"] = false;
413 $arr["comment"] = sprintf(
414 $this->lng->txt("pre_xsl_missing"),
415 "http://php.net/manual/en/book.xsl.php"
416 );
417 }
418
419 return $arr;
420 }

References $ilDB.

Referenced by queryPreliminaries().

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

1867 {
1868 // Getting source and targets
1869 $source = new ilClient($source_id, $this->db_connections);
1870 $source->init();
1872
1873 // ************************************************
1874 // ** COPY FILES
1875
1876 // Cleaning up datadir
1877 if (!ilUtil::delDir($target->getDataDir())) {
1878 $this->error = "Could not delete data dir $target->getDataDir()";
1879 //return false;
1880 }
1881
1882 // Create empty datadir
1883 if (!ilUtil::makeDir($target->getDataDir())) {
1884 $this->error = "could_not_create_base_data_dir :" . $target->getDataDir();
1885 return false;
1886 }
1887
1888 // Copying datadir
1889 if (!ilUtil::rCopy($source->getDataDir(), $target->getDataDir())) {
1890 $this->error = "clone_datadircopyfail";
1891 $target->ini->write();
1892 return false;
1893 }
1894
1895 // Cleaning up Webspacedir
1896 if (!ilUtil::delDir($target->getWebspaceDir())) {
1897 $this->error = "Could not delete webspace dir $target->getWebspaceDir()";
1898 //return false;
1899 }
1900
1901 // Create empty Webspacedir
1902 if (!ilUtil::makeDir($target->getWebspaceDir())) {
1903 $this->error = "could_not_create_base_webspace_dir :" . $target->getWebspaceDir();
1904 return false;
1905 }
1906
1907 // Copying Webspacedir
1908 if (!ilUtil::rCopy($source->getWebspaceDir(), $target->getWebspaceDir())) {
1909 $this->error = "clone_websipacedircopyfail";
1910 $target->ini->write();
1911 return false;
1912 }
1913
1914 // Restore ini file
1915 $target->ini->write();
1916
1917 // ************************************************
1918 // ** COPY DATABASE
1919
1920 $source->connect();
1921 if (!$source->db) {
1922 $this->error = "Source database connection failed.";
1923 return false;
1924 }
1925
1926 $target->connect();
1927 if (!$target->db) {
1928 $this->error = "Target database connection failed.";
1929 return false;
1930 }
1931
1932 $source->connect();
1933 $srcTables = $source->db->query("SHOW TABLES");
1934 $target->connect();
1935
1936 // drop all tables of the target db
1937 $tarTables = $target->db->query("SHOW TABLES");
1938 foreach ($tarTables->fetchAll() as $cTable) {
1939 $target->db->query("DROP TABLE IF EXISTS " . $cTable[0]);
1940 }
1941
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]);
1945 if (!$create) {
1946 $error = true;
1947 }
1948 $insert = $target->db->query("INSERT INTO " . $cTable[0] . " SELECT * FROM " . $source->getDbName() . "." . $cTable[0]);
1949 }
1950
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"));
1953 return true;
1954 }
$source
Definition: linkback.php:22
Client Management.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
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 ...
$target
Definition: test.php:19

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

+ Here is the call graph for this function:

◆ createDatabase()

ilSetup::createDatabase (   $a_collation = "")

create client database

Returns
boolean

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

221 {
222 if ($this->client->getDBSetup()->isDatabaseInstalled()) {
223 $this->error = $this->lng->txt("database_exists");
224
225 return false;
226 }
227
228 $db_setup = $this->client->getDBSetup();
229 return $db_setup->createDatabase($a_collation);
230 }

References error().

+ Here is the call graph for this function:

◆ getClient()

ilSetup::getClient ( )
Returns
ilClient

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

143 {
144 return $this->client;
145 }

References $client.

◆ getError()

ilSetup::getError ( )

get Error message

Returns
string error message

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

1476 {
1477 if (empty($this->error)) {
1478 return false;
1479 }
1480
1482 $this->error = "";
1483
1484 return $error;
1485 }

References $error, and error().

+ Here is the call graph for this function:

◆ getMasterPassword()

ilSetup::getMasterPassword ( )
Returns
string

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

546 : string
547 {
548 return $this->ini->readVariable('setup', 'pass');
549 }

Referenced by verifyMasterPassword().

+ Here is the caller graph for this function:

◆ getSessionSettings()

ilSetup::getSessionSettings ( )

reads session settings from db

Returns
array session_settings

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

1806 {
1807 require_once('Services/Authentication/classes/class.ilSessionControl.php');
1808
1809 $db = $this->client->getDB();
1810
1811 $setting_fields = ilSessionControl::getSettingFields();
1812
1813 $query = "SELECT * FROM settings WHERE module = %s " .
1814 "AND " . $db->in('keyword', $setting_fields, false, 'text');
1815
1816 $res = $db->queryF($query, array('text'), array('common'));
1817
1818 $session_settings = array();
1819 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
1820 $session_settings[$row['keyword']] = $row['value'];
1821 }
1822
1823 foreach ($setting_fields as $field) {
1824 if (!isset($session_settings[$field])) {
1825 $value = 1;
1826
1827 switch ($field) {
1828 case 'session_max_count':
1829
1831 break;
1832
1833 case 'session_min_idle':
1834
1836 break;
1837
1838 case 'session_max_idle':
1839
1841 break;
1842
1843 case 'session_max_idle_after_first_request':
1844
1846 break;
1847
1848 case 'session_allow_client_maintenance':
1849
1851 break;
1852 }
1853
1854 $session_settings[$field] = $value;
1855 }
1856 }
1857
1858 return $session_settings;
1859 }
const DEFAULT_MAX_COUNT
default value for settings that have not been defined in setup or administration yet

References $db, $query, $res, $row, ilSessionControl\DEFAULT_ALLOW_CLIENT_MAINTENANCE, ilSessionControl\DEFAULT_MAX_COUNT, ilSessionControl\DEFAULT_MAX_IDLE, ilSessionControl\DEFAULT_MAX_IDLE_AFTER_FIRST_REQUEST, ilSessionControl\DEFAULT_MIN_IDLE, ilDBConstants\FETCHMODE_ASSOC, and ilSessionControl\getSettingFields().

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

727 {
728 if (!is_object($client)) {
729 if ($this->ini_client_exists) {
731 } else {
732 $client = new ilClient(0, $this->db_connections);
733 }
734 }
735
736 $status = array();
737 $status["ini"] = $this->checkClientIni($client); // check this one
738 $status["db"] = $this->checkClientDatabase($client);
739 if ($status["db"]["status"] === false and $status["db"]["update"] !== true) {
740 //$status["sess"]["status"] = false;
741 //$status["sess"]["comment"] = $status["db"]["comment"];
742 $status["lang"]["status"] = false;
743 $status["lang"]["comment"] = $status["db"]["comment"];
744 $status["contact"]["status"] = false;
745 $status["contact"]["comment"] = $status["db"]["comment"];
746
747 $status["proxy"]["status"] = false;
748 $status["proxy"]["comment"] = $status["db"]["comment"];
749
750 $status["nic"]["status"] = false;
751 $status["nic"]["comment"] = $status["db"]["comment"];
752 } else {
753 //$status["sess"] = $this->checkClientSessionSettings($client);
754 $status["lang"] = $this->checkClientLanguages($client);
755 $status["contact"] = $this->checkClientContact($client);
756 $status["proxy"] = $this->checkClientProxySettings($client);
757 $status["nic"] = $this->checkClientNIC($client);
758 $status["finish"] = $this->checkFinish($client);
759 $status["access"] = $this->checkAccess($client);
760 }
761
762 //return value
763 return $status;
764 }
checkClientContact(&$client)
check client contact data status
checkAccess(&$client)
check client access status
checkClientProxySettings(ilClient $client)
checkClientDatabase(ilClient $client)
checkClientIni(&$client)
check client ini status
checkClientNIC(&$client)
check client nic status
checkClientLanguages(ilClient $client)
checkFinish(&$client)
check if client setup was finished

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

+ Here is the call graph for this function:

◆ hasOpCacheEnabled()

ilSetup::hasOpCacheEnabled ( )
Returns
bool

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

2035 {
2036 $ini_get = ini_get('opcache.enable');
2037
2038 return ($ini_get === 1 or $ini_get === '1' or strtolower($ini_get) === 'on');
2039 }

Referenced by queryPreliminaries().

+ Here is the caller 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 152 of file class.ilSetup.php.

153 {
154 // load data from setup.ini file
155 $this->ini = new ilIniFile($this->ini_file_path);
156
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();
160 return false;
161 }
162
163 $this->setup_password = $this->ini->readVariable("setup", "pass");
164 $this->default_client = $this->ini->readVariable("clients", "default");
165
166 define("ILIAS_DATA_DIR", $this->ini->readVariable("clients", "datadir"));
167 define("ILIAS_WEB_DIR", $this->ini->readVariable("clients", "path"));
168
169 return true;
170 }
INIFile Parser.

References error().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ installDatabase()

ilSetup::installDatabase ( )

set the database data

Returns
boolean
Deprecated:

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

238 {
239 if (!$this->client->getDBSetup()->isDatabaseConnectable()) {
240 return false;
241 }
242
243 if ($this->client->getDBSetup()->installDatabase()) {
244 $this->client->db_installed = true;
245
246 return true;
247 }
248
249 return false;
250 }

◆ isAdmin()

ilSetup::isAdmin ( )

check if current user is admin

Returns
boolean

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

1077 {
1078 return ($this->access_mode == "admin") ? true : false;
1079 }

◆ isAuthenticated()

ilSetup::isAuthenticated ( )

check if current user is authenticated

Returns
boolean

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

1068 {
1069 return $this->auth;
1070 }

References $auth.

◆ isDirectoryInOther()

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

Checks if directory is subdirectory of other directory.

Parameters
string$directory
string$other_directory
Returns
bool

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

2063 {
2064 $other_directory = $other_directory . "/";
2065
2066 return !(strpos($directory, $other_directory) !== 0);
2067 }

Referenced by checkDataDirSetup(), and checkLogSetup().

+ Here is the caller graph for this function:

◆ isInstalled()

ilSetup::isInstalled ( )

check if client's db is installed

Returns
boolean

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

1059 {
1061 }

References $ini_ilias_exists.

Referenced by newClient().

+ Here is the caller graph for this function:

◆ isValidClientId()

ilSetup::isValidClientId (   $a_client_id)

Is valid client id.

Parameters

return

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

2048 {
2049 if (!preg_match("/^[A-Za-z0-9]+$/", $a_client_id)) {
2050 return false;
2051 }
2052 return true;
2053 }

◆ loginAsAdmin()

ilSetup::loginAsAdmin ( string  $raw)

Process setup admin login.

Parameters
string$raw
Returns
bool A boolean status, whether or not the authentication was successful
Exceptions

ilUserException

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

680 : bool
681 {
682 $passwordReHashCallback = function ($raw) {
683 $this->storeMasterPassword($raw);
684 };
685
686 if ($this->passwordManager->verifyPassword($this->getMasterPassword(), $raw, $passwordReHashCallback)) {
687 $_SESSION['auth'] = true;
688 $_SESSION['auth_path'] = ILIAS_HTTP_PATH;
689 $_SESSION['access_mode'] = 'admin';
690 return true;
691 }
692
693 return false;
694 }
storeMasterPassword(string $raw)

References $_SESSION, and storeMasterPassword().

+ Here is the call graph for this function:

◆ loginAsClient()

ilSetup::loginAsClient (   $a_auth_data)

process client login

Parameters
array
Returns
boolean

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

591 {
592 global $ilDB;
593
594 if (empty($a_auth_data["client_id"])) {
595 $this->error = "no_client_id";
596 return false;
597 }
598
599 if (empty($a_auth_data["username"])) {
600 $this->error = "no_username";
601 return false;
602 }
603
604 if (empty($a_auth_data["password"])) {
605 $this->error = "no_password";
606 return false;
607 }
608
609 if (!$this->newClient($a_auth_data["client_id"])) { //TT: comment out to get around null db
610 $this->error = "unknown_client_id";
611 unset($this->client);
612 return false;
613 }
614
615 if (!$this->client->db_exists) {
616 $this->error = "no_db_connect_consult_admin";
617 unset($this->client);
618 return false;
619 }
620
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"];
625
626 $add_usrfields = '';
627 if ($this->client->db->tableColumnExists('usr_data', 'passwd_enc_type')) {
628 $add_usrfields .= ' , usr_data.passwd_enc_type, usr_data.passwd_salt ';
629 }
630 $q = "SELECT usr_data.usr_id, usr_data.passwd $add_usrfields " .
631 "FROM usr_data " .
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';
638 return false;
639 }
640
641 $data = $this->client->db->fetchAssoc($r);
642
643 global $ilClientIniFile;
644
645 $ilClientIniFile = $this->client->ini;
646
647 require_once 'Services/User/classes/class.ilUserPasswordManager.php';
648 $crypt_type = ilUserPasswordManager::getInstance()->getEncoderName();
649 if (strlen($add_usrfields) && ilUserPasswordManager::getInstance()->isEncodingTypeSupported($crypt_type)) {
650 require_once 'setup/classes/class.ilObjSetupUser.php';
651 $user = new ilObjSetupUser();
652 $user->setPasswd($data['passwd'], IL_PASSWD_CRYPTED);
653 $user->setPasswordEncodingType($data['passwd_enc_type']);
654 $user->setPasswordSalt($data['passwd_salt']);
655
656 $password_valid = ilUserPasswordManager::getInstance()->verifyPassword($user, $a_auth_data['password']);
657 } else {
658 $password_valid = $data['passwd'] == md5($a_auth_data['password']);
659 }
660
661 if ($password_valid) {
662 // all checks passed -> user valid
663 $_SESSION['auth'] = true;
664 $_SESSION['auth_path'] = ILIAS_HTTP_PATH;
665 $_SESSION['access_mode'] = 'client';
666 $_SESSION['ClientId'] = $this->client->getId();
667 return true;
668 } else {
669 $this->error = 'login_invalid';
670 return false;
671 }
672 }
const IL_PASSWD_CRYPTED
Class ilObjSetupUser A class derived from ilObjUser for authentication purposes in the ILIAS setup.
newClient($a_client_id=0)
creates a client object in $this->client
static getInstance()
Single method to reduce footprint (included files, created instances)
$r
Definition: example_031.php:79
$user
Definition: migrateto20.php:57
$data
Definition: bench.php:6

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

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

702 {
703 if (!$this->isInstalled()) {
704 return false;
705 }
706
707 $this->client = new ilClient($a_client_id, $this->db_connections);
708
709 if (!$this->client->init()) {
710 //echo "<br>noclientinit";
711 $this->error = get_class($this) . ": " . $this->client->getError();
712 $_SESSION["ClientId"] = "";
713 return false;
714 }
715
716 $_SESSION["ClientId"] = $a_client_id;
717
718 return true;
719 }
isInstalled()
check if client's db is installed

References $_SESSION, error(), and isInstalled().

Referenced by loginAsClient().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ printProxyStatus()

ilSetup::printProxyStatus (   $client)

Print proxy settings.

@access private

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

1963 {
1964 require_once './Services/Http/exceptions/class.ilProxyException.php';
1965 $settings = $client->getAllSettings();
1966
1967 if ((bool) $settings['proxy_status'] == true) {
1968 try {
1969 $err_str = false;
1970 $wait_timeout = 100;
1971
1972 $fp = @fsockopen($settings['proxy_host'], $settings['proxy_port'], $err_code, $err_str, $wait_timeout);
1973
1974 if ($err_str) {
1975 throw new ilProxyException($err_str);
1976 }
1977
1978 fclose($fp);
1979
1980 ilUtil::sendSuccess($this->lng->txt('proxy_connectable'));
1981 } catch (Exception $e) {
1982 ilUtil::sendFailure($this->lng->txt('proxy_not_connectable') . ": " . $e->getMessage());
1983 }
1984 }
1985 }
Class for proxy related exception handling in ILIAS.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References $client, and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ queryPreliminaries()

ilSetup::queryPreliminaries ( )

preliminaries

check if different things are ok for setting up ilias @access private

Returns
array

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

506 {
507 $a = array();
508 $a["php"] = $this->checkPHPVersion();
509 // $a["mysql"] = $this->checkMySQL();
510 $a["root"] = $this->checkWritable();
511 $a["folder_create"] = $this->checkCreatable();
512 $a["cookies_enabled"] = $this->checkCookiesEnabled();
513 $a["dom"] = $this->checkDom();
514 $a["xsl"] = $this->checkXsl();
515 $a["gd"] = $this->checkGd();
516 $a["memory"] = $this->checkMemoryLimit();
517
518 if ($this->hasOpCacheEnabled()) {
519 $a["load_comments"] = $this->checkOpcacheSettings();
520 }
521
522 return $a;
523 }
checkWritable()
check for writable directory
checkPHPVersion()
check for PHP version
checkCreatable($a_dir=".")
check for permission to create new folders in specified directory
checkDom()
Check MySQL.
checkCookiesEnabled()
check cookies enabled
checkGd()
Check MySQL.
checkOpcacheSettings()
checkMemoryLimit()
Check Memory Limit.
checkXsl()
Check MySQL.

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

Referenced by checkPreliminaries().

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

1087 {
1088 $datadir_path = preg_replace("/\\\\/", "/", ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["datadir_path"])));
1089
1090 if ($a_formdata["chk_datadir_path"] == 1) { // mode create dir
1091 if (!ilUtil::makeDir($datadir_path)) {
1092 $this->error = "create_datadir_failed";
1093 return false;
1094 }
1095 }
1096
1097 // create webspace dir if it does not exist
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";
1101 return false;
1102 }
1103 }
1104
1105 $form_log_path = preg_replace("/\\\\/", "/", ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["log_path"])));
1106 $log_path = substr($form_log_path, 0, strrpos($form_log_path, "/"));
1107 $log_file = substr($form_log_path, strlen($log_path) + 1);
1108 $error_log_path = preg_replace("/\\\\/", "/", ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["error_log_path"])));
1109
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"])));
1119 //$this->ini->setVariable("tools", "mkisofs", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["mkisofs_path"])));
1120 $this->ini->setVariable("tools", "ffmpeg", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["ffmpeg_path"])));
1121 $this->ini->setVariable("tools", "latex", ilUtil::stripSlashes($a_formdata["latex_url"]));
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"])));
1128
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);
1134
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"]);
1138
1139 if (!$this->ini->write()) {
1140 $this->error = get_class($this) . ": " . $this->ini->getError();
1141 return false;
1142 }
1143
1144 // everything is fine. so we authenticate the user and set access mode to 'admin'
1145 $_SESSION["auth"] = true;
1146 $_SESSION["auth_path"] = ILIAS_HTTP_PATH;
1147 $_SESSION["access_mode"] = "admin";
1148
1149 return true;
1150 }

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

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

177 {
178 // save client id to session
179 $_SESSION["ClientId"] = $this->client->getId();
180
181 // create client
182 if (!$this->client->create()) {
183 $this->error = $this->client->getError();
184 return false;
185 }
186
187 //everything okay
188 $this->ini_client_exists = true;
189
190 return true;
191 }

References $_SESSION, and error().

Referenced by updateNewClient().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveProxySettings()

ilSetup::saveProxySettings (   $proxy_settings)

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

1988 {
1989 $db = $this->client->getDB();
1990 $proxy_fields = array('proxy_status','proxy_host','proxy_port');
1991
1992 foreach ($proxy_fields as $field) {
1993 if (isset($proxy_settings[$field])) {
1994 $query = "SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
1995 $res = $db->queryF(
1996 $query,
1997 array('text', 'text'),
1998 array('common', $field)
1999 );
2000
2001 $row = array();
2002 while ($row = $db->fetchAssoc($res)) {
2003 break;
2004 }
2005
2006 if (is_array($row) && count($row) > 0) {
2007 $db->update(
2008 'settings',
2009 array(
2010 'value' => array('text', $proxy_settings[$field])
2011 ),
2012 array(
2013 'module' => array('text', 'common'),
2014 'keyword' => array('text', $field)
2015 )
2016 );
2017 } else {
2018 $db->insert(
2019 'settings',
2020 array(
2021 'module' => array('text', 'common'),
2022 'keyword' => array('text', $field),
2023 'value' => array('text', $proxy_settings[$field])
2024 )
2025 );
2026 }
2027 }
2028 }
2029 }

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

◆ setClient()

ilSetup::setClient (   $a_cl)
Parameters
$a_cl

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

134 {
135 $this->client = $a_cl;
136 }

◆ setSessionSettings()

ilSetup::setSessionSettings (   $session_settings)

saves session settings to db

Parameters
array$session_settings

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

1743 {
1744 require_once('Services/Authentication/classes/class.ilSessionControl.php');
1745
1746 $db = $this->client->getDB();
1747
1748 $setting_fields = ilSessionControl::getSettingFields();
1749
1750 $i = 0;
1751 foreach ($setting_fields as $field) {
1752 if (isset($session_settings[$field])) {
1753 $query = "SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
1754 $res = $db->queryF(
1755 $query,
1756 array('text', 'text'),
1757 array('common', $field)
1758 );
1759
1760 $row = array();
1761 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
1762 break;
1763 }
1764
1765 if (count($row) > 0) {
1766 $db->update(
1767 'settings',
1768 array(
1769 'value' => array('text', $session_settings[$field])
1770 ),
1771 array(
1772 'module' => array('text', 'common'),
1773 'keyword' => array('text', $field)
1774 )
1775 );
1776 } else {
1777 $db->insert(
1778 'settings',
1779 array(
1780 'module' => array('text', 'common'),
1781 'keyword' => array('text', $field),
1782 'value' => array('text', $session_settings[$field])
1783 )
1784 );
1785 }
1786
1787 $i++;
1788 }
1789 }
1790
1791 if ($i < 4) {
1792 $message = $this->lng->txt("session_settings_not_saved");
1793 } else {
1794 $message = $this->lng->txt("settings_saved");
1795 }
1796
1798 }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$i
Definition: disco.tpl.php:19
catch(Exception $e) $message

References $db, $i, $message, $query, $res, $row, ilDBConstants\FETCHMODE_ASSOC, ilSessionControl\getSettingFields(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ storeMasterPassword()

ilSetup::storeMasterPassword ( string  $raw)
Parameters
string$raw
Returns
bool Returns a boolean status, whether or not the password could be set successful

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

555 : bool
556 {
557 $this->ini->setVariable('setup', 'pass', $this->passwordManager->encodePassword($raw));
558
559 if ($this->ini->write() == false) {
560 $this->error = $this->ini->getError();
561 return false;
562 }
563
564 return true;
565 }

References error().

Referenced by loginAsAdmin(), and verifyMasterPassword().

+ Here is the call graph for this function:
+ Here is the caller 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 1507 of file class.ilSetup.php.

1508 {
1509 if (trim($a_convert_path) == "") {
1510 return "no_path_convert";
1511 }
1512 if (!is_file($a_convert_path)) {
1513 return "check_failed_convert";
1514 }
1515
1516 return "";
1517 }

Referenced by checkToolsSetup().

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

1526 {
1527 // ghostscript is optional, so empty path is ok
1528 if (trim($a_ghostscript_path) == "") {
1529 return "";
1530 }
1531 if (!is_file($a_ghostscript_path)) {
1532 return "check_failed_ghostscript";
1533 }
1534
1535 return "";
1536 }

Referenced by checkToolsSetup().

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

1545 {
1546 // java is optional, so empty path is ok
1547 if (trim($a_java_path) == "") {
1548 return "";
1549 }
1550
1551 if (!is_file($a_java_path)) {
1552 return "check_failed_java";
1553 }
1554
1555 return "";
1556 /*
1557 exec($a_java_path, $out, $back);
1558
1559 unset($out);
1560
1561 return ($back != 1) ? false : true;
1562 */
1563 }

Referenced by checkToolsSetup().

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

1572 {
1573 // latex is optional, so empty path is ok
1574 if (trim($a_latex_url) == "") {
1575 return "";
1576 }
1577
1578 // open the URL
1579 include_once "./setup/classes/class.ilHttpRequest.php";
1580 $http = new ilHttpRequest(ilUtil::stripSlashes($a_latex_url) . "?x_0");
1581 $result = @$http->downloadToString();
1582 if ((strpos((substr($result, 0, 5)), "PNG") !== false) || (strpos((substr($result, 0, 5)), "GIF") !== false)) {
1583 return "";
1584 } else {
1585 return "check_failed_latex";
1586 ;
1587 }
1588 }
$result
ilHttpRequest class
$http
Definition: raiseError.php:7

References $http, $result, and ilUtil\stripSlashes().

Referenced by checkToolsSetup().

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

1648 {
1649 if (trim($a_unzip_path) == "") {
1650 return "no_path_unzip";
1651 }
1652 if (!is_file($a_unzip_path)) {
1653 return "check_failed_unzip";
1654 }
1655
1656 return "";
1657 /*
1658 $curDir = getcwd();
1659
1660 chdir(ILIAS_ABSOLUTE_PATH);
1661
1662 if (file_exists(ILIAS_ABSOLUTE_PATH."/unzip_test_file.zip"))
1663 {
1664 $unzipCmd = $a_unzip_path." unzip_test_file.zip";
1665 exec($unzipCmd);
1666 }
1667
1668 chdir($curDir);
1669
1670 // check wether unzip extracted the test file or not
1671 if (file_exists(ILIAS_ABSOLUTE_PATH."/unzip_test_file.txt"))
1672 {
1673 unlink(ILIAS_ABSOLUTE_PATH."/unzip_test_file.txt");
1674
1675 return true;
1676 }
1677 else
1678 {
1679 return false;
1680 }
1681 */
1682 }

Referenced by checkToolsSetup().

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

1597 {
1598 if (trim($a_zip_path) == "") {
1599 return "no_path_zip";
1600 }
1601 if (!is_file($a_zip_path)) {
1602 return "check_failed_zip";
1603 }
1604
1605 return "";
1606 /*
1607 // create test file and run zip
1608 $fp = fopen(ILIAS_ABSOLUTE_PATH."/test.dat", "w");
1609
1610 fwrite($fp, "test");
1611 fclose($fp);
1612
1613 if (file_exists(ILIAS_ABSOLUTE_PATH."/test.dat"))
1614 {
1615 $curDir = getcwd();
1616 chdir(ILIAS_ABSOLUTE_PATH);
1617
1618 $zipCmd = $a_zip_path." -m zip_test_file.zip test.dat";
1619
1620 exec($zipCmd);
1621
1622 chdir($curDir);
1623
1624 }
1625
1626 // check wether zip generated test file or not
1627 if (file_exists(ILIAS_ABSOLUTE_PATH."/zip_test_file.zip"))
1628 {
1629 unlink(ILIAS_ABSOLUTE_PATH."/zip_test_file.zip");
1630 return true;
1631 }
1632 else
1633 {
1634 unlink(ILIAS_ABSOLUTE_PATH."/test.dat");
1635 return false;
1636 }
1637 */
1638 }

Referenced by checkToolsSetup().

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

1691 {
1692 //global $ilias;
1693
1694 $pathinfo = pathinfo($a_file);
1695 $dir = $pathinfo["dirname"];
1696 $file = $pathinfo["basename"];
1697
1698 // unzip
1699 $cdir = getcwd();
1700 chdir($dir);
1701 $unzip = $this->ini->readVariable("tools", "unzip");
1702 $unzipcmd = $unzip . " -Z -1 " . ilUtil::escapeShellArg($file);
1703 exec($unzipcmd, $arr);
1704 $zdirs = array();
1705
1706 foreach ($arr as $line) {
1707 if (is_int(strpos($line, "/"))) {
1708 $zdir = substr($line, 0, strrpos($line, "/"));
1709 $nr = substr_count($zdir, "/");
1710 //echo $zdir." ".$nr."<br>";
1711 while ($zdir != "") {
1712 $nr = substr_count($zdir, "/");
1713 $zdirs[$zdir] = $nr; // collect directories
1714 //echo $dir." ".$nr."<br>";
1715 $zdir = substr($zdir, 0, strrpos($zdir, "/"));
1716 }
1717 }
1718 }
1719
1720 asort($zdirs);
1721
1722 foreach ($zdirs as $zdir => $nr) { // create directories
1724 }
1725
1726 // real unzip
1727 if ($overvwrite) {
1728 $unzipcmd = $unzip . " " . ilUtil::escapeShellArg($file);
1729 } else {
1730 $unzipcmd = $unzip . " -o " . ilUtil::escapeShellArg($file);
1731 }
1732 exec($unzipcmd);
1733
1734 chdir($cdir);
1735 }
static escapeShellArg($a_arg)
static createDirectory($a_dir, $a_mod=0755)
create directory

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

+ Here is the call graph for this function:

◆ updateMasterSettings()

ilSetup::updateMasterSettings (   $a_formdata)

updates settings

Parameters
arrayform data
Returns
boolean

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

1158 {
1159 $convert_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["convert_path"]));
1160 $zip_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["zip_path"]));
1161 $unzip_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["unzip_path"]));
1162 $ghostscript_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["ghostscript_path"]));
1163 $java_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["java_path"]));
1164 //$mkisofs_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["mkisofs_path"]));
1165 $ffmpeg_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["ffmpeg_path"]));
1166 $latex_url = ilUtil::stripSlashes($a_formdata["latex_url"]);
1167 $fop_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["fop_path"]));
1168 $scan_type = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["vscanner_type"]));
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"]));
1172 $lessc_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["lessc_path"]));
1173 $phantomjs_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["phantomjs_path"]));
1174
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);
1180 //$this->ini->setVariable("tools", "mkisofs", $mkisofs_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);
1190
1191 $form_log_path = preg_replace("/\\\\/", "/", ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["log_path"])));
1192 $log_path = substr($form_log_path, 0, strrpos($form_log_path, "/"));
1193 $log_file = substr($form_log_path, strlen($log_path) + 1);
1194
1195 $error_log_path = preg_replace("/\\\\/", "/", ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["error_log_path"])));
1196
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"])));
1202
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"]);
1206
1207 if (!$this->ini->write()) {
1208 $this->error = get_class($this) . ": " . $this->ini->getError();
1209 return false;
1210 }
1211
1212 return true;
1213 }

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

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

199 {
200 return true;
201 //var_dump("<pre>",$this->client,"</pre>");exit;
202 //Error Handling disabled!! caused by missing PEAR
203 if ($a_old_client_id != $this->client->getId()) {
204 $this->saveNewClient();
205
206 ilUtil::delDir(ILIAS_ABSOLUTE_PATH . "/" . ILIAS_WEB_DIR . "/" . $a_old_client_id);
207 ilUtil::delDir(ILIAS_DATA_DIR . "/" . $a_old_client_id);
208 }
209
210 //everything okay
211 $this->ini_client_exists = true;
212
213 return true;
214 }
saveNewClient()
saves client.ini & updates client list in ilias.ini

References ilUtil\delDir(), and saveNewClient().

+ Here is the call graph for this function:

◆ verifyMasterPassword()

ilSetup::verifyMasterPassword ( string  $raw)
Parameters
string$raw
Returns
bool
Exceptions

ilUserException

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

572 : bool
573 {
574 $passwordReHashCallback = function ($raw) {
575 $this->storeMasterPassword($raw);
576 };
577
578 return $this->passwordManager->verifyPassword(
579 $this->getMasterPassword(),
580 $raw,
581 $passwordReHashCallback
582 );
583 }
getMasterPassword()

References getMasterPassword(), and storeMasterPassword().

+ Here is the call graph for this function:

Field Documentation

◆ $access_mode

ilSetup::$access_mode

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

◆ $auth

ilSetup::$auth

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

Referenced by isAuthenticated().

◆ $client

◆ $db

◆ $default_client

ilSetup::$default_client

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

◆ $dsn

ilSetup::$dsn = ""

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

◆ $error

ilSetup::$error = ""

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

Referenced by cloneFromSource(), and getError().

◆ $ilias_nic_server

ilSetup::$ilias_nic_server = "https://nic.ilias.de/index.php"

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

◆ $ini

ilSetup::$ini

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

◆ $ini_client_exists

ilSetup::$ini_client_exists = false

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

◆ $ini_file_path

ilSetup::$ini_file_path

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

◆ $ini_ilias_exists

ilSetup::$ini_ilias_exists = false

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

Referenced by isInstalled().

◆ $passwordManager

ilSetup::$passwordManager
protected

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

Referenced by __construct().

◆ $preliminaries

ilSetup::$preliminaries = true

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

◆ $preliminaries_result

ilSetup::$preliminaries_result = array()

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

◆ $safe_mode

ilSetup::$safe_mode

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

◆ $safe_mode_exec_dir

ilSetup::$safe_mode_exec_dir

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

◆ $setup_defaults

ilSetup::$setup_defaults

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

◆ $setup_password

ilSetup::$setup_password

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

◆ $SQL_FILE

ilSetup::$SQL_FILE = "./setup/sql/ilias3.sql"

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


The documentation for this class was generated from the following file: