ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilSetup Class Reference

Setup class. More...

+ Collaboration diagram for ilSetup:

Public Member Functions

 __construct ($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...
 
 getPassword ()
 get setup master password More...
 
 setPassword ($a_password)
 set setup master password More...
 
 loginAsClient ($a_auth_data)
 process client login More...
 
 loginAsAdmin ($a_password)
 process setup admin login More...
 
 newClient ($a_client_id=0)
 creates a client object in $this->client More...
 
 getStatus ($client=0)
 coumpute client status More...
 
 checkFinish (&$client)
 check if client setup was finished More...
 
 checkAccess (&$client)
 check client access status More...
 
 checkClientIni (&$client)
 check client ini status More...
 
 checkClientDatabase (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...
 

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 (   $a_auth,
  $a_auth_type 
)

constructor

Parameters
booleanuser is authenticated? (true) or not (false)
stringuser is admin or common user

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

72 {
73 global $lng;
74
75 $this->lng = $lng;
76
77 $this->db_connections = new ilDBConnections();
78
79 define("ILIAS_MODULE", "setup");
80
81 $this->auth = ($this->checkAuth()) ? true : false;
82 $this->access_mode = $a_auth_type;
83
84 // safe mode status & exec_dir
85 if ($this->safe_mode = ini_get("safe_mode")) {
86 $this->safe_mode_exec_dir = ilFile::deleteTrailingSlash(ini_get("safe_mode_exec_dir"));
87 }
88
89 // set path to ilias.ini
90 $this->ini_file_path = ILIAS_ABSOLUTE_PATH . "/ilias.ini.php";
91 $this->setup_defaults = ILIAS_ABSOLUTE_PATH . "/setup/ilias.master.ini.php";
92
93 // init setup.ini
94 $this->ini_ilias_exists = $this->init();
95
96 /*
97 if ($this->ini_ilias_exists)
98 {
99 if ($this->ini->readVariable("log","path") != "")
100 {
101 $log->path = $this->ini->readVariable("log","path");
102 }
103
104 if ($this->ini->readVariable("log","file") != "")
105 {
106 $log->filename = $this->ini->readVariable("log","file");
107 }
108
109 if ($this->ini->readVariable("log","enabled") != "")
110 {
111 $log->enabled = $this->ini->readVariable("log","enabled");
112 }
113 }
114 */
115 }
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
global $lng
Definition: privfeed.php:17

References $lng, 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 1467 of file class.ilSetup.php.

1468 {
1469 //if ($this->ini->readVariable("db","type") != "")
1470 //{
1471 // $this->db->disconnect();
1472 //}
1473 return true;
1474 }

◆ checkAccess()

ilSetup::checkAccess ( $client)

check client access status

Parameters
objectclient
Returns
boolean

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

765 {
766 if ($client->ini->readVariable("client", "access") == "1") {
767 $arr["status"] = true;
768 $arr["comment"] = $this->lng->txt("online");
769 } else {
770 $arr["status"] = false;
771 $arr["comment"] = $this->lng->txt("disabled");
772 }
773
774 return $arr;
775 }

References $client.

Referenced by getStatus().

+ Here is the caller graph for this function:

◆ checkAuth()

ilSetup::checkAuth ( )

check authentication status

Returns
boolean

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

368 {
369 if ($_SESSION["auth"] === true && $_SESSION["auth_path"] == ILIAS_HTTP_PATH) {
370 return true;
371 }
372
373 return false;
374 }
$_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 971 of file class.ilSetup.php.

972 {
973 $arr["status"] = true;
974 //$arr["comment"] = $this->lng->txt("filled_out");
975
976 $settings = $client->getAllSettings();
977 $client_name = $client->getName();
978
979 // check required fields
980 if (empty($settings["admin_firstname"]) or empty($settings["admin_lastname"]) or
981 empty($settings["admin_email"]) or empty($client_name)) {
982 $arr["status"] = false;
983 $arr["comment"] = $this->lng->txt("missing_data");
984 }
985
986 // admin email
987 if (!ilUtil::is_email($settings["admin_email"]) and $arr["status"] != false) {
988 $arr["status"] = false;
989 $arr["comment"] = $this->lng->txt("email_not_valid");
990 }
991
992 return $arr;
993 }
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 798 of file class.ilSetup.php.

799 {
800 $arr = array();
801 $client->provideGlobalDB();
802 if (!$arr["status"] = $client->db_exists) {
803 $arr["comment"] = $this->lng->txt("no_database");
804
805 return $arr;
806 }
807
808 if (!$arr["status"] = $client->db_installed) {
809 $arr["comment"] = $this->lng->txt("db_not_installed");
810
811 return $arr;
812 }
813 // TODO: move this to client class!!
814 $client->setup_ok = (bool) $client->getSetting("setup_ok");
815
816 include_once "./Services/Database/classes/class.ilDBUpdate.php";
817 $this->lng->setDbHandler($client->db);
818 $dbupdate = new ilDBUpdate($client->db);
819
820 if (!$arr["status"] = $dbupdate->getDBVersionStatus()) {
821 $arr["comment"] = $this->lng->txt("db_needs_update");
822 $arr["update"] = true;
823
824 return $arr;
825 } else {
826 if ($dbupdate->hotfixAvailable()) {
827 $arr["status"] = false;
828 $arr["comment"] = $this->lng->txt("hotfix_available");
829 $arr["update"] = true;
830
831 return $arr;
832 } else {
833 if ($dbupdate->customUpdatesAvailable()) {
834 $arr["status"] = false;
835 $arr["comment"] = $this->lng->txt("custom_updates_available");
836 $arr["update"] = true;
837
838 return $arr;
839 }
840 }
841 }
842
843 // check control information
844 global $ilDB;
845 $cset = $ilDB->query("SELECT count(*) as cnt FROM ctrl_calls");
846 $crec = $ilDB->fetchAssoc($cset);
847 $client->revokeGlobalDB();
848 if ($crec["cnt"] == 0) {
849 $arr["status"] = false;
850 $arr["comment"] = $this->lng->txt("db_control_structure_missing");
851 $arr["update"] = true;
852
853 return $arr;
854 }
855
856 return $arr;
857 }
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 782 of file class.ilSetup.php.

783 {
784 if (!$arr["status"] = $client->init()) {
785 $arr["comment"] = $client->getError();
786 } else {
787 //$arr["comment"] = "dir: /".ILIAS_WEB_DIR."/".$client->getId();
788 }
789
790 return $arr;
791 }

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

949 {
950 $client->provideGlobalDB();
951 $installed_langs = $this->lng->getInstalledLanguages();
952
953 $count = count($installed_langs);
954 $arr = array();
955 if ($count < 1) {
956 $arr["status"] = false;
957 $arr["comment"] = $this->lng->txt("lang_none_installed");
958 } else {
959 $arr["status"] = true;
960 //$arr["comment"] = $count." ".$this->lng->txt("languages_installed");
961 }
962 $client->revokeGlobalDB();
963 return $arr;
964 }

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

1001 {
1002 $settings = $client->getAllSettings();
1003
1004 if (!isset($settings["nic_enabled"])) {
1005 $arr["status"] = false;
1006 $arr["comment"] = $this->lng->txt("nic_not_disabled");
1007 return $arr;
1008 }
1009
1010 $arr["status"] = true;
1011
1012 if ($settings["nic_enabled"] == "-1") {
1013 $arr["comment"] = $this->lng->txt("nic_reg_failed");
1014 return $arr;
1015 }
1016
1017 if (!$settings["nic_enabled"]) {
1018 $arr["comment"] = $this->lng->txt("nic_reg_disabled");
1019 } else {
1020 $arr["comment"] = $this->lng->txt("nic_reg_enabled");
1021 if ($settings["inst_id"] <= 0) {
1022 $arr["status"] = false;
1023 }
1024 }
1025
1026 return $arr;
1027 }

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

908 {
909 $client->provideGlobalDB();
910 global $ilDB;
911 $arr = array();
912 $fields = array( 'proxy_status', 'proxy_host', 'proxy_port' );
913
914 $query = "SELECT keyword, value FROM settings WHERE " . $ilDB->in('keyword', $fields, false, 'text');
915 $res = $ilDB->query($query);
916
917 $proxy_settings = array();
918 $already_saved = false;
919 while ($row = $ilDB->fetchAssoc($res)) {
920 $already_saved = true;
921 $proxy_settings[$row['keyword']] = $row['value'];
922 }
923
924 if (!$already_saved) {
925 $arr["status"] = false;
926 $arr["comment"] = $this->lng->txt("proxy");
927 $arr["text"] = $this->lng->txt("proxy");
928 } else {
929 if ((bool) $proxy_settings["proxy_status"] == false) {
930 $arr["status"] = true;
931 $arr["comment"] = $this->lng->txt("proxy_disabled");
932 $arr["text"] = $this->lng->txt("proxy_disabled");
933 } else {
934 $arr["status"] = true;
935 $arr["comment"] = $this->lng->txt("proxy_activated_configurated");
936 $arr["text"] = $this->lng->txt("proxy_activated_configurated");
937 }
938 }
939
940 return $arr;
941 }
$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 864 of file class.ilSetup.php.

865 {
866 require_once('Services/Authentication/classes/class.ilSessionControl.php');
867
868 global $ilDB;
869 $db = $ilDB;
870
872
873 $query = "SELECT keyword, value FROM settings WHERE " . $db->in('keyword', $fields, false, 'text');
874 $res = $db->query($query);
875
876 $rows = array();
877 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
878 if ($row['value'] != '') {
879 $rows[] = $row;
880 } else {
881 break;
882 }
883 }
884
885 if (count($rows) != count($fields)) {
886 if ($a_as_bool) {
887 return false;
888 }
889 $arr["status"] = false;
890 $arr["comment"] = $this->lng->txt("session_management_not_configured");
891 } else {
892 if ($a_as_bool) {
893 return true;
894 }
895 $arr["status"] = true;
896 $arr["comment"] = $this->lng->txt("session_management_configured");
897 }
898
899 return $arr;
900 }
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 311 of file class.ilSetup.php.

312 {
313 global $sess;
314
315 if ($sess->usesCookies) {
316 $arr["status"] = true;
317 $arr["comment"] = "";
318 } else {
319 $arr["status"] = false;
320 $arr["comment"] = $this->lng->txt("pre_cookies_disabled");
321 }
322
323 return $arr;
324 }

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

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

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

1317 {
1318 // remove trailing slash & convert backslashes to forwardslashes
1319 $datadir_path = preg_replace("/\\\\/", "/", ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["datadir_path"])));
1320
1321 if (empty($datadir_path)) {
1322 $this->error = "no_path_datadir";
1323 return false;
1324 }
1325
1326 $webspace_dir = ILIAS_ABSOLUTE_PATH . "/data";
1327
1328 // datadir may not point to webspace dir or to any place under webspace_dir
1329 if (strpos($datadir_path, $webspace_dir) !== false) {
1330 $this->error = "datadir_webspacedir_match";
1331 return false;
1332 }
1333
1334 // create dir
1335 if ($a_formdata["chk_datadir_path"] == 1) {
1336 $dir_to_create = substr(strrchr($datadir_path, "/"), 1);
1337 $dir_to_check = substr($datadir_path, 0, -strlen($dir_to_create)-1);
1338
1339 if ($this->isDirectoryInOther($dir_to_create, ILIAS_ABSOLUTE_PATH)) {
1340 $this->error = "cannot_create_datadir_inside_webdir";
1341 return false;
1342 }
1343
1344 if (is_writable($datadir_path)) {
1345 $this->error = "dir_exists_create";
1346 return false;
1347 }
1348
1349 if (!is_writable($dir_to_check)) {
1350 $this->error = "cannot_create_datadir_no_write_access";
1351 return false;
1352 }
1353 } else { // check set target dir
1354 if ($this->isDirectoryInOther($datadir_path, ILIAS_ABSOLUTE_PATH)) {
1355 $this->error = "cannot_create_datadir_inside_webdir";
1356 return false;
1357 }
1358
1359 if (!is_writable($datadir_path)) {
1360 $this->error = "cannot_create_datadir_no_write_access";
1361 return false;
1362 }
1363 }
1364
1365 return true;
1366 }
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 381 of file class.ilSetup.php.

