ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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)
 
 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

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

Constructor & Destructor Documentation

◆ __construct()

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

constructor

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

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

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

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

Member Function Documentation

◆ _ilSetup()

ilSetup::_ilSetup ( )

destructor

Returns
boolean

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

1459  {
1460  //if ($this->ini->readVariable("db","type") != "")
1461  //{
1462  // $this->db->disconnect();
1463  //}
1464  return true;
1465  }

◆ checkAccess()

ilSetup::checkAccess ( $client)

check client access status

Parameters
objectclient
Returns
boolean

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

References $client.

Referenced by getStatus().

757  {
758  if ($client->ini->readVariable("client", "access") == "1") {
759  $arr["status"] = true;
760  $arr["comment"] = $this->lng->txt("online");
761  } else {
762  $arr["status"] = false;
763  $arr["comment"] = $this->lng->txt("disabled");
764  }
765 
766  return $arr;
767  }
+ Here is the caller graph for this function:

◆ checkAuth()

ilSetup::checkAuth ( )

check authentication status

Returns
boolean

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

References $_SESSION, and ILIAS_HTTP_PATH.

Referenced by __construct().

370  {
371  if ($_SESSION["auth"] === true && $_SESSION["auth_path"] == ILIAS_HTTP_PATH) {
372  return true;
373  }
374 
375  return false;
376  }
$_SESSION["AccountId"]
+ Here is the caller graph for this function:

◆ checkClientContact()

ilSetup::checkClientContact ( $client)

check client contact data status

Parameters
objectclient
Returns
boolean

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

References $client, and ilUtil\is_email().

Referenced by getStatus().

963  {
964  $arr["status"] = true;
965  //$arr["comment"] = $this->lng->txt("filled_out");
966 
967  $settings = $client->getAllSettings();
968  $client_name = $client->getName();
969 
970  // check required fields
971  if (empty($settings["admin_firstname"]) or empty($settings["admin_lastname"]) or
972  empty($settings["admin_email"]) or empty($client_name)) {
973  $arr["status"] = false;
974  $arr["comment"] = $this->lng->txt("missing_data");
975  }
976 
977  // admin email
978  if (!ilUtil::is_email($settings["admin_email"]) and $arr["status"] != false) {
979  $arr["status"] = false;
980  $arr["comment"] = $this->lng->txt("email_not_valid");
981  }
982 
983  return $arr;
984  }
static is_email($a_email, ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid.
+ 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 790 of file class.ilSetup.php.

References $ilDB, ilClient\getSetting(), ilClient\provideGlobalDB(), and ilClient\revokeGlobalDB().

Referenced by getStatus().

791  {
792  $arr = array();
793  $client->provideGlobalDB();
794  if (!$arr["status"] = $client->db_exists) {
795  $arr["comment"] = $this->lng->txt("no_database");
796 
797  return $arr;
798  }
799 
800  if (!$arr["status"] = $client->db_installed) {
801  $arr["comment"] = $this->lng->txt("db_not_installed");
802 
803  return $arr;
804  }
805  // TODO: move this to client class!!
806  $client->setup_ok = (bool) $client->getSetting("setup_ok");
807 
808  $this->lng->setDbHandler($client->db);
809  $dbupdate = new ilDBUpdate($client->db);
810 
811  if (!$arr["status"] = $dbupdate->getDBVersionStatus()) {
812  $arr["comment"] = $this->lng->txt("db_needs_update");
813  $arr["update"] = true;
814 
815  return $arr;
816  } else {
817  if ($dbupdate->hotfixAvailable()) {
818  $arr["status"] = false;
819  $arr["comment"] = $this->lng->txt("hotfix_available");
820  $arr["update"] = true;
821 
822  return $arr;
823  } else {
824  if ($dbupdate->customUpdatesAvailable()) {
825  $arr["status"] = false;
826  $arr["comment"] = $this->lng->txt("custom_updates_available");
827  $arr["update"] = true;
828 
829  return $arr;
830  }
831  }
832  }
833 
834  // check control information
835  global $ilDB;
836  $cset = $ilDB->query("SELECT count(*) as cnt FROM ctrl_calls");
837  $crec = $ilDB->fetchAssoc($cset);
838  $client->revokeGlobalDB();
839  if ($crec["cnt"] == 0) {
840  $arr["status"] = false;
841  $arr["comment"] = $this->lng->txt("db_control_structure_missing");
842  $arr["update"] = true;
843 
844  return $arr;
845  }
846 
847  return $arr;
848  }
Database Update class.
global $ilDB
getSetting($a_keyword)
read one value from settings table
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkClientIni()

ilSetup::checkClientIni ( $client)

check client ini status

Parameters
objectclient
Returns
boolean

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

References $client.

Referenced by getStatus().

775  {
776  if (!$arr["status"] = $client->init()) {
777  $arr["comment"] = $client->getError();
778  } else {
779  //$arr["comment"] = "dir: /".ILIAS_WEB_DIR."/".$client->getId();
780  }
781 
782  return $arr;
783  }
+ Here is the caller graph for this function:

◆ checkClientLanguages()

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

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

References ilClient\provideGlobalDB(), and ilClient\revokeGlobalDB().

Referenced by getStatus().

940  {
941  $client->provideGlobalDB();
942  $installed_langs = $this->lng->getInstalledLanguages();
943 
944  $count = count($installed_langs);
945  $arr = array();
946  if ($count < 1) {
947  $arr["status"] = false;
948  $arr["comment"] = $this->lng->txt("lang_none_installed");
949  } else {
950  $arr["status"] = true;
951  //$arr["comment"] = $count." ".$this->lng->txt("languages_installed");
952  }
953  $client->revokeGlobalDB();
954  return $arr;
955  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkClientNIC()

ilSetup::checkClientNIC ( $client)

check client nic status

Parameters
objectclient
Returns
boolean

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

References $client.

Referenced by getStatus().

992  {
993  $settings = $client->getAllSettings();
994 
995  if (!isset($settings["nic_enabled"])) {
996  $arr["status"] = false;
997  $arr["comment"] = $this->lng->txt("nic_not_disabled");
998  return $arr;
999  }
1000 
1001  $arr["status"] = true;
1002 
1003  if ($settings["nic_enabled"] == "-1") {
1004  $arr["comment"] = $this->lng->txt("nic_reg_failed");
1005  return $arr;
1006  }
1007 
1008  if (!$settings["nic_enabled"]) {
1009  $arr["comment"] = $this->lng->txt("nic_reg_disabled");
1010  } else {
1011  $arr["comment"] = $this->lng->txt("nic_reg_enabled");
1012  if ($settings["inst_id"] <= 0) {
1013  $arr["status"] = false;
1014  }
1015  }
1016 
1017  return $arr;
1018  }
+ Here is the caller graph for this function:

◆ checkClientProxySettings()

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

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

References $ilDB, $query, $res, and ilClient\provideGlobalDB().

Referenced by getStatus().

899  {
900  $client->provideGlobalDB();
901  global $ilDB;
902  $arr = array();
903  $fields = array( 'proxy_status', 'proxy_host', 'proxy_port' );
904 
905  $query = "SELECT keyword, value FROM settings WHERE " . $ilDB->in('keyword', $fields, false, 'text');
906  $res = $ilDB->query($query);
907 
908  $proxy_settings = array();
909  $already_saved = false;
910  while ($row = $ilDB->fetchAssoc($res)) {
911  $already_saved = true;
912  $proxy_settings[$row['keyword']] = $row['value'];
913  }
914 
915  if (!$already_saved) {
916  $arr["status"] = false;
917  $arr["comment"] = $this->lng->txt("proxy");
918  $arr["text"] = $this->lng->txt("proxy");
919  } else {
920  if ((bool) $proxy_settings["proxy_status"] == false) {
921  $arr["status"] = true;
922  $arr["comment"] = $this->lng->txt("proxy_disabled");
923  $arr["text"] = $this->lng->txt("proxy_disabled");
924  } else {
925  $arr["status"] = true;
926  $arr["comment"] = $this->lng->txt("proxy_activated_configurated");
927  $arr["text"] = $this->lng->txt("proxy_activated_configurated");
928  }
929  }
930 
931  return $arr;
932  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:
+ 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 855 of file class.ilSetup.php.

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

856  {
857  require_once('Services/Authentication/classes/class.ilSessionControl.php');
858 
859  global $ilDB;
860  $db = $ilDB;
861 
863 
864  $query = "SELECT keyword, value FROM settings WHERE " . $db->in('keyword', $fields, false, 'text');
865  $res = $db->query($query);
866 
867  $rows = array();
868  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
869  if ($row['value'] != '') {
870  $rows[] = $row;
871  } else {
872  break;
873  }
874  }
875 
876  if (count($rows) != count($fields)) {
877  if ($a_as_bool) {
878  return false;
879  }
880  $arr["status"] = false;
881  $arr["comment"] = $this->lng->txt("session_management_not_configured");
882  } else {
883  if ($a_as_bool) {
884  return true;
885  }
886  $arr["status"] = true;
887  $arr["comment"] = $this->lng->txt("session_management_configured");
888  }
889 
890  return $arr;
891  }
static getSettingFields()
returns the array of setting fields
foreach($_POST as $key=> $value) $res
$query
$rows
Definition: xhr_table.php:10
global $ilDB
+ Here is the call graph for this function:

◆ checkCookiesEnabled()

ilSetup::checkCookiesEnabled ( )

check cookies enabled

Returns
array

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

References $sess.

Referenced by queryPreliminaries().

314  {
315  global $sess;
316 
317  if ($sess->usesCookies) {
318  $arr["status"] = true;
319  $arr["comment"] = "";
320  } else {
321  $arr["status"] = false;
322  $arr["comment"] = $this->lng->txt("pre_cookies_disabled");
323  }
324 
325  return $arr;
326  }
+ 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 290 of file class.ilSetup.php.

Referenced by queryPreliminaries().

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

◆ checkDataDirSetup()

ilSetup::checkDataDirSetup (   $a_formdata)

check datadir path

Parameters
arrayform data
Returns
boolean

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

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

1308  {
1309  // remove trailing slash & convert backslashes to forwardslashes
1310  $datadir_path = preg_replace("/\\\\/", "/", ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["datadir_path"])));
1311 
1312  if (empty($datadir_path)) {
1313  $this->error = "no_path_datadir";
1314  return false;
1315  }
1316 
1317  $webspace_dir = ILIAS_ABSOLUTE_PATH . "/data";
1318 
1319  // datadir may not point to webspace dir or to any place under webspace_dir
1320  if (strpos($datadir_path, $webspace_dir) !== false) {
1321  $this->error = "datadir_webspacedir_match";
1322  return false;
1323  }
1324 
1325  // create dir
1326  if ($a_formdata["chk_datadir_path"] == 1) {
1327  $dir_to_create = substr(strrchr($datadir_path, "/"), 1);
1328  $dir_to_check = substr($datadir_path, 0, -strlen($dir_to_create) - 1);
1329 
1330  if ($this->isDirectoryInOther($dir_to_create, ILIAS_ABSOLUTE_PATH)) {
1331  $this->error = "cannot_create_datadir_inside_webdir";
1332  return false;
1333  }
1334 
1335  if (is_writable($datadir_path)) {
1336  $this->error = "dir_exists_create";
1337  return false;
1338  }
1339 
1340  if (!is_writable($dir_to_check)) {
1341  $this->error = "cannot_create_datadir_no_write_access";
1342  return false;
1343  }
1344  } else { // check set target dir
1345  if ($this->isDirectoryInOther($datadir_path, ILIAS_ABSOLUTE_PATH)) {
1346  $this->error = "cannot_create_datadir_inside_webdir";
1347  return false;
1348  }
1349 
1350  if (!is_writable($datadir_path)) {
1351  $this->error = "cannot_create_datadir_no_write_access";
1352  return false;
1353  }
1354  }
1355 
1356  return true;
1357  }
isDirectoryInOther($directory, $other_directory)
Checks if directory is subdirectory of other directory.
deleteTrailingSlash($a_path)
delete trailing slash of path variables
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:

◆ checkDom()

ilSetup::checkDom ( )

Check MySQL.

Returns
boolean

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

References $ilDB.

Referenced by queryPreliminaries().

384  {
385  global $ilDB;
386 
387  if (class_exists("DOMDocument")) {
388  $arr["status"] = true;
389  } else {
390  $arr["status"] = false;
391  $arr["comment"] = $this->lng->txt("pre_dom_missing");
392  }
393 
394  return $arr;
395  }
global $ilDB
+ 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 1422 of file class.ilSetup.php.

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

1423  {
1424  // remove trailing slash & convert backslashes to forwardslashes
1425  $clean_error_log_path = preg_replace("/\\\\/", "/", ilFile::deleteTrailingSlash(ilUtil::stripSlashes($error_log_path)));
1426 
1427  if (!empty($clean_error_log_path)) {
1428  if (!ilUtil::makeDirParents($clean_error_log_path)) {
1429  $this->error = "could_not_create_error_directory";
1430  return false;
1431  }
1432  }
1433 
1434  return true;
1435  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
deleteTrailingSlash($a_path)
delete trailing slash of path variables
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ 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 738 of file class.ilSetup.php.

References $client.

Referenced by getStatus().

739  {
740  if ($client->getSetting("setup_ok")) {
741  $arr["status"] = true;
742  //$arr["comment"] = $this->lng->txt("setup_finished");
743  } else {
744  $arr["status"] = false;
745  $arr["comment"] = $this->lng->txt("setup_not_finished");
746  }
747 
748  return $arr;
749  }
+ Here is the caller graph for this function:

◆ checkGd()

ilSetup::checkGd ( )

Check MySQL.

Returns
boolean

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

References $ilDB.

Referenced by queryPreliminaries().

423  {
424  global $ilDB;
425 
426  if (function_exists("imagefill") && function_exists("imagecolorallocate")) {
427  $arr["status"] = true;
428  } else {
429  $arr["status"] = false;
430  $arr["comment"] = sprintf(
431  $this->lng->txt("pre_gd_missing"),
432  "http://php.net/manual/en/book.image.php"
433  );
434  }
435 
436  return $arr;
437  }
global $ilDB
+ Here is the caller graph for this function:

◆ checkIniFileExists()

ilSetup::checkIniFileExists ( )

check if inifile exists

Returns
boolean

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

References Vendor\Package\$a.

254  {
255  $a = @file_exists($this->INI_FILE);
256  return $a;
257  }
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples

◆ checkLogSetup()

ilSetup::checkLogSetup (   $a_formdata)

check log path

Parameters
arrayform data
Returns
boolean

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

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

1385  {
1386  // log path
1387  if (!$a_formdata["chk_log_status"]) {
1388  // remove trailing slash & convert backslashes to forwardslashes
1389  $log_path = preg_replace("/\\\\/", "/", ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["log_path"])));
1390 
1391  if (empty($log_path)) {
1392  $this->error = "no_path_log";
1393  return false;
1394  }
1395 
1396  if (is_dir($log_path)) {
1397  $this->error = 'could_not_create_logfile';
1398  return false;
1399  }
1400 
1401  if ($this->isDirectoryInOther($log_path, ILIAS_ABSOLUTE_PATH)) {
1402  $this->error = "cannot_create_logdir_inside_webdir";
1403  return false;
1404  }
1405 
1406  if (!@touch($log_path)) {
1407  $this->error = "could_not_create_logfile";
1408  return false;
1409  }
1410  }
1411 
1412  return true;
1413  }
isDirectoryInOther($directory, $other_directory)
Checks if directory is subdirectory of other directory.
deleteTrailingSlash($a_path)
delete trailing slash of path variables
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ Here is the call graph for this function:

◆ checkMemoryLimit()

ilSetup::checkMemoryLimit ( )

Check Memory Limit.

Returns
boolean

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

References $ilDB.

Referenced by queryPreliminaries().

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

◆ checkMySQL()

ilSetup::checkMySQL ( )

Check MySQL.

Returns
boolean

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

References $ilDB.

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

◆ checkPasswordSetup()

ilSetup::checkPasswordSetup (   $a_formdata)

check setup password

Parameters
arrayform data
Returns
boolean

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

1365  {
1366  if (!$a_formdata["setup_pass"]) {
1367  $this->error = "no_setup_pass_given";
1368  return false;
1369  }
1370 
1371  if ($a_formdata["setup_pass"] != $a_formdata["setup_pass2"]) {
1372  $this->error = "pass_does_not_match";
1373  return false;
1374  }
1375 
1376  return true;
1377  }

◆ checkPHPVersion()

ilSetup::checkPHPVersion ( )

check for PHP version

Returns
array

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

Referenced by queryPreliminaries().

333  {
334  $version = PHP_VERSION;
335 
336  $arr["status"] = true;
337  $arr["comment"] = "PHP " . $version;
338  if (version_compare($version, '5.3.0', '<')) {
339  $arr["status"] = false;
340  $arr["comment"] = "PHP " . $version . ". " . $this->lng->txt("pre_php_version_too_low");
341  }
342 
343  return $arr;
344  }
+ Here is the caller graph for this function:

◆ checkPreliminaries()

ilSetup::checkPreliminaries ( )

check all prliminaries

Returns
boolean

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

References queryPreliminaries().

497  {
498  $this->preliminaries_result = $this->queryPreliminaries();
499 
500  foreach ($this->preliminaries_result as $val) {
501  if ($val["status"] === false) {
502  $this->preliminaries = false;
503  return false;
504  }
505  }
506 
507  return true;
508  }
queryPreliminaries()
preliminaries
+ 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 1186 of file class.ilSetup.php.

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

1187  {
1188  // convert path
1189  if (!isset($a_formdata["chk_convert_path"])) {
1190  // convert backslashes to forwardslashes
1191  $convert_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["convert_path"]));
1192 
1193  if (($err = $this->testConvert($convert_path)) != "") {
1194  $this->error = $err;
1195  return false;
1196  }
1197  }
1198 
1199  // zip path
1200  if (!isset($a_formdata["chk_zip_path"])) {
1201  // convert backslashes to forwardslashes
1202  $zip_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["zip_path"]));
1203 
1204  if (empty($zip_path)) {
1205  $this->error = "no_path_zip";
1206  return false;
1207  }
1208 
1209  if (!$this->testZip($zip_path)) {
1210  $this->error = "check_failed_zip";
1211  return false;
1212  }
1213  }
1214 
1215  // unzip path
1216  if (!isset($a_formdata["chk_unzip_path"])) {
1217  // convert backslashes to forwardslashes
1218  $unzip_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["unzip_path"]));
1219 
1220  if (empty($unzip_path)) {
1221  $this->error = "no_path_unzip";
1222  return false;
1223  }
1224 
1225  if (!$this->testUnzip($unzip_path)) {
1226  $this->error = "check_failed_unzip";
1227  return false;
1228  }
1229  }
1230 
1231  // ghostscript path
1232  if (!isset($a_formdata["chk_ghostscript_path"])) {
1233  // convert backslashes to forwardslashes
1234  $ghostscript_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["ghostscript_path"]));
1235 
1236  if (($err = $this->testGhostscript($ghostscript_path)) != "") {
1237  $this->error = $err;
1238  return false;
1239  }
1240  }
1241 
1242  // java path
1243  if (!isset($a_formdata["chk_java_path"])) {
1244  // convert backslashes to forwardslashes
1245  $java_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["java_path"]));
1246 
1247  if (empty($java_path)) {
1248  $this->error = "no_path_java";
1249  return false;
1250  }
1251 
1252  if (!$this->testJava($java_path)) {
1253  $this->error = "check_failed_java";
1254  return false;
1255  }
1256  }
1257 
1258  /*if (!isset($a_formdata["chk_mkisofs_path"]))
1259  {
1260  // convert backslashes to forwardslashes
1261  $mkisofs_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["mkisofs_path"]));
1262 
1263  if (empty($mkisofs_path))
1264  {
1265  $this->error = "no_path_mkisofs";
1266  return false;
1267  }
1268  }*/
1269 
1270  if (!isset($a_formdata["chk_ffmpeg_path"])) {
1271  // convert backslashes to forwardslashes
1272  $ffmpeg_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["ffmpeg_path"]));
1273 
1274  if (empty($ffmpeg_path)) {
1275  $this->error = "no_path_ffmpeg";
1276  return false;
1277  }
1278 
1279  if (!$this->testFFMpeg($ffmpeg_path)) {
1280  $this->error = "check_failed_ffmpeg";
1281  return false;
1282  }
1283  }
1284 
1285  // latex url
1286  if (!isset($a_formdata["chk_latex_url"])) {
1287  $latex_url = ilUtil::stripSlashes($a_formdata["latex_url"]);
1288  if (empty($latex_url)) {
1289  $this->error = "no_latex_url";
1290  return false;
1291  }
1292 
1293  if (!$this->testLatex($latex_url)) {
1294  $this->error = "check_failed_latex";
1295  return false;
1296  }
1297  }
1298 
1299  return true;
1300  }
testLatex($a_latex_url)
Check latex cgi script.
testZip($a_zip_path)
Check zip program.
testJava($a_java_path)
Check JVM.
testConvert($a_convert_path)
Check convert program.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
testGhostscript($a_ghostscript_path)
Check ghostscript program.
testUnzip($a_unzip_path)
Check unzip program.
+ Here is the call graph for this function:

◆ checkWritable()

ilSetup::checkWritable ( )

check for writable directory

Parameters
stringdirectory
Returns
array

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

Referenced by queryPreliminaries().

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

◆ checkXsl()

ilSetup::checkXsl ( )

Check MySQL.

Returns
boolean

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

References $ilDB.

Referenced by queryPreliminaries().

402  {
403  global $ilDB;
404 
405  if (class_exists("XSLTProcessor")) {
406  $arr["status"] = true;
407  } else {
408  $arr["status"] = false;
409  $arr["comment"] = sprintf(
410  $this->lng->txt("pre_xsl_missing"),
411  "http://php.net/manual/en/book.xsl.php"
412  );
413  }
414 
415  return $arr;
416  }
global $ilDB
+ 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 1832 of file class.ilSetup.php.

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

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

◆ createDatabase()

ilSetup::createDatabase (   $a_collation = "")

create client database

Returns
boolean

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

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

◆ getClient()

ilSetup::getClient ( )
Returns
ilClient

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

References $client.

139  {
140  return $this->client;
141  }

◆ getError()

ilSetup::getError ( )

get Error message

Returns
string error message

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

References $error.

1442  {
1443  if (empty($this->error)) {
1444  return false;
1445  }
1446 
1447  $error = $this->error;
1448  $this->error = "";
1449 
1450  return $error;
1451  }

◆ getMasterPassword()

ilSetup::getMasterPassword ( )
Returns
string

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

Referenced by verifyMasterPassword().

513  : string
514  {
515  return $this->ini->readVariable('setup', 'pass');
516  }
+ Here is the caller graph for this function:

◆ getSessionSettings()

ilSetup::getSessionSettings ( )

reads session settings from db

Returns
array session_settings

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

References $db, $query, $res, 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().

1772  {
1773  require_once('Services/Authentication/classes/class.ilSessionControl.php');
1774 
1775  $db = $this->client->getDB();
1776 
1777  $setting_fields = ilSessionControl::getSettingFields();
1778 
1779  $query = "SELECT * FROM settings WHERE module = %s " .
1780  "AND " . $db->in('keyword', $setting_fields, false, 'text');
1781 
1782  $res = $db->queryF($query, array('text'), array('common'));
1783 
1784  $session_settings = array();
1785  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
1786  $session_settings[$row['keyword']] = $row['value'];
1787  }
1788 
1789  foreach ($setting_fields as $field) {
1790  if (!isset($session_settings[$field])) {
1791  $value = 1;
1792 
1793  switch ($field) {
1794  case 'session_max_count':
1795 
1797  break;
1798 
1799  case 'session_min_idle':
1800 
1802  break;
1803 
1804  case 'session_max_idle':
1805 
1807  break;
1808 
1809  case 'session_max_idle_after_first_request':
1810 
1812  break;
1813 
1814  case 'session_allow_client_maintenance':
1815 
1817  break;
1818  }
1819 
1820  $session_settings[$field] = $value;
1821  }
1822  }
1823 
1824  return $session_settings;
1825  }
const DEFAULT_MAX_COUNT
default value for settings that have not been defined in setup or administration yet ...
static getSettingFields()
returns the array of setting fields
foreach($_POST as $key=> $value) $res
$query
+ 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 693 of file class.ilSetup.php.

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

694  {
695  if (!is_object($client)) {
696  if ($this->ini_client_exists) {
698  } else {
699  $client = new ilClient(0);
700  }
701  }
702 
703  $status = array();
704  $status["ini"] = $this->checkClientIni($client); // check this one
705  $status["db"] = $this->checkClientDatabase($client);
706  if ($status["db"]["status"] === false and $status["db"]["update"] !== true) {
707  //$status["sess"]["status"] = false;
708  //$status["sess"]["comment"] = $status["db"]["comment"];
709  $status["lang"]["status"] = false;
710  $status["lang"]["comment"] = $status["db"]["comment"];
711  $status["contact"]["status"] = false;
712  $status["contact"]["comment"] = $status["db"]["comment"];
713 
714  $status["proxy"]["status"] = false;
715  $status["proxy"]["comment"] = $status["db"]["comment"];
716 
717  $status["nic"]["status"] = false;
718  $status["nic"]["comment"] = $status["db"]["comment"];
719  } else {
720  //$status["sess"] = $this->checkClientSessionSettings($client);
721  $status["lang"] = $this->checkClientLanguages($client);
722  $status["contact"] = $this->checkClientContact($client);
723  $status["proxy"] = $this->checkClientProxySettings($client);
724  $status["nic"] = $this->checkClientNIC($client);
725  $status["finish"] = $this->checkFinish($client);
726  $status["access"] = $this->checkAccess($client);
727  }
728 
729  //return value
730  return $status;
731  }
checkClientIni(&$client)
check client ini status
checkClientLanguages(ilClient $client)
checkClientDatabase(ilClient $client)
checkClientContact(&$client)
check client contact data status
checkFinish(&$client)
check if client setup was finished
checkClientNIC(&$client)
check client nic status
Client Management.
checkClientProxySettings(ilClient $client)
checkAccess(&$client)
check client access status
+ Here is the call 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 148 of file class.ilSetup.php.

Referenced by __construct().

149  {
150  // load data from setup.ini file
151  $this->ini = new ilIniFile($this->ini_file_path);
152 
153  if (!$this->ini->read()) {
154  $this->ini->GROUPS = parse_ini_file($this->setup_defaults, true);
155  $this->error = get_class($this) . ": " . $this->ini->getError();
156  return false;
157  }
158 
159  $this->setup_password = $this->ini->readVariable("setup", "pass");
160  $this->default_client = $this->ini->readVariable("clients", "default");
161 
162  define("ILIAS_DATA_DIR", $this->ini->readVariable("clients", "datadir"));
163  define("ILIAS_WEB_DIR", $this->ini->readVariable("clients", "path"));
164 
165  return true;
166  }
INIFile Parser.
+ Here is the caller graph for this function:

◆ installDatabase()

ilSetup::installDatabase ( )

set the database data

Returns
boolean
Deprecated:

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

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

◆ isAdmin()

ilSetup::isAdmin ( )

check if current user is admin

Returns
boolean

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

1043  {
1044  return ($this->access_mode == "admin") ? true : false;
1045  }

◆ isAuthenticated()

ilSetup::isAuthenticated ( )

check if current user is authenticated

Returns
boolean

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

References $auth.

1034  {
1035  return $this->auth;
1036  }

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

Referenced by checkDataDirSetup(), and checkLogSetup().

2019  {
2020  $other_directory = $other_directory . "/";
2021 
2022  return !(strpos($directory, $other_directory) !== 0);
2023  }
+ Here is the caller graph for this function:

◆ isInstalled()

ilSetup::isInstalled ( )

check if client's db is installed

Returns
boolean

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

References $ini_ilias_exists.

Referenced by newClient().

1025  {
1026  return $this->ini_ilias_exists;
1027  }
+ Here is the caller graph for this function:

◆ isValidClientId()

ilSetup::isValidClientId (   $a_client_id)

Is valid client id.

Parameters

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

2004  {
2005  if (!preg_match("/^[A-Za-z0-9]+$/", $a_client_id)) {
2006  return false;
2007  }
2008  return true;
2009  }

◆ 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

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

References $_SESSION, ILIAS_HTTP_PATH, and storeMasterPassword().

647  : bool
648  {
649  $passwordReHashCallback = function ($raw) {
650  $this->storeMasterPassword($raw);
651  };
652 
653  if ($this->passwordManager->verifyPassword($this->getMasterPassword(), $raw, $passwordReHashCallback)) {
654  $_SESSION['auth'] = true;
655  $_SESSION['auth_path'] = ILIAS_HTTP_PATH;
656  $_SESSION['access_mode'] = 'admin';
657  return true;
658  }
659 
660  return false;
661  }
$_SESSION["AccountId"]
storeMasterPassword(string $raw)
+ Here is the call graph for this function:

◆ loginAsClient()

ilSetup::loginAsClient (   $a_auth_data)

process client login

Parameters
array
Returns
boolean

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

References $_SESSION, $data, $ilDB, ilUserPasswordManager\getInstance(), IL_PASSWD_CRYPTED, ILIAS_HTTP_PATH, and newClient().

558  {
559  global $ilDB;
560 
561  if (empty($a_auth_data["client_id"])) {
562  $this->error = "no_client_id";
563  return false;
564  }
565 
566  if (empty($a_auth_data["username"])) {
567  $this->error = "no_username";
568  return false;
569  }
570 
571  if (empty($a_auth_data["password"])) {
572  $this->error = "no_password";
573  return false;
574  }
575 
576  if (!$this->newClient($a_auth_data["client_id"])) { //TT: comment out to get around null db
577  $this->error = "unknown_client_id";
578  unset($this->client);
579  return false;
580  }
581 
582  if (!$this->client->db_exists) {
583  $this->error = "no_db_connect_consult_admin";
584  unset($this->client);
585  return false;
586  }
587 
588  $s1 = $this->client->db->query("SELECT value from settings WHERE keyword = " .
589  $this->client->db->quote('system_role_id', 'text'));
590  $r1 = $this->client->db->fetchAssoc($s1);
591  $system_role_id = $r1["value"];
592 
593  $add_usrfields = '';
594  if ($this->client->db->tableColumnExists('usr_data', 'passwd_enc_type')) {
595  $add_usrfields .= ' , usr_data.passwd_enc_type, usr_data.passwd_salt ';
596  }
597  $q = "SELECT usr_data.usr_id, usr_data.passwd $add_usrfields " .
598  "FROM usr_data " .
599  "LEFT JOIN rbac_ua ON rbac_ua.usr_id=usr_data.usr_id " .
600  "WHERE rbac_ua.rol_id = " . $this->client->db->quote((int) $system_role_id, 'integer') . " " .
601  "AND usr_data.login=" . $this->client->db->quote($a_auth_data["username"], 'text');
602  $r = $this->client->db->query($q);
603  if (!$this->client->db->numRows($r)) {
604  $this->error = 'login_invalid';
605  return false;
606  }
607 
608  $data = $this->client->db->fetchAssoc($r);
609 
610  global $ilClientIniFile;
611 
612  $ilClientIniFile = $this->client->ini;
613 
614  require_once 'Services/User/classes/class.ilUserPasswordManager.php';
615  $crypt_type = ilUserPasswordManager::getInstance()->getEncoderName();
616  if (strlen($add_usrfields) && ilUserPasswordManager::getInstance()->isEncodingTypeSupported($crypt_type)) {
617  require_once 'setup/classes/class.ilObjSetupUser.php';
618  $user = new ilObjSetupUser();
619  $user->setPasswd($data['passwd'], IL_PASSWD_CRYPTED);
620  $user->setPasswordEncodingType($data['passwd_enc_type']);
621  $user->setPasswordSalt($data['passwd_salt']);
622 
623  $password_valid = ilUserPasswordManager::getInstance()->verifyPassword($user, $a_auth_data['password']);
624  } else {
625  $password_valid = $data['passwd'] == md5($a_auth_data['password']);
626  }
627 
628  if ($password_valid) {
629  // all checks passed -> user valid
630  $_SESSION['auth'] = true;
631  $_SESSION['auth_path'] = ILIAS_HTTP_PATH;
632  $_SESSION['access_mode'] = 'client';
633  $_SESSION['ClientId'] = $this->client->getId();
634  return true;
635  } else {
636  $this->error = 'login_invalid';
637  return false;
638  }
639  }
$data
Definition: storeScorm.php:23
$_SESSION["AccountId"]
const IL_PASSWD_CRYPTED
newClient($a_client_id=0)
creates a client object in $this->client
Class ilObjSetupUser A class derived from ilObjUser for authentication purposes in the ILIAS setup...
global $ilDB
static getInstance()
Single method to reduce footprint (included files, created instances)
+ 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 668 of file class.ilSetup.php.

References $_SESSION, and isInstalled().

Referenced by loginAsClient().

669  {
670  if (!$this->isInstalled()) {
671  return false;
672  }
673 
674  $this->client = new ilClient($a_client_id);
675 
676  if (!$this->client->init()) {
677  //echo "<br>noclientinit";
678  $this->error = get_class($this) . ": " . $this->client->getError();
679  $_SESSION["ClientId"] = "";
680  return false;
681  }
682 
683  $_SESSION["ClientId"] = $a_client_id;
684 
685  return true;
686  }
$_SESSION["AccountId"]
isInstalled()
check if client&#39;s db is installed
Client Management.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ printProxyStatus()

ilSetup::printProxyStatus (   $client)

Print proxy settings.

private

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

References $client, Vendor\Package\$e, and ilUtil\sendFailure().

1929  {
1930  require_once './Services/Http/exceptions/class.ilProxyException.php';
1931  $settings = $client->getAllSettings();
1932 
1933  if ((bool) $settings['proxy_status'] == true) {
1934  try {
1935  $err_str = false;
1936  $wait_timeout = 100;
1937 
1938  $fp = @fsockopen($settings['proxy_host'], $settings['proxy_port'], $err_code, $err_str, $wait_timeout);
1939 
1940  if ($err_str) {
1941  throw new ilProxyException($err_str);
1942  }
1943 
1944  fclose($fp);
1945 
1946  ilUtil::sendSuccess($this->lng->txt('proxy_connectable'));
1947  } catch (Exception $e) {
1948  ilUtil::sendFailure($this->lng->txt('proxy_not_connectable') . ": " . $e->getMessage());
1949  }
1950  }
1951  }
Class for proxy related exception handling in ILIAS.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ queryPreliminaries()

ilSetup::queryPreliminaries ( )

preliminaries

check if different things are ok for setting up ilias private

Returns
array

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

References Vendor\Package\$a, checkCookiesEnabled(), checkCreatable(), checkDom(), checkGd(), checkMemoryLimit(), checkPHPVersion(), checkWritable(), and checkXsl().

Referenced by checkPreliminaries().

477  {
478  $a = array();
479  $a["php"] = $this->checkPHPVersion();
480  // $a["mysql"] = $this->checkMySQL();
481  $a["root"] = $this->checkWritable();
482  $a["folder_create"] = $this->checkCreatable();
483  $a["cookies_enabled"] = $this->checkCookiesEnabled();
484  $a["dom"] = $this->checkDom();
485  $a["xsl"] = $this->checkXsl();
486  $a["gd"] = $this->checkGd();
487  $a["memory"] = $this->checkMemoryLimit();
488 
489  return $a;
490  }
checkXsl()
Check MySQL.
checkCreatable($a_dir=".")
check for permission to create new folders in specified directory
checkWritable()
check for writable directory
checkDom()
Check MySQL.
checkMemoryLimit()
Check Memory Limit.
checkCookiesEnabled()
check cookies enabled
checkGd()
Check MySQL.
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
checkPHPVersion()
check for PHP version
+ 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 1052 of file class.ilSetup.php.

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

1053  {
1054  $datadir_path = preg_replace("/\\\\/", "/", ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["datadir_path"])));
1055 
1056  if ($a_formdata["chk_datadir_path"] == 1) { // mode create dir
1057  if (!ilUtil::makeDir($datadir_path)) {
1058  $this->error = "create_datadir_failed";
1059  return false;
1060  }
1061  }
1062 
1063  // create webspace dir if it does not exist
1064  if (!@file_exists(ILIAS_ABSOLUTE_PATH . "/" . $this->ini->readVariable("clients", "path")) and !@is_dir(ILIAS_ABSOLUTE_PATH . "/" . $this->ini->readVariable("clients", "path"))) {
1065  if (!ilUtil::makeDir(ILIAS_ABSOLUTE_PATH . "/" . $this->ini->readVariable("clients", "path"))) {
1066  $this->error = "create_webdir_failed";
1067  return false;
1068  }
1069  }
1070 
1071  $form_log_path = preg_replace("/\\\\/", "/", ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["log_path"])));
1072  $log_path = substr($form_log_path, 0, strrpos($form_log_path, "/"));
1073  $log_file = substr($form_log_path, strlen($log_path) + 1);
1074  $error_log_path = preg_replace("/\\\\/", "/", ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["error_log_path"])));
1075 
1076  $this->ini->setVariable("server", "http_path", ILIAS_HTTP_PATH);
1077  $this->ini->setVariable("server", "absolute_path", ILIAS_ABSOLUTE_PATH);
1078  $this->ini->setVariable("server", "timezone", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["time_zone"])));
1079  $this->ini->setVariable("clients", "datadir", $datadir_path);
1080  $this->ini->setVariable("tools", "convert", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["convert_path"])));
1081  $this->ini->setVariable("tools", "zip", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["zip_path"])));
1082  $this->ini->setVariable("tools", "unzip", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["unzip_path"])));
1083  $this->ini->setVariable("tools", "ghostscript", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["ghostscript_path"])));
1084  $this->ini->setVariable("tools", "java", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["java_path"])));
1085  //$this->ini->setVariable("tools", "mkisofs", preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["mkisofs_path"])));
1086  $this->ini->setVariable("tools", "ffmpeg", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["ffmpeg_path"])));
1087  $this->ini->setVariable("tools", "latex", ilUtil::stripSlashes($a_formdata["latex_url"]));
1088  $this->ini->setVariable("tools", "vscantype", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["vscanner_type"])));
1089  $this->ini->setVariable("tools", "scancommand", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["scan_command"])));
1090  $this->ini->setVariable("tools", "cleancommand", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["clean_command"])));
1091  $this->ini->setVariable("tools", "enable_system_styles_management", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["enable_system_styles_management"])));
1092  $this->ini->setVariable("tools", "lessc", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["lessc_path"])));
1093  $this->ini->setVariable("tools", "phantomjs", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["phantomjs_path"])));
1094 
1095  $this->ini->setVariable('setup', 'pass', $this->passwordManager->encodePassword($a_formdata['setup_pass']));
1096  $this->ini->setVariable("log", "path", $log_path);
1097  $this->ini->setVariable("log", "file", $log_file);
1098  $this->ini->setVariable("log", "enabled", ($a_formdata["chk_log_status"]) ? "0" : 1);
1099  $this->ini->setVariable("log", "error_path", $error_log_path);
1100 
1101  $this->ini->setVariable("https", "auto_https_detect_enabled", ($a_formdata["auto_https_detect_enabled"]) ? 1 : 0);
1102  $this->ini->setVariable("https", "auto_https_detect_header_name", $a_formdata["auto_https_detect_header_name"]);
1103  $this->ini->setVariable("https", "auto_https_detect_header_value", $a_formdata["auto_https_detect_header_value"]);
1104 
1105  if (!$this->ini->write()) {
1106  $this->error = get_class($this) . ": " . $this->ini->getError();
1107  return false;
1108  }
1109 
1110  // everything is fine. so we authenticate the user and set access mode to 'admin'
1111  $_SESSION["auth"] = true;
1112  $_SESSION["auth_path"] = ILIAS_HTTP_PATH;
1113  $_SESSION["access_mode"] = "admin";
1114 
1115  return true;
1116  }
$_SESSION["AccountId"]
deleteTrailingSlash($a_path)
delete trailing slash of path variables
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ 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 172 of file class.ilSetup.php.

References $_SESSION.

Referenced by updateNewClient().

173  {
174  // save client id to session
175  $_SESSION["ClientId"] = $this->client->getId();
176 
177  // create client
178  if (!$this->client->create()) {
179  $this->error = $this->client->getError();
180  return false;
181  }
182 
183  //everything okay
184  $this->ini_client_exists = true;
185 
186  return true;
187  }
$_SESSION["AccountId"]
+ Here is the caller graph for this function:

◆ saveProxySettings()

ilSetup::saveProxySettings (   $proxy_settings)

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

References $db, $query, and $res.

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

◆ setClient()

ilSetup::setClient (   $a_cl)
Parameters
$a_cl

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

130  {
131  $this->client = $a_cl;
132  }

◆ setSessionSettings()

ilSetup::setSessionSettings (   $session_settings)

saves session settings to db

Parameters
array$session_settings

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

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

1709  {
1710  require_once('Services/Authentication/classes/class.ilSessionControl.php');
1711 
1712  $db = $this->client->getDB();
1713 
1714  $setting_fields = ilSessionControl::getSettingFields();
1715 
1716  $i = 0;
1717  foreach ($setting_fields as $field) {
1718  if (isset($session_settings[$field])) {
1719  $query = "SELECT keyword FROM settings WHERE module = %s AND keyword = %s";
1720  $res = $db->queryF(
1721  $query,
1722  array('text', 'text'),
1723  array('common', $field)
1724  );
1725 
1726  $row = array();
1727  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
1728  break;
1729  }
1730 
1731  if (count($row) > 0) {
1732  $db->update(
1733  'settings',
1734  array(
1735  'value' => array('text', $session_settings[$field])
1736  ),
1737  array(
1738  'module' => array('text', 'common'),
1739  'keyword' => array('text', $field)
1740  )
1741  );
1742  } else {
1743  $db->insert(
1744  'settings',
1745  array(
1746  'module' => array('text', 'common'),
1747  'keyword' => array('text', $field),
1748  'value' => array('text', $session_settings[$field])
1749  )
1750  );
1751  }
1752 
1753  $i++;
1754  }
1755  }
1756 
1757  if ($i < 4) {
1758  $message = $this->lng->txt("session_settings_not_saved");
1759  } else {
1760  $message = $this->lng->txt("settings_saved");
1761  }
1762 
1764  }
static getSettingFields()
returns the array of setting fields
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
foreach($_POST as $key=> $value) $res
$query
$message
Definition: xapiexit.php:14
$i
Definition: metadata.php:24
+ 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 522 of file class.ilSetup.php.

Referenced by loginAsAdmin(), and verifyMasterPassword().

522  : bool
523  {
524  $this->ini->setVariable('setup', 'pass', $this->passwordManager->encodePassword($raw));
525 
526  if ($this->ini->write() == false) {
527  $this->error = $this->ini->getError();
528  return false;
529  }
530 
531  return true;
532  }
+ 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 1473 of file class.ilSetup.php.

Referenced by checkToolsSetup().

1474  {
1475  if (trim($a_convert_path) == "") {
1476  return "no_path_convert";
1477  }
1478  if (!is_file($a_convert_path)) {
1479  return "check_failed_convert";
1480  }
1481 
1482  return "";
1483  }
+ 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 1491 of file class.ilSetup.php.

Referenced by checkToolsSetup().

1492  {
1493  // ghostscript is optional, so empty path is ok
1494  if (trim($a_ghostscript_path) == "") {
1495  return "";
1496  }
1497  if (!is_file($a_ghostscript_path)) {
1498  return "check_failed_ghostscript";
1499  }
1500 
1501  return "";
1502  }
+ 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 1510 of file class.ilSetup.php.

Referenced by checkToolsSetup().

1511  {
1512  // java is optional, so empty path is ok
1513  if (trim($a_java_path) == "") {
1514  return "";
1515  }
1516 
1517  if (!is_file($a_java_path)) {
1518  return "check_failed_java";
1519  }
1520 
1521  return "";
1522  /*
1523  exec($a_java_path, $out, $back);
1524 
1525  unset($out);
1526 
1527  return ($back != 1) ? false : true;
1528  */
1529  }
+ 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 1537 of file class.ilSetup.php.

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

Referenced by checkToolsSetup().

1538  {
1539  // latex is optional, so empty path is ok
1540  if (trim($a_latex_url) == "") {
1541  return "";
1542  }
1543 
1544  // open the URL
1545  include_once "./setup/classes/class.ilHttpRequest.php";
1546  $http = new ilHttpRequest(ilUtil::stripSlashes($a_latex_url) . "?x_0");
1547  $result = @$http->downloadToString();
1548  if ((strpos((substr($result, 0, 5)), "PNG") !== false) || (strpos((substr($result, 0, 5)), "GIF") !== false)) {
1549  return "";
1550  } else {
1551  return "check_failed_latex";
1552  ;
1553  }
1554  }
$result
ilHttpRequest class
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$http
Definition: raiseError.php:7
+ 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 1613 of file class.ilSetup.php.

Referenced by checkToolsSetup().

1614  {
1615  if (trim($a_unzip_path) == "") {
1616  return "no_path_unzip";
1617  }
1618  if (!is_file($a_unzip_path)) {
1619  return "check_failed_unzip";
1620  }
1621 
1622  return "";
1623  /*
1624  $curDir = getcwd();
1625 
1626  chdir(ILIAS_ABSOLUTE_PATH);
1627 
1628  if (file_exists(ILIAS_ABSOLUTE_PATH."/unzip_test_file.zip"))
1629  {
1630  $unzipCmd = $a_unzip_path." unzip_test_file.zip";
1631  exec($unzipCmd);
1632  }
1633 
1634  chdir($curDir);
1635 
1636  // check wether unzip extracted the test file or not
1637  if (file_exists(ILIAS_ABSOLUTE_PATH."/unzip_test_file.txt"))
1638  {
1639  unlink(ILIAS_ABSOLUTE_PATH."/unzip_test_file.txt");
1640 
1641  return true;
1642  }
1643  else
1644  {
1645  return false;
1646  }
1647  */
1648  }
+ 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 1562 of file class.ilSetup.php.

Referenced by checkToolsSetup().

1563  {
1564  if (trim($a_zip_path) == "") {
1565  return "no_path_zip";
1566  }
1567  if (!is_file($a_zip_path)) {
1568  return "check_failed_zip";
1569  }
1570 
1571  return "";
1572  /*
1573  // create test file and run zip
1574  $fp = fopen(ILIAS_ABSOLUTE_PATH."/test.dat", "w");
1575 
1576  fwrite($fp, "test");
1577  fclose($fp);
1578 
1579  if (file_exists(ILIAS_ABSOLUTE_PATH."/test.dat"))
1580  {
1581  $curDir = getcwd();
1582  chdir(ILIAS_ABSOLUTE_PATH);
1583 
1584  $zipCmd = $a_zip_path." -m zip_test_file.zip test.dat";
1585 
1586  exec($zipCmd);
1587 
1588  chdir($curDir);
1589 
1590  }
1591 
1592  // check wether zip generated test file or not
1593  if (file_exists(ILIAS_ABSOLUTE_PATH."/zip_test_file.zip"))
1594  {
1595  unlink(ILIAS_ABSOLUTE_PATH."/zip_test_file.zip");
1596  return true;
1597  }
1598  else
1599  {
1600  unlink(ILIAS_ABSOLUTE_PATH."/test.dat");
1601  return false;
1602  }
1603  */
1604  }
+ 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 1656 of file class.ilSetup.php.

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

1657  {
1658  //global $ilias;
1659 
1660  $pathinfo = pathinfo($a_file);
1661  $dir = $pathinfo["dirname"];
1662  $file = $pathinfo["basename"];
1663 
1664  // unzip
1665  $cdir = getcwd();
1666  chdir($dir);
1667  $unzip = $this->ini->readVariable("tools", "unzip");
1668  $unzipcmd = $unzip . " -Z -1 " . ilUtil::escapeShellArg($file);
1669  exec($unzipcmd, $arr);
1670  $zdirs = array();
1671 
1672  foreach ($arr as $line) {
1673  if (is_int(strpos($line, "/"))) {
1674  $zdir = substr($line, 0, strrpos($line, "/"));
1675  $nr = substr_count($zdir, "/");
1676  //echo $zdir." ".$nr."<br>";
1677  while ($zdir != "") {
1678  $nr = substr_count($zdir, "/");
1679  $zdirs[$zdir] = $nr; // collect directories
1680  //echo $dir." ".$nr."<br>";
1681  $zdir = substr($zdir, 0, strrpos($zdir, "/"));
1682  }
1683  }
1684  }
1685 
1686  asort($zdirs);
1687 
1688  foreach ($zdirs as $zdir => $nr) { // create directories
1689  ilUtil::createDirectory($zdir);
1690  }
1691 
1692  // real unzip
1693  if ($overvwrite) {
1694  $unzipcmd = $unzip . " " . ilUtil::escapeShellArg($file);
1695  } else {
1696  $unzipcmd = $unzip . " -o " . ilUtil::escapeShellArg($file);
1697  }
1698  exec($unzipcmd);
1699 
1700  chdir($cdir);
1701  }
static createDirectory($a_dir, $a_mod=0755)
create directory
static escapeShellArg($a_arg)
+ Here is the call graph for this function:

◆ updateMasterSettings()

ilSetup::updateMasterSettings (   $a_formdata)

updates settings

Parameters
arrayform data
Returns
boolean

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

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

1124  {
1125  $convert_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["convert_path"]));
1126  $zip_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["zip_path"]));
1127  $unzip_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["unzip_path"]));
1128  $ghostscript_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["ghostscript_path"]));
1129  $java_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["java_path"]));
1130  //$mkisofs_path = preg_replace("/\\\\/","/",ilUtil::stripSlashes($a_formdata["mkisofs_path"]));
1131  $ffmpeg_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["ffmpeg_path"]));
1132  $latex_url = ilUtil::stripSlashes($a_formdata["latex_url"]);
1133  $fop_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["fop_path"]));
1134  $scan_type = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["vscanner_type"]));
1135  $scan_command = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["scan_command"]));
1136  $clean_command = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["clean_command"]));
1137  $enable_system_styles_management = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["enable_system_styles_management"]));
1138  $lessc_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["lessc_path"]));
1139  $phantomjs_path = preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["phantomjs_path"]));
1140 
1141  $this->ini->setVariable("tools", "convert", $convert_path);
1142  $this->ini->setVariable("tools", "zip", $zip_path);
1143  $this->ini->setVariable("tools", "unzip", $unzip_path);
1144  $this->ini->setVariable("tools", "ghostscript", $ghostscript_path);
1145  $this->ini->setVariable("tools", "java", $java_path);
1146  //$this->ini->setVariable("tools", "mkisofs", $mkisofs_path);
1147  $this->ini->setVariable("tools", "ffmpeg", $ffmpeg_path);
1148  $this->ini->setVariable("tools", "latex", $latex_url);
1149  $this->ini->setVariable("tools", "fop", $fop_path);
1150  $this->ini->setVariable("tools", "vscantype", $scan_type);
1151  $this->ini->setVariable("tools", "scancommand", $scan_command);
1152  $this->ini->setVariable("tools", "cleancommand", $clean_command);
1153  $this->ini->setVariable("tools", "lessc", $lessc_path);
1154  $this->ini->setVariable("tools", "enable_system_styles_management", $enable_system_styles_management);
1155  $this->ini->setVariable("tools", "phantomjs", $phantomjs_path);
1156 
1157  $form_log_path = preg_replace("/\\\\/", "/", ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["log_path"])));
1158  $log_path = substr($form_log_path, 0, strrpos($form_log_path, "/"));
1159  $log_file = substr($form_log_path, strlen($log_path) + 1);
1160 
1161  $error_log_path = preg_replace("/\\\\/", "/", ilFile::deleteTrailingSlash(ilUtil::stripSlashes($a_formdata["error_log_path"])));
1162 
1163  $this->ini->setVariable("log", "path", $log_path);
1164  $this->ini->setVariable("log", "file", $log_file);
1165  $this->ini->setVariable("log", "enabled", ($a_formdata["chk_log_status"]) ? "0" : 1);
1166  $this->ini->setVariable("log", "error_path", $error_log_path);
1167  $this->ini->setVariable("server", "timezone", preg_replace("/\\\\/", "/", ilUtil::stripSlashes($a_formdata["time_zone"])));
1168 
1169  $this->ini->setVariable("https", "auto_https_detect_enabled", ($a_formdata["auto_https_detect_enabled"]) ? 1 : 0);
1170  $this->ini->setVariable("https", "auto_https_detect_header_name", $a_formdata["auto_https_detect_header_name"]);
1171  $this->ini->setVariable("https", "auto_https_detect_header_value", $a_formdata["auto_https_detect_header_value"]);
1172 
1173  if (!$this->ini->write()) {
1174  $this->error = get_class($this) . ": " . $this->ini->getError();
1175  return false;
1176  }
1177 
1178  return true;
1179  }
deleteTrailingSlash($a_path)
delete trailing slash of path variables
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
+ 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 194 of file class.ilSetup.php.

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

195  {
196  return true;
197  //var_dump("<pre>",$this->client,"</pre>");exit;
198  //Error Handling disabled!! caused by missing PEAR
199  if ($a_old_client_id != $this->client->getId()) {
200  $this->saveNewClient();
201 
202  ilUtil::delDir(ILIAS_ABSOLUTE_PATH . "/" . ILIAS_WEB_DIR . "/" . $a_old_client_id);
203  ilUtil::delDir(ILIAS_DATA_DIR . "/" . $a_old_client_id);
204  }
205 
206  //everything okay
207  $this->ini_client_exists = true;
208 
209  return true;
210  }
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
saveNewClient()
saves client.ini & updates client list in ilias.ini
+ Here is the call graph for this function:

◆ verifyMasterPassword()

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

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

References getMasterPassword(), and storeMasterPassword().

539  : bool
540  {
541  $passwordReHashCallback = function ($raw) {
542  $this->storeMasterPassword($raw);
543  };
544 
545  return $this->passwordManager->verifyPassword(
546  $this->getMasterPassword(),
547  $raw,
548  $passwordReHashCallback
549  );
550  }
getMasterPassword()
storeMasterPassword(string $raw)
+ Here is the call graph for this function:

Field Documentation

◆ $access_mode

ilSetup::$access_mode

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

◆ $auth

ilSetup::$auth

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

Referenced by isAuthenticated().

◆ $client

◆ $db

◆ $default_client

ilSetup::$default_client

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

◆ $dsn

ilSetup::$dsn = ""

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

◆ $error

ilSetup::$error = ""

Definition at line 21 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 27 of file class.ilSetup.php.

◆ $ini

ilSetup::$ini

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

◆ $ini_client_exists

ilSetup::$ini_client_exists = false

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

◆ $ini_file_path

ilSetup::$ini_file_path

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

◆ $ini_ilias_exists

ilSetup::$ini_ilias_exists = false

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

Referenced by isInstalled().

◆ $passwordManager

ilSetup::$passwordManager
protected

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

Referenced by __construct().

◆ $preliminaries

ilSetup::$preliminaries = true

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

◆ $preliminaries_result

ilSetup::$preliminaries_result = array()

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

◆ $safe_mode

ilSetup::$safe_mode

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

◆ $safe_mode_exec_dir

ilSetup::$safe_mode_exec_dir

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

◆ $setup_defaults

ilSetup::$setup_defaults

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

◆ $setup_password

ilSetup::$setup_password

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

◆ $SQL_FILE

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

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


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