diff --git a/index.php b/index.php index 9e9397c2aa..56e40f71c0 100644 --- a/index.php +++ b/index.php @@ -18,7 +18,8 @@ try { //no config, install Jeedom! if (!file_exists(__DIR__ . '/core/config/common.config.php')) { - header("location: install/setup.php"); + echo 'Jeedom not configure, no common.config.php found'; + die(); } require_once __DIR__ . "/core/php/core.inc.php"; diff --git a/install/setup.php b/install/setup.php deleted file mode 100755 index 4ff41e7526..0000000000 --- a/install/setup.php +++ /dev/null @@ -1,277 +0,0 @@ -404 Non trouvé"; - echo "Cannot find requested page."; - exit(); - } - echo file_get_contents(__DIR__ . '/../log/jeedom_installation'); - die(); -} -if (file_exists(__DIR__ . '/../core/config/common.config.php')) { - if (!headers_sent()) { - header("Statut: 404 Page non trouvée"); - header('HTTP/1.0 404 Not Found'); - } - $_SERVER['REDIRECT_STATUS'] = 404; - echo "

404 unfound

"; - echo "Cannot find requested page."; - exit(); -} -$needpackages = array('unzip', 'curl', 'ntp'); -$needphpextensions = array('curl', 'json', 'mysql', 'gd'); -$loadExtensions = get_loaded_extensions(); -?> - - - - - Jeedom Installation - - - - - - -
- -
- '; - echo '
Jeedom requires PHP 7.X or up (current : ' . PHP_VERSION . ')
'; - echo ''; -} -if (!file_exists('/etc/cron.d/jeedom')) { - echo '
'; - echo '
Please add a crontab line for Jeedom (if Jeedom does not have sudo rights, this error is normal) :
'; - echo '
';
-	echo "sudo su -\n";
-	echo 'echo "* * * * * ' . get_current_user() . ' /usr/bin/php ' . dirname(__DIR__) . '/core/php/jeeCron.php >> /dev/null" > /etc/cron.d/jeedom';
-	echo '
'; - echo '
'; -} - -foreach ($needpackages as $needpackage) { - if (shell_exec(system::get('cmd_check') . $needpackage . ' | wc -l') == 0) { - $error = true; - echo '
'; - echo '
Jeedom requires package ' . $needpackage . ' . Run SSH cmd :
'; - echo '
';
-		echo "sudo su -\n";
-		echo system::get('cmd_install') . $needpackage;
-		echo '
'; - echo '
'; - } -} -foreach ($needphpextensions as $needphpextension) { - foreach ($loadExtensions as $extension) { - if ($extension == $needphpextension) { - break 2; - } - } - $error = true; - echo '
'; - echo '
Jeedom requires PHP extension ' . $needphpextension . ' . Run SSH cmd :
'; - echo '
';
-	echo "sudo su -\n";
-	echo system::get('cmd_install') . ' php-' . $needphpextension . "\n";
-	echo 'systemctl reload php-fpm or systemctl reload apache2';
-	echo '
'; - echo '
'; -} -if (ini_get('max_execution_time') < 600) { - $error = true; - echo '
'; - echo '
max_execution_time must be >= 600, edit ' . php_ini_loaded_file() . ' and change this value (current ' . ini_get('max_execution_time') . ')
'; - echo '
'; -} -if (ini_get('upload_max_filesize') != '1G' && ini_get('upload_max_filesize') != '1024M') { - $error = true; - echo '
'; - echo '
upload_max_filesize must be = 1G, edit ' . php_ini_loaded_file() . ' and change this value (current ' . ini_get('upload_max_filesize') . ')
'; - echo '
'; -} -if (ini_get('post_max_size') != '1G' && ini_get('post_max_size') != '1024M') { - $error = true; - echo '
'; - echo '
post_max_size must be = 1G, edit ' . php_ini_loaded_file() . ' and change this value (current ' . ini_get('post_max_size') . ')
'; - echo '
'; -} -if ($error) { - echo ''; - echo ''; - die(); -} -$config = true; -if (init('hostname') != '' && init('username') != '' && init('password') != '') { - try { - $opt = array( - PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, - ); - if (init('database') == '') { - $_POST['database'] = 'jeedom'; - } - $dsn = "mysql:host=" . init('hostname') . ";port=" . init('port', '3306') . ";charset=utf8"; - $pdo = new PDO($dsn, init('username'), init('password'), $opt); - $sql = $pdo->prepare("CREATE DATABASE IF NOT EXISTS `" . init('database') . "`"); - $sql->execute(); - $dsn .= ";dbname=" . init('database'); - $pdo = new PDO($dsn, init('username'), init('password'), $opt); - $config = false; - if (init('eraseDatabase') == 'on') { - $sql = $pdo->prepare("SET foreign_key_checks = 0"); - $sql->execute(); - $tables = array(); - $result = $pdo->query("SHOW TABLES"); - while ($row = $result->fetch(PDO::FETCH_NUM)) { - $tables[] = $row[0]; - } - - foreach ($tables as $table) { - $sql = $pdo->prepare("DROP TABLE `$table`"); - $sql->execute(); - } - } - } catch (Exception $e) { - echo '
'; - echo '
Unable to connect to database
'; - echo '
';
-		echo $e->getMessage();
-		echo '
'; - echo '
'; - } -} - -if ($config) { - ?> -
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
-
- -
-
-
- '; - echo '
Folder ' . __DIR__ . '/../core/config' . ' must have write access
'; - echo ''; - echo ''; - echo ''; - die(); - } - $replace = array( - '#PASSWORD#' => init('password'), - '#DBNAME#' => init('database'), - '#USERNAME#' => init('username'), - '#PORT#' => init('port'), - '#HOST#' => init('hostname'), - ); - $config = str_replace(array_keys($replace), $replace, file_get_contents(__DIR__ . '/../core/config/common.config.sample.php')); - file_put_contents(__DIR__ . '/../core/config/common.config.php', $config); - shell_exec('php ' . __DIR__ . '/install.php mode=force > ' . __DIR__ . '/../log/jeedom_installation 2>&1 &'); - echo '
'; - echo '
The installation jeedom is ongoing.
'; - echo '
'; - echo '
';
-	?>
-			
-			
-	
-