382 {
383 global $ilDB;
384
385 if (class_exists("DOMDocument")) {
386 $arr["status"] = true;
387 } else {
388 $arr["status"] = false;
389 $arr["comment"] = $this->lng->txt("pre_dom_missing");
390 }
391
392 return $arr;
393 }

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

1432 {
1433 // remove trailing slash & convert backslashes to forwardslashes
1434 $clean_error_log_path = preg_replace("/\\\\/", "/", ilFile::deleteTrailingSlash(ilUtil::stripSlashes($error_log_path)));
1435
1436 if (!empty($clean_error_log_path)) {
1437 if (!ilUtil::makeDirParents($clean_error_log_path)) {
1438 $this->error = "could_not_create_error_directory";
1439 return false;
1440 }
1441 }
1442
1443 return true;
1444 }
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 746 of file class.ilSetup.php.

747 {
748 if ($client->getSetting("setup_ok")) {
749 $arr["status"] = true;
750 //$arr["comment"] = $this->lng->txt("setup_finished");
751 } else {
752 $arr["status"] = false;
753 $arr["comment"] = $this->lng->txt("setup_not_finished");
754 }
755
756 return $arr;
757 }

References $client.

Referenced by getStatus().

+ Here is the caller graph for this function:

◆ checkGd()

ilSetup::checkGd ( )

