X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=install%2Findex.php;h=2b080c16717e8bc1ab8fbc4038d3e5d66f409f66;hb=b668db242de35f13de0b317ceaa209574458e9c8;hp=b21cec521d0f8b2782acd8c8e977deb90e7bcbd1;hpb=8754bd88a5c999fc009f02774a993efbf2a99e54;p=github%2Fwallabag%2Fwallabag.git diff --git a/install/index.php b/install/index.php old mode 100644 new mode 100755 index b21cec52..2b080c16 --- a/install/index.php +++ b/install/index.php @@ -1,9 +1,39 @@ + * @copyright 2013 + * @license http://opensource.org/licenses/MIT see COPYING file + */ + $errors = array(); $successes = array(); -if ($_POST['download']) { + +/* Function taken from at http://php.net/manual/en/function.rmdir.php#110489 + * Idea : nbari at dalmp dot com + * Rights unknown + * Here in case of .gitignore files + */ +function delTree($dir) { + $files = array_diff(scandir($dir), array('.','..')); + foreach ($files as $file) { + (is_dir("$dir/$file")) ? delTree("$dir/$file") : unlink("$dir/$file"); + } + return rmdir($dir); + } + +if (isset($_GET['clean'])) { + if (is_dir('install')){ + delTree('install'); + header('Location: index.php'); + } +} + +if (isset($_POST['download'])) { if (!file_put_contents("cache/vendor.zip", fopen("http://static.wallabag.org/files/vendor.zip", 'r'))) { - $errors[] = 'Impossible to download vendor.zip. Please download it manually<∕a> and unzip it in your wallabag folder.'; + $errors[] = 'Impossible to download vendor.zip. Please download it manually and unzip it in your wallabag folder.'; } else { if (extension_loaded('zip')) { @@ -25,14 +55,14 @@ if ($_POST['download']) { } } } -else if ($_POST['install']) { +else if (isset($_POST['install'])) { if (!is_dir('vendor')) { $errors[] = 'You must install twig before.'; } else { $continue = true; // Create config.inc.php - if (!copy('inc/poche/config.inc.php.new', 'inc/poche/config.inc.php')) { + if (!copy('inc/poche/config.inc.default.php', 'inc/poche/config.inc.php')) { $errors[] = 'Installation aborted, impossible to create inc/poche/config.inc.php file. Maybe you don\'t have write access to create it.'; $continue = false; } @@ -64,22 +94,25 @@ else if ($_POST['install']) { else { $db_path = 'sqlite:' . realpath('') . '/db/poche.sqlite'; $handle = new PDO($db_path); + $sql_structure = ""; } } else { $content = file_get_contents('inc/poche/config.inc.php'); if ($_POST['db_engine'] == 'mysql') { - $db_path = 'mysql:host=' . $_POST['mysql_server'] . ';dbname=' . $_POST['mysql_database']; + $db_path = 'mysql:host=' . $_POST['mysql_server'] . ';dbname=' . $_POST['mysql_database'] . ';charset=utf8mb4'; $content = str_replace("define ('STORAGE_SERVER', 'localhost');", "define ('STORAGE_SERVER', '".$_POST['mysql_server']."');", $content); $content = str_replace("define ('STORAGE_DB', 'poche');", "define ('STORAGE_DB', '".$_POST['mysql_database']."');", $content); $content = str_replace("define ('STORAGE_USER', 'poche');", "define ('STORAGE_USER', '".$_POST['mysql_user']."');", $content); $content = str_replace("define ('STORAGE_PASSWORD', 'poche');", "define ('STORAGE_PASSWORD', '".$_POST['mysql_password']."');", $content); - $handle = new PDO($db_path, $_POST['mysql_user'], $_POST['mysql_password']); + $handle = new PDO($db_path, $_POST['mysql_user'], $_POST['mysql_password'], array( + PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4', + )); $sql_structure = file_get_contents('install/mysql.sql'); } - else if ($_POST['db_engine'] == 'postgresql') { + else if ($_POST['db_engine'] == 'postgres') { $db_path = 'pgsql:host=' . $_POST['pg_server'] . ';dbname=' . $_POST['pg_database']; $content = str_replace("define ('STORAGE_SERVER', 'localhost');", "define ('STORAGE_SERVER', '".$_POST['pg_server']."');", $content); $content = str_replace("define ('STORAGE_DB', 'poche');", "define ('STORAGE_DB', '".$_POST['pg_database']."');", $content); @@ -129,7 +162,7 @@ else if ($_POST['install']) { $params = array($id_user, 'language', 'en_EN.UTF8'); $query = executeQuery($handle, $sql, $params); - $successes[] = 'wallabag is now installed. Don\'t forget to delete install folder. Then, reload this page.'; + $successes[] = 'wallabag is now installed. You can now access it !'; } } } @@ -143,7 +176,7 @@ else if ($_POST['install']) { - wallabag — installation + wallabag - installation @@ -154,7 +187,7 @@ else if ($_POST['install']) { - + @@ -198,18 +231,18 @@ else if ($_POST['install']) {

- wallabag seems already installed. If you want to update it, you only have to delete install folder. + wallabag seems already installed. If you want to update it, you only have to delete install folder, then reload this page.

To install wallabag, you just have to fill the following fields. That's all.

-

Don't forget to check your server compatibility here.

+

Don't forget to check your server compatibility here.

Technical settings -
wallabag needs twig, a template engine (?). Two ways to install it: +
wallabag needs twig, a template engine (?). Two ways to install it:
  • automatically download and extract vendor.zip into your wallabag folder.

    @@ -240,12 +273,12 @@ php composer.phar install
  • - +
    • - id
    • +
  • @@ -294,7 +327,7 @@ php composer.phar install $("#install_button").show(); } else { - if ( $("#postgresql").prop('checked')) { + if ( $("#postgres").prop('checked')) { $("#mysql_infos").hide(); $("#pg_infos").show(); $("#pdo_sqlite").hide();