Check MySQL.

Returns
boolean

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

421 {
422 global $ilDB;
423
424 if (function_exists("imagefill") && function_exists("imagecolorallocate")) {
425 $arr["status"] = true;
426 } else {
427 $arr["status"] = false;
428 $arr["comment"] = sprintf(
429 $this->lng->txt("pre_gd_missing"),
430 "http://php.net/manual/en/book.image.php"
431 );
432 }
433
434 return $arr;
435 }
sprintf('%.4f', $callTime)

References $ilDB, and sprintf.

Referenced by queryPreliminaries().

+ Here is the caller graph for this function:

◆ checkIniFileExists()

ilSetup::checkIniFileExists ( )

check if inifile exists

Returns
boolean

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

252 {
253 $a = @file_exists($this->INI_FILE);
254 return $a;
255 }

◆ checkLogSetup()

ilSetup::checkLogSetup (   $a_formdata)

check log path

Parameters
arrayform data
Returns
boolean

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

1394 {
1395 // log path
1396 if (!$a_formdata["chk_log_status"]) {
1397 // remove trailing slash & convert backslashes to forwardslashes
1398 $log_path = preg_replace("/\\\\/", "/", ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["log_path"])));
1399
1400 if (empty($log_path)) {
1401 $this->error = "no_path_log";
1402 return false;
1403 }
1404
1405 if (is_dir($log_path)) {
1406 $this->error = 'could_not_create_logfile';
1407 return false;
1408 }
1409
1410 if ($this->isDirectoryInOther($log_path, ILIAS_ABSOLUTE_PATH)) {
1411 $this->error = "cannot_create_logdir_inside_webdir";
1412 return false;
1413 }
1414
1415 if (!@touch($log_path)) {
1416 $this->error = "could_not_create_logfile";
1417 return false;
1418 }
1419 }
1420
1421 return true;
1422 }

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

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

References $ilDB.

Referenced by queryPreliminaries().

+ Here is the caller graph for this function:

◆ checkMySQL()

ilSetup::checkMySQL ( )

Check MySQL.

Returns
boolean

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

349 {
350 global $ilDB;
351
352 if (function_exists("mysql_query")) {
353 $arr["status"] = true;
354 $arr["comment"] = $this->lng->txt("pre_mysql_4_1_or_higher");
355 } else {
356 $arr["status"] = false;
357 $arr["comment"] = $this->lng->txt("pre_mysql_missing");
358 }
359
360 return $arr;
361 }

References $ilDB.

◆ checkOpcacheSettings()

ilSetup::checkOpcacheSettings ( )
protected
Returns
array

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

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

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

1374 {
1375 if (!$a_formdata["setup_pass"]) {
1376 $this->error = "no_setup_pass_given";
1377 return false;
1378 }
1379
1380 if ($a_formdata["setup_pass"] != $a_formdata["setup_pass2"]) {
1381 $this->error = "pass_does_not_match";
1382 return false;
1383 }
1384
1385 return true;
1386 }

References error().

+ Here is the call graph for this function:

◆ checkPHPVersion()

ilSetup::checkPHPVersion ( )

check for PHP version

Returns
array

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

331 {
332 $version = PHP_VERSION;
333
334 $arr["status"] = true;
335 $arr["comment"] = "PHP " . $version;
336 if (version_compare($version, '5.3.0', '<')) {
337 $arr["status"] = false;
338 $arr["comment"] = "PHP " . $version . ". " . $this->lng->txt("pre_php_version_too_low");
339 }
340
341 return $arr;
342 }

References $version.

Referenced by queryPreliminaries().

+ Here is the caller graph for this function:

◆ checkPreliminaries()

ilSetup::checkPreliminaries ( )

check all prliminaries

Returns
boolean

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

524 {
525 $this->preliminaries_result = $this->queryPreliminaries();
526
527 foreach ($this->preliminaries_result as $val) {
528 if ($val["status"] === false) {
529 $this->preliminaries = false;
530 return false;
531 }
532 }
533
534 return true;
535 }
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 1195 of file class.ilSetup.php.

1196 {
1197 // convert path
1198 if (!isset($a_formdata["chk_convert_path"])) {
1199 // convert backslashes to forwardslashes
1200 $convert_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["convert_path"]));
1201
1202 if (($err = $this->testConvert($convert_path)) != "") {
1203 $this->error = $err;
1204 return false;
1205 }
1206 }
1207
1208 // zip path
1209 if (!isset($a_formdata["chk_zip_path"])) {
1210 // convert backslashes to forwardslashes
1211 $zip_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["zip_path"]));
1212
1213 if (empty($zip_path)) {
1214 $this->error = "no_path_zip";
1215 return false;
1216 }
1217
1218 if (!$this->testZip($zip_path)) {
1219 $this->error = "check_failed_zip";
1220 return false;
1221 }
1222 }
1223
1224 // unzip path
1225 if (!isset($a_formdata["chk_unzip_path"])) {
1226 // convert backslashes to forwardslashes
1227 $unzip_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["unzip_path"]));
1228
1229 if (empty($unzip_path)) {
1230 $this->error = "no_path_unzip";
1231 return false;
1232 }
1233
1234 if (!$this->testUnzip($unzip_path)) {
1235 $this->error = "check_failed_unzip";
1236 return false;
1237 }
1238 }
1239
1240 // ghostscript path
1241 if (!isset($a_formdata["chk_ghostscript_path"])) {
1242 // convert backslashes to forwardslashes
1243 $ghostscript_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["ghostscript_path"]));
1244
1245 if (($err = $this->testGhostscript($ghostscript_path)) != "") {
1246 $this->error = $err;
1247 return false;
1248 }
1249 }
1250
1251 // java path
1252 if (!isset($a_formdata["chk_java_path"])) {
1253 // convert backslashes to forwardslashes
1254 $java_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["java_path"]));
1255
1256 if (empty($java_path)) {
1257 $this->error = "no_path_java";
1258 return false;
1259 }
1260
1261 if (!$this->testJava($java_path)) {
1262 $this->error = "check_failed_java";
1263 return false;
1264 }
1265 }
1266
1267 /*if (!isset($a_formdata["chk_mkisofs_path"]))
1268 {
1269 // convert backslashes to forwardslashes
1270 $mkisofs_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["mkisofs_path"]));
1271
1272 if (empty($mkisofs_path))
1273 {
1274 $this->error = "no_path_mkisofs";
1275 return false;
1276 }
1277 }*/
1278
1279 if (!isset($a_formdata["chk_ffmpeg_path"])) {
1280 // convert backslashes to forwardslashes
1281 $ffmpeg_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["ffmpeg_path"]));
1282
1283 if (empty($ffmpeg_path)) {
1284 $this->error = "no_path_ffmpeg";
1285 return false;
1286 }
1287
1288 if (!$this->testFFMpeg($ffmpeg_path)) {
1289 $this->error = "check_failed_ffmpeg";
1290 return false;
1291 }
1292 }
1293
1294 // latex url
1295 if (!isset($a_formdata["chk_latex_url"])) {
1296 $latex_url = ilUtil::stripSlashes($a_formdata["latex_url"]);
1297 if (empty($latex_url)) {
1298 $this->error = "no_latex_url";
1299 return false;
1300 }
1301
1302 if (!$this->testLatex($latex_url)) {
1303 $this->error = "check_failed_latex";
1304 return false;
1305 }
1306 }
1307
1308 return true;
1309 }
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 262 of file class.ilSetup.php.

263 {
264 clearstatcache();
265 if (is_writable(".")) {
266 $arr["status"] = true;
267 //$cdir = getcwd();
268 //chdir("..");
269 $arr["comment"] = getcwd();
270 //chdir($cdir);
271 } else {
272 $arr["status"] = false;
273 $arr["comment"] = $this->lng->txt("pre_folder_write_error");
274 //$cdir = getcwd();
275 //chdir("..");
276 $arr["comment"] = getcwd() . ": " . $arr["comment"];
277 //chdir($cdir);
278 }
279
280 return $arr;
281 }

Referenced by queryPreliminaries().

+ Here is the caller graph for this function:

◆ checkXsl()

ilSetup::checkXsl ( )

Check MySQL.

Returns
boolean

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

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

References $ilDB, and sprintf.

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

1842 {
1843 // Getting source and targets
1844 $source = new ilClient($source_id, $this->db_connections);
1845 $source->init();
1847
1848 // ************************************************
1849 // ** COPY FILES
1850
1851 // Cleaning up datadir
1852 if (!ilUtil::delDir($target->getDataDir())) {
1853 $this->error = "Could not delete data dir $target->getDataDir()";
1854 //return false;
1855 }
1856
1857 // Create empty datadir
1858 if (!ilUtil::makeDir($target->getDataDir())) {
1859 $this->error = "could_not_create_base_data_dir :" . $target->getDataDir();
1860 return false;
1861 }
1862
1863 // Copying datadir
1864 if (!ilUtil::rCopy($source->getDataDir(), $target->getDataDir())) {
1865 $this->error = "clone_datadircopyfail";
1866 $target->ini->write();
1867 return false;
1868 }
1869
1870 // Cleaning up Webspacedir
1871 if (!ilUtil::delDir($target->getWebspaceDir())) {
1872 $this->error = "Could not delete webspace dir $target->getWebspaceDir()";
1873 //return false;
1874 }
1875
1876 // Create empty Webspacedir
1877 if (!ilUtil::makeDir($target->getWebspaceDir())) {
1878 $this->error = "could_not_create_base_webspace_dir :" . $target->getWebspaceDir();
1879 return false;
1880 }
1881
1882 // Copying Webspacedir
1883 if (!ilUtil::rCopy($source->getWebspaceDir(), $target->getWebspaceDir())) {
1884 $this->error = "clone_websipacedircopyfail";
1885 $target->ini->write();
1886 return false;
1887 }
1888
1889 // Restore ini file
1890 $target->ini->write();
1891
1892 // ************************************************
1893 // ** COPY DATABASE
1894
1895 $source->connect();
1896 if (!$source->db) {
1897 $this->error = "Source database connection failed.";
1898 return false;
1899 }
1900
1901 $target->connect();
1902 if (!$target->db) {
1903 $this->error = "Target database connection failed.";
1904 return false;
1905 }
1906
1907 $source->connect();
1908 $srcTables = $source->db->query("SHOW TABLES");
1909 $target->connect();
1910
1911 // drop all tables of the target db
1912 $tarTables = $target->db->query("SHOW TABLES");
1913 foreach ($tarTables->fetchAll() as $cTable) {
1914 $target->db->query("DROP TABLE IF EXISTS " . $cTable[0]);
1915 }
1916
1917 foreach ($srcTables->fetchAll() as $cTable) {
1918 $drop = $target->db->query("DROP TABLE IF EXISTS " . $cTable[0]);
1919 $create = $target->db->query("CREATE TABLE " . $cTable[0] . " LIKE " . $source->getDbName() . "." . $cTable[0]);
1920 if (!$create) {
1921 $error = true;
1922 }
1923 $insert = $target->db->query("INSERT INTO " . $cTable[0] . " SELECT * FROM " . $source->getDbName() . "." . $cTable[0]);
1924 }
1925
1926 $target->db->query("UPDATE settings SET VALUE = " . $target->db->quote(0, "integer") . " WHERE keyword = " . $target->db->quote("inst_id", "text"));
1927 $target->db->query("UPDATE settings SET VALUE = " . $target->db->quote(0, "integer") . " WHERE keyword = " . $target->db->quote("nic_enabled", "text"));
1928 return true;
1929 }
$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 ...
$insert

References $client, $error, $insert, $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 214 of file class.ilSetup.php.

215 {
216 if ($this->client->getDBSetup()->isDatabaseInstalled()) {
217 $this->error = $this->lng->txt("database_exists");
218
219 return false;
220 }
221
222 $db_setup = $this->client->getDBSetup();
223 return $db_setup->createDatabase($a_collation);
224 }

References error().

+ Here is the call graph for this function:

◆ getClient()

ilSetup::getClient ( )
Returns
ilClient

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

137 {
138 return $this->client;
139 }

References $client.

◆ getError()

ilSetup::getError ( )

get Error message

Returns
string error message

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

1451 {
1452 if (empty($this->error)) {
1453 return false;
1454 }
1455
1457 $this->error = "";
1458
1459 return $error;
1460 }

References $error, and error().

+ Here is the call graph for this function:

◆ getPassword()

ilSetup::getPassword ( )

get setup master password

Returns
string

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

542 {
543 return $this->ini->readVariable("setup", "pass");
544 }

◆ getSessionSettings()

ilSetup::getSessionSettings ( )

reads session settings from db

Returns
array session_settings

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

1781 {
1782 require_once('Services/Authentication/classes/class.ilSessionControl.php');
1783
1784 $db = $this->client->getDB();
1785
1786 $setting_fields = ilSessionControl::getSettingFields();
1787
1788 $query = "SELECT * FROM settings WHERE module = %s " .
1789 "AND " . $db->in('keyword', $setting_fields, false, 'text');
1790
1791 $res = $db->queryF($query, array('text'), array('common'));
1792
1793 $session_settings = array();
1794 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
1795 $session_settings[$row['keyword']] = $row['value'];
1796 }
1797
1798 foreach ($setting_fields as $field) {
1799 if (!isset($session_settings[$field])) {
1800 $value = 1;
1801
1802 switch ($field) {
1803 case 'session_max_count':
1804
1806 break;
1807
1808 case 'session_min_idle':
1809
1811 break;
1812
1813 case 'session_max_idle':
1814
1816 break;
1817
1818 case 'session_max_idle_after_first_request':
1819
1821 break;
1822
1823 case 'session_allow_client_maintenance':
1824
1826 break;
1827 }
1828
1829 $session_settings[$field] = $value;
1830 }
1831 }
1832
1833 return $session_settings;
1834 }
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 701 of file class.ilSetup.php.

702 {
703 if (!is_object($client)) {
704 if ($this->ini_client_exists) {
706 } else {
707 $client = new ilClient(0, $this->db_connections);
708 }
709 }
710
711 $status = array();
712 $status["ini"] = $this->checkClientIni($client); // check this one
713 $status["db"] = $this->checkClientDatabase($client);
714 if ($status["db"]["status"] === false and $status["db"]["update"] !== true) {
715 //$status["sess"]["status"] = false;
716 //$status["sess"]["comment"] = $status["db"]["comment"];
717 $status["lang"]["status"] = false;
718 $status["lang"]["comment"] = $status["db"]["comment"];
719 $status["contact"]["status"] = false;
720 $status["contact"]["comment"] = $status["db"]["comment"];
721
722 $status["proxy"]["status"] = false;
723 $status["proxy"]["comment"] = $status["db"]["comment"];
724
725 $status["nic"]["status"] = false;
726 $status["nic"]["comment"] = $status["db"]["comment"];
727 } else {
728 //$status["sess"] = $this->checkClientSessionSettings($client);
729 $status["lang"] = $this->checkClientLanguages($client);
730 $status["contact"] = $this->checkClientContact($client);
731 $status["proxy"] = $this->checkClientProxySettings($client);
732 $status["nic"] = $this->checkClientNIC($client);
733 $status["finish"] = $this->checkFinish($client);
734 $status["access"] = $this->checkAccess($client);
735 }
736
737 //return value
738 return $status;
739 }
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 2009 of file class.ilSetup.php.

2010 {
2011 $ini_get = ini_get('opcache.enable');
2012
2013 return ($ini_get === 1 or $ini_get === '1' or strtolower($ini_get) === 'on');
2014 }

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

147 {
148 // load data from setup.ini file
149 $this->ini = new ilIniFile($this->ini_file_path);
150
151 if (!$this->ini->read()) {
152 $this->ini->GROUPS = parse_ini_file($this->setup_defaults, true);
153 $this->error = get_class($this) . ": " . $this->ini->getError();
154 return false;
155 }
156
157 $this->setup_password = $this->ini->readVariable("setup", "pass");
158 $this->default_client = $this->ini->readVariable("clients", "default");
159
160 define("ILIAS_DATA_DIR", $this->ini->readVariable("clients", "datadir"));
161 define("ILIAS_WEB_DIR", $this->ini->readVariable("clients", "path"));
162
163 return true;
164 }
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 231 of file class.ilSetup.php.

232 {
233 if (!$this->client->getDBSetup()->isDatabaseConnectable()) {
234 return false;
235 }
236
237 if ($this->client->getDBSetup()->installDatabase()) {
238 $this->client->db_installed = true;
239
240 return true;
241 }
242
243 return false;
244 }

◆ isAdmin()

ilSetup::isAdmin ( )

check if current user is admin

Returns
boolean

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

1052 {
1053 return ($this->access_mode == "admin") ? true : false;
1054 }

◆ isAuthenticated()

ilSetup::isAuthenticated ( )

check if current user is authenticated

Returns
boolean

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

1043 {
1044 return $this->auth;
1045 }

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

2038 {
2039 $other_directory = $other_directory . "/";
2040
2041 return !(strpos($directory, $other_directory) !== 0);
2042 }

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

1034 {
1036 }

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

2023 {
2024 if (!preg_match("/^[A-Za-z0-9]+$/", $a_client_id)) {
2025 return false;
2026 }
2027 return true;
2028 }

◆ loginAsAdmin()

ilSetup::loginAsAdmin (   $a_password)

process setup admin login

Parameters
stringpassword
Returns
boolean

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

658 {
659 $a_password = md5($a_password);
660
661 if ($this->ini->readVariable("setup", "pass") == $a_password) {
662 $_SESSION["auth"] = true;
663 $_SESSION["auth_path"] = ILIAS_HTTP_PATH;
664 $_SESSION["access_mode"] = "admin";
665 return true;
666 }
667
668 return false;
669 }

References $_SESSION.

◆ loginAsClient()

ilSetup::loginAsClient (   $a_auth_data)

process client login

Parameters
array
Returns
boolean

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

569 {
570 global $ilDB;
571
572 if (empty($a_auth_data["client_id"])) {
573 $this->error = "no_client_id";
574 return false;
575 }
576
577 if (empty($a_auth_data["username"])) {
578 $this->error = "no_username";
579 return false;
580 }
581
582 if (empty($a_auth_data["password"])) {
583 $this->error = "no_password";
584 return false;
585 }
586
587 if (!$this->newClient($a_auth_data["client_id"])) { //TT: comment out to get around null db
588 $this->error = "unknown_client_id";
589 unset($this->client);
590 return false;
591 }
592
593 if (!$this->client->db_exists) {
594 $this->error = "no_db_connect_consult_admin";
595 unset($this->client);
596 return false;
597 }
598
599 $s1 = $this->client->db->query("SELECT value from settings WHERE keyword = " .
600 $this->client->db->quote('system_role_id', 'text'));
601 $r1 = $this->client->db->fetchAssoc($s1);
602 $system_role_id = $r1["value"];
603
604 $add_usrfields = '';
605 if ($this->client->db->tableColumnExists('usr_data', 'passwd_enc_type')) {
606 $add_usrfields .= ' , usr_data.passwd_enc_type, usr_data.passwd_salt ';
607 }
608 $q = "SELECT usr_data.usr_id, usr_data.passwd $add_usrfields " .
609 "FROM usr_data " .
610 "LEFT JOIN rbac_ua ON rbac_ua.usr_id=usr_data.usr_id " .
611 "WHERE rbac_ua.rol_id = " . $this->client->db->quote((int) $system_role_id, 'integer') . " " .
612 "AND usr_data.login=" . $this->client->db->quote($a_auth_data["username"], 'text');
613 $r = $this->client->db->query($q);
614 if (!$this->client->db->numRows($r)) {
615 $this->error = 'login_invalid';
616 return false;
617 }
618
619 $data = $this->client->db->fetchAssoc($r);
620
621 global $ilClientIniFile;
622
623 $ilClientIniFile = $this->client->ini;
624
625 require_once 'Services/User/classes/class.ilUserPasswordManager.php';
626 $crypt_type = ilUserPasswordManager::getInstance()->getEncoderName();
627 if (strlen($add_usrfields) && ilUserPasswordManager::getInstance()->isEncodingTypeSupported($crypt_type)) {
628 require_once 'setup/classes/class.ilObjSetupUser.php';
629 $user = new ilObjSetupUser();
630 $user->setPasswd($data['passwd'], IL_PASSWD_CRYPTED);
631 $user->setPasswordEncodingType($data['passwd_enc_type']);
632 $user->setPasswordSalt($data['passwd_salt']);
633
634 $password_valid = ilUserPasswordManager::getInstance()->verifyPassword($user, $a_auth_data['password']);
635 } else {
636 $password_valid = $data['passwd'] == md5($a_auth_data['password']);
637 }
638
639 if ($password_valid) {
640 // all checks passed -> user valid
641 $_SESSION['auth'] = true;
642 $_SESSION['auth_path'] = ILIAS_HTTP_PATH;
643 $_SESSION['access_mode'] = 'client';
644 $_SESSION['ClientId'] = $this->client->getId();
645 return true;
646 } else {
647 $this->error = 'login_invalid';
648 return false;
649 }
650 }
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

References $_SESSION, $data, $ilDB, $r, 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 676 of file class.ilSetup.php.

677 {
678 if (!$this->isInstalled()) {
679 return false;
680 }
681
682 $this->client = new ilClient($a_client_id, $this->db_connections);
683
684 if (!$this->client->init()) {
685 //echo "<br>noclientinit";
686 $this->error = get_class($this) . ": " . $this->client->getError();
687 $_SESSION["ClientId"] = "";
688 return false;
689 }
690
691 $_SESSION["ClientId"] = $a_client_id;
692
693 return true;
694 }
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 1937 of file class.ilSetup.php.

1938 {
1939 require_once './Services/Http/exceptions/class.ilProxyException.php';
1940 $settings = $client->getAllSettings();
1941
1942 if ((bool) $settings['proxy_status'] == true) {
1943 try {
1944 $err_str = false;
1945 $wait_timeout = 100;
1946
1947 $fp = @fsockopen($settings['proxy_host'], $settings['proxy_port'], $err_code, $err_str, $wait_timeout);
1948
1949 if ($err_str) {
1950 throw new ilProxyException($err_str);
1951 }
1952
1953 fclose($fp);
1954
1955 ilUtil::sendSuccess($this->lng->txt('proxy_connectable'));
1956 } catch (Exception $e) {
1957 ilUtil::sendFailure($this->lng->txt('proxy_not_connectable') . ": " . $e->getMessage());
1958 }
1959 }
1960 }
Class for proxy related exception handling in ILIAS.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

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

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

500 {
501 $a = array();
502 $a["php"] = $this->checkPHPVersion();
503 // $a["mysql"] = $this->checkMySQL();
504 $a["root"] = $this->checkWritable();
505 $a["folder_create"] = $this->checkCreatable();
506 $a["cookies_enabled"] = $this->checkCookiesEnabled();
507 $a["dom"] = $this->checkDom();
508 $a["xsl"] = $this->checkXsl();
509 $a["gd"] = $this->checkGd();
510 $a["memory"] = $this->checkMemoryLimit();
511
512 if ($this->hasOpCacheEnabled()) {
513 $a["load_comments"] = $this->checkOpcacheSettings();
514 }
515
516 return $a;
517 }
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 1061 of file class.ilSetup.php.

1062 {
1063 $datadir_path = preg_replace("/\\\\/", "/", ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["datadir_path"])));
1064
1065 if ($a_formdata["chk_datadir_path"] == 1) { // mode create dir
1066 if (!ilUtil::makeDir($datadir_path)) {
1067 $this->error = "create_datadir_failed";
1068 return false;
1069 }
1070 }
1071
1072 // create webspace dir if it does not exist
1073 if (!@file_exists(ILIAS_ABSOLUTE_PATH . "/" . $this->ini->readVariable("clients", "path")) and !@is_dir(ILIAS_ABSOLUTE_PATH . "/" . $this->ini->readVariable("clients", "path"))) {
1074 if (!ilUtil::makeDir(ILIAS_ABSOLUTE_PATH . "/" . $this->ini->readVariable("clients", "path"))) {
1075 $this->error = "create_webdir_failed";
1076 return false;
1077 }
1078 }
1079
1080 $form_log_path = preg_replace("/\\\\/", "/", ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["log_path"])));
1081 $log_path = substr($form_log_path, 0, strrpos($form_log_path, "/"));
1082 $log_file = substr($form_log_path, strlen($log_path)+1);
1083 $error_log_path = preg_replace("/\\\\/", "/", ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["error_log_path"])));
1084
1085 $this->ini->setVariable("server", "http_path", ILIAS_HTTP_PATH);
1086 $this->ini->setVariable("server", "absolute_path", ILIAS_ABSOLUTE_PATH);
1087 $this->ini->setVariable("server", "timezone", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["time_zone"])));
1088 $this->ini->setVariable("clients", "datadir", $datadir_path);
1089 $this->ini->setVariable("tools", "convert", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["convert_path"])));
1090 $this->ini->setVariable("tools", "zip", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["zip_path"])));
1091 $this->ini->setVariable("tools", "unzip", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["unzip_path"])));
1092 $this->ini->setVariable("tools", "ghostscript", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["ghostscript_path"])));
1093 $this->ini->setVariable("tools", "java", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["java_path"])));
1094 //$this->ini->setVariable("tools", "mkisofs", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["mkisofs_path"])));
1095 $this->ini->setVariable("tools", "ffmpeg", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["ffmpeg_path"])));
1096 $this->ini->setVariable("tools", "latex", ilUtil::stripSlashes($a_formdata["latex_url"]));
1097 $this->ini->setVariable("tools", "vscantype", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["vscanner_type"])));
1098 $this->ini->setVariable("tools", "scancommand", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["scan_command"])));
1099 $this->ini->setVariable("tools", "cleancommand", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["clean_command"])));
1100 $this->ini->setVariable("tools", "enable_system_styles_management", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["enable_system_styles_management"])));
1101 $this->ini->setVariable("tools", "lessc", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["lessc_path"])));
1102 $this->ini->setVariable("tools", "phantomjs", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["phantomjs_path"])));
1103
1104 $this->ini->setVariable("setup", "pass", md5($a_formdata["setup_pass"]));
1105 $this->ini->setVariable("log", "path", $log_path);
1106 $this->ini->setVariable("log", "file", $log_file);
1107 $this->ini->setVariable("log", "enabled", ($a_formdata["chk_log_status"]) ? "0" : 1);
1108 $this->ini->setVariable("log", "error_path", $error_log_path);
1109
1110 $this->ini->setVariable("https", "auto_https_detect_enabled", ($a_formdata["auto_https_detect_enabled"]) ? 1 : 0);
1111 $this->ini->setVariable("https", "auto_https_detect_header_name", $a_formdata["auto_https_detect_header_name"]);
1112 $this->ini->setVariable("https", "auto_https_detect_header_value", $a_formdata["auto_https_detect_header_value"]);
1113
1114 if (!$this->ini->write()) {
1115 $this->error = get_class($this) . ": " . $this->ini->getError();
1116 return false;
1117 }
1118
1119 // everything is fine. so we authenticate the user and set access mode to 'admin'
1120 $_SESSION["auth"] = true;
1121 $_SESSION["auth_path"] = ILIAS_HTTP_PATH;
1122 $_SESSION["access_mode"] = "admin";
1123
1124 return true;
1125 }

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

171 {
172 // save client id to session
173 $_SESSION["ClientId"] = $this->client->getId();
174
175 // create client
176 if (!$this->client->create()) {
177 $this->error = $this->client->getError();
178 return false;
179 }
180
181 //everything okay
182 $this->ini_client_exists = true;
183
184 return true;
185 }

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

1963 {
1964 $db = $this->client->getDB();
1965 $proxy_fields = array('proxy_status','proxy_host','proxy_port');
1966
1967 foreach ($proxy_fields as $field) {
1968 if (isset($proxy_settings[$field])) {
1969 $query = "SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
1970 $res = $db->queryF(
1971 $query,
1972 array('text', 'text'),
1973 array('common', $field)
1974 );
1975
1976 $row = array();
1977 while ($row = $db->fetchAssoc($res)) {
1978 break;
1979 }
1980
1981 if (is_array($row) && count($row) > 0) {
1982 $db->update(
1983 'settings',
1984 array(
1985 'value' => array('text', $proxy_settings[$field])
1986 ),
1987 array(
1988 'module' => array('text', 'common'),
1989 'keyword' => array('text', $field)
1990 )
1991 );
1992 } else {
1993 $db->insert(
1994 'settings',
1995 array(
1996 'module' => array('text', 'common'),
1997 'keyword' => array('text', $field),
1998 'value' => array('text', $proxy_settings[$field])
1999 )
2000 );
2001 }
2002 }
2003 }
2004 }

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

◆ setClient()

ilSetup::setClient (   $a_cl)
Parameters
$a_cl

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

128 {
129 $this->client = $a_cl;
130 }

◆ setPassword()

ilSetup::setPassword (   $a_password)

set setup master password

Parameters
stringpassword
Returns
boolean

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

552 {
553 $this->ini->setVariable("setup", "pass", md5($a_password));
554
555 if ($this->ini->write() == false) {
556 $this->error = $this->ini->getError();
557 return false;
558 }
559
560 return true;
561 }

References error().

+ Here is the call graph for this function:

◆ setSessionSettings()

ilSetup::setSessionSettings (   $session_settings)

saves session settings to db

Parameters
array$session_settings

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

1718 {
1719 require_once('Services/Authentication/classes/class.ilSessionControl.php');
1720
1721 $db = $this->client->getDB();
1722
1723 $setting_fields = ilSessionControl::getSettingFields();
1724
1725 $i = 0;
1726 foreach ($setting_fields as $field) {
1727 if (isset($session_settings[$field])) {
1728 $query = "SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
1729 $res = $db->queryF(
1730 $query,
1731 array('text', 'text'),
1732 array('common', $field)
1733 );
1734
1735 $row = array();
1736 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
1737 break;
1738 }
1739
1740 if (count($row) > 0) {
1741 $db->update(
1742 'settings',
1743 array(
1744 'value' => array('text', $session_settings[$field])
1745 ),
1746 array(
1747 'module' => array('text', 'common'),
1748 'keyword' => array('text', $field)
1749 )
1750 );
1751 } else {
1752 $db->insert(
1753 'settings',
1754 array(
1755 'module' => array('text', 'common'),
1756 'keyword' => array('text', $field),
1757 'value' => array('text', $session_settings[$field])
1758 )
1759 );
1760 }
1761
1762 $i++;
1763 }
1764 }
1765
1766 if ($i < 4) {
1767 $message = $this->lng->txt("session_settings_not_saved");
1768 } else {
1769 $message = $this->lng->txt("settings_saved");
1770 }
1771
1773 }
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:

◆ testConvert()

ilSetup::testConvert (   $a_convert_path)

Check convert program.

Parameters
stringconvert path
Returns
boolean true -> OK | false -> not OK

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

1483 {
1484 if (trim($a_convert_path) == "") {
1485 return "no_path_convert";
1486 }
1487 if (!is_file($a_convert_path)) {
1488 return "check_failed_convert";
1489 }
1490
1491 return "";
1492 }

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

1501 {
1502 // ghostscript is optional, so empty path is ok
1503 if (trim($a_ghostscript_path) == "") {
1504 return "";
1505 }
1506 if (!is_file($a_ghostscript_path)) {
1507 return "check_failed_ghostscript";
1508 }
1509
1510 return "";
1511 }

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

1520 {
1521 // java is optional, so empty path is ok
1522 if (trim($a_java_path) == "") {
1523 return "";
1524 }
1525
1526 if (!is_file($a_java_path)) {
1527 return "check_failed_java";
1528 }
1529
1530 return "";
1531 /*
1532 exec($a_java_path, $out, $back);
1533
1534 unset($out);
1535
1536 return ($back != 1) ? false : true;
1537 */
1538 }

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

1547 {
1548 // latex is optional, so empty path is ok
1549 if (trim($a_latex_url) == "") {
1550 return "";
1551 }
1552
1553 // open the URL
1554 include_once "./setup/classes/class.ilHttpRequest.php";
1555 $http = new ilHttpRequest(ilUtil::stripSlashes($a_latex_url) . "?x_0");
1556 $result = @$http->downloadToString();
1557 if ((strpos((substr($result, 0, 5)), "PNG") !== false) || (strpos((substr($result, 0, 5)), "GIF") !== false)) {
1558 return "";
1559 } else {
1560 return "check_failed_latex";
1561 ;
1562 }
1563 }
$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 1622 of file class.ilSetup.php.

1623 {
1624 if (trim($a_unzip_path) == "") {
1625 return "no_path_unzip";
1626 }
1627 if (!is_file($a_unzip_path)) {
1628 return "check_failed_unzip";
1629 }
1630
1631 return "";
1632 /*
1633 $curDir = getcwd();
1634
1635 chdir(ILIAS_ABSOLUTE_PATH);
1636
1637 if (file_exists(ILIAS_ABSOLUTE_PATH."/unzip_test_file.zip"))
1638 {
1639 $unzipCmd = $a_unzip_path." unzip_test_file.zip";
1640 exec($unzipCmd);
1641 }
1642
1643 chdir($curDir);
1644
1645 // check wether unzip extracted the test file or not
1646 if (file_exists(ILIAS_ABSOLUTE_PATH."/unzip_test_file.txt"))
1647 {
1648 unlink(ILIAS_ABSOLUTE_PATH."/unzip_test_file.txt");
1649
1650 return true;
1651 }
1652 else
1653 {
1654 return false;
1655 }
1656 */
1657 }

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

1572 {
1573 if (trim($a_zip_path) == "") {
1574 return "no_path_zip";
1575 }
1576 if (!is_file($a_zip_path)) {
1577 return "check_failed_zip";
1578 }
1579
1580 return "";
1581 /*
1582 // create test file and run zip
1583 $fp = fopen(ILIAS_ABSOLUTE_PATH."/test.dat", "w");
1584
1585 fwrite($fp, "test");
1586 fclose($fp);
1587
1588 if (file_exists(ILIAS_ABSOLUTE_PATH."/test.dat"))
1589 {
1590 $curDir = getcwd();
1591 chdir(ILIAS_ABSOLUTE_PATH);
1592
1593 $zipCmd = $a_zip_path." -m zip_test_file.zip test.dat";
1594
1595 exec($zipCmd);
1596
1597 chdir($curDir);
1598
1599 }
1600
1601 // check wether zip generated test file or not
1602 if (file_exists(ILIAS_ABSOLUTE_PATH."/zip_test_file.zip"))
1603 {
1604 unlink(ILIAS_ABSOLUTE_PATH."/zip_test_file.zip");
1605 return true;
1606 }
1607 else
1608 {
1609 unlink(ILIAS_ABSOLUTE_PATH."/test.dat");
1610 return false;
1611 }
1612 */
1613 }

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

1666 {
1667 //global $ilias;
1668
1669 $pathinfo = pathinfo($a_file);
1670 $dir = $pathinfo["dirname"];
1671 $file = $pathinfo["basename"];
1672
1673 // unzip
1674 $cdir = getcwd();
1675 chdir($dir);
1676 $unzip = $this->ini->readVariable("tools", "unzip");
1677 $unzipcmd = $unzip . " -Z -1 " . ilUtil::escapeShellArg($file);
1678 exec($unzipcmd, $arr);
1679 $zdirs = array();
1680
1681 foreach ($arr as $line) {
1682 if (is_int(strpos($line, "/"))) {
1683 $zdir = substr($line, 0, strrpos($line, "/"));
1684 $nr = substr_count($zdir, "/");
1685 //echo $zdir." ".$nr."<br>";
1686 while ($zdir != "") {
1687 $nr = substr_count($zdir, "/");
1688 $zdirs[$zdir] = $nr; // collect directories
1689 //echo $dir." ".$nr."<br>";
1690 $zdir = substr($zdir, 0, strrpos($zdir, "/"));
1691 }
1692 }
1693 }
1694
1695 asort($zdirs);
1696
1697 foreach ($zdirs as $zdir => $nr) { // create directories
1699 }
1700
1701 // real unzip
1702 if ($overvwrite) {
1703 $unzipcmd = $unzip . " " . ilUtil::escapeShellArg($file);
1704 } else {
1705 $unzipcmd = $unzip . " -o " . ilUtil::escapeShellArg($file);
1706 }
1707 exec($unzipcmd);
1708
1709 chdir($cdir);
1710 }
static escapeShellArg($a_arg)
static createDirectory($a_dir, $a_mod=0755)
create directory
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

References $file, 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 1132 of file class.ilSetup.php.

1133 {
1134 $convert_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["convert_path"]));
1135 $zip_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["zip_path"]));
1136 $unzip_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["unzip_path"]));
1137 $ghostscript_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["ghostscript_path"]));
1138 $java_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["java_path"]));
1139 //$mkisofs_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["mkisofs_path"]));
1140 $ffmpeg_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["ffmpeg_path"]));
1141 $latex_url = ilUtil::stripSlashes($a_formdata["latex_url"]);
1142 $fop_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["fop_path"]));
1143 $scan_type = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["vscanner_type"]));
1144 $scan_command = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["scan_command"]));
1145 $clean_command = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["clean_command"]));
1146 $enable_system_styles_management = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["enable_system_styles_management"]));
1147 $lessc_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["lessc_path"]));
1148 $phantomjs_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["phantomjs_path"]));
1149
1150 $this->ini->setVariable("tools", "convert", $convert_path);
1151 $this->ini->setVariable("tools", "zip", $zip_path);
1152 $this->ini->setVariable("tools", "unzip", $unzip_path);
1153 $this->ini->setVariable("tools", "ghostscript", $ghostscript_path);
1154 $this->ini->setVariable("tools", "java", $java_path);
1155 //$this->ini->setVariable("tools", "mkisofs", $mkisofs_path);
1156 $this->ini->setVariable("tools", "ffmpeg", $ffmpeg_path);
1157 $this->ini->setVariable("tools", "latex", $latex_url);
1158 $this->ini->setVariable("tools", "fop", $fop_path);
1159 $this->ini->setVariable("tools", "vscantype", $scan_type);
1160 $this->ini->setVariable("tools", "scancommand", $scan_command);
1161 $this->ini->setVariable("tools", "cleancommand", $clean_command);
1162 $this->ini->setVariable("tools", "lessc", $lessc_path);
1163 $this->ini->setVariable("tools", "enable_system_styles_management", $enable_system_styles_management);
1164 $this->ini->setVariable("tools", "phantomjs", $phantomjs_path);
1165
1166 $form_log_path = preg_replace("/\\\\/", "/", ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["log_path"])));
1167 $log_path = substr($form_log_path, 0, strrpos($form_log_path, "/"));
1168 $log_file = substr($form_log_path, strlen($log_path)+1);
1169
1170 $error_log_path = preg_replace("/\\\\/", "/", ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["error_log_path"])));
1171
1172 $this->ini->setVariable("log", "path", $log_path);
1173 $this->ini->setVariable("log", "file", $log_file);
1174 $this->ini->setVariable("log", "enabled", ($a_formdata["chk_log_status"]) ? "0" : 1);
1175 $this->ini->setVariable("log", "error_path", $error_log_path);
1176 $this->ini->setVariable("server", "timezone", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["time_zone"])));
1177
1178 $this->ini->setVariable("https", "auto_https_detect_enabled", ($a_formdata["auto_https_detect_enabled"]) ? 1 : 0);
1179 $this->ini->setVariable("https", "auto_https_detect_header_name", $a_formdata["auto_https_detect_header_name"]);
1180 $this->ini->setVariable("https", "auto_https_detect_header_value", $a_formdata["auto_https_detect_header_value"]);
1181
1182 if (!$this->ini->write()) {
1183 $this->error = get_class($this) . ": " . $this->ini->getError();
1184 return false;
1185 }
1186
1187 return true;
1188 }

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

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

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

+ 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().

◆ $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: