improvements for the installer

This commit is contained in:
Thomas Citharel 2015-02-10 00:32:38 +01:00
parent b65d65be31
commit 8d7ec54658
2 changed files with 65 additions and 49 deletions

View file

@ -296,7 +296,7 @@ cursor: pointer;
} }
.compatibity_result { .compatibity_result {
margin: auto; margin: auto;
max-width: 300px; max-width: 350px;
min-height: 50px; min-height: 50px;
line-height: 50px; line-height: 50px;
text-align: center; text-align: center;
@ -386,10 +386,10 @@ border: 1px solid #000;
<?php if (isOkay()) { ?> <?php if (isOkay()) { ?>
<div class="compatibity_result detail good">All good</div> <div class="compatibity_result detail good">All good</div>
<?php } elseif (isPassing()) { ?> <?php } elseif (isPassing()) { ?>
<div class="compatibity_result detail pass">Some problems, but it's OK !</div> <div class="compatibity_result detail pass">Some warnings, but the minimum is here !</div>
<?php } else { ?> <?php } else { ?>
<div class="compatibity_result detail bad">Bad news : you can't run wallabag</div> <div class="compatibity_result detail bad">Bad news : you can't run wallabag</div>
<?php } $status = status(); ?> <?php } $status = status(); $pdo_drivers = pdoDrivers(); ?>
</div> </div>
<div class="details"> <div class="details">
@ -569,38 +569,54 @@ php composer.phar install</code></pre>
<p> <p>
Database engine: Database engine:
<ul> <ul>
<li><label for="sqlite">SQLite</label> <input name="db_engine" type="radio" checked="" id="sqlite" value="sqlite" /> <li>
<div id="pdo_sqlite" class='messages error install'> <?php if ($pdo_drivers['sqlite']) { ?>
<p>You have to enable <a href="http://php.net/manual/ref.pdo-sqlite.php">pdo_sqlite extension</a>.</p> <label for="sqlite">SQLite</label> <input name="db_engine" type="radio" checked="" id="sqlite" value="sqlite" />
</div> <?php } else { ?>
</li> <div class="messages notice">
<li> <p>You have to enable <a href="http://php.net/manual/ref.pdo-sqlite.php">pdo_sqlite extension</a> to use SQLite.</p>
<label for="mysql">MySQL</label> <input name="db_engine" type="radio" id="mysql" value="mysql" /> </div>
<div id="pdo_mysql" class='messages notice install'> <?php } ?>
<p>All fields have to be filled.</p> </li>
</div> <li>
<ul id="mysql_infos"> <?php if ($pdo_drivers['mysql']) { ?>
<li><label for="mysql_server">Server</label> <input type="text" placeholder="localhost" id="mysql_server" name="mysql_server" /></li> <label for="mysql">MySQL</label> <input name="db_engine" type="radio" id="mysql" value="mysql" />
<li><label for="mysql_database">Database</label> <input type="text" placeholder="wallabag" id="mysql_database" name="mysql_database" /></li> <div id="pdo_mysql" class='messages notice install'>
<li><label for="mysql_user">User</label> <input type="text" placeholder="user" id="mysql_user" name="mysql_user" /></li> <p>All fields have to be filled.</p>
<li><label for="mysql_password">Password</label> <input type="password" placeholder="p4ssw0rd" id="mysql_password" name="mysql_password" /></li> </div>
<li><label for="mysql_utf8_mb4">Use UTF-8 MB4</label> <input id="mysql_utf8_mb4" type="checkbox" name="mysql_utf8_mb4"> <ul id="mysql_infos">
<div id="utf8_mb4_infos"><em>Warning :</em> UTF-8 MB4 is used to fully support unicode characters. It is available only with MySQL starting with version 5.5.3. <li><label for="mysql_server">Server</label> <input type="text" placeholder="localhost" id="mysql_server" name="mysql_server" /></li>
<li><label for="mysql_database">Database</label> <input type="text" placeholder="wallabag" id="mysql_database" name="mysql_database" /></li>
<li><label for="mysql_user">User</label> <input type="text" placeholder="user" id="mysql_user" name="mysql_user" /></li>
<li><label for="mysql_password">Password</label> <input type="password" placeholder="p4ssw0rd" id="mysql_password" name="mysql_password" /></li>
<li><label for="mysql_utf8_mb4">Use UTF-8 MB4</label> <input id="mysql_utf8_mb4" type="checkbox" name="mysql_utf8_mb4">
<div id="utf8_mb4_infos"><em>Warning :</em> UTF-8 MB4 is used to fully support unicode characters. It is available only with MySQL starting with version 5.5.3.
Install will failed if you check this while using an older MySQL server.</div></li> Install will failed if you check this while using an older MySQL server.</div></li>
</ul> </ul>
</li> <?php } else { ?>
<li> <div class="messages notice">
<label for="postgres">PostgreSQL</label> <input name="db_engine" type="radio" id="postgres" value="postgres" /> <p>You have to enable <a href="http://php.net/manual/ref.pdo-mysql.php">pdo_mysql extension</a> to use MySQL.</p>
<div id="pdo_postgres" class='messages notice install'> </div>
<?php } ?>
</li>
<li>
<?php if ($pdo_drivers['postgres']) { ?>
<label for="postgres">PostgreSQL</label> <input name="db_engine" type="radio" id="postgres" value="postgres" />
<div id="pdo_postgres" class='messages notice install'>
<p>All fields have to be filled.</p> <p>All fields have to be filled.</p>
</div> </div>
<ul id="pg_infos"> <ul id="pg_infos">
<li><label for="pg_server">Server</label> <input type="text" placeholder="localhost" id="pg_server" name="pg_server" /></li> <li><label for="pg_server">Server</label> <input type="text" placeholder="localhost" id="pg_server" name="pg_server" /></li>
<li><label for="pg_database">Database</label> <input type="text" placeholder="wallabag" id="pg_database" name="pg_database" /></li> <li><label for="pg_database">Database</label> <input type="text" placeholder="wallabag" id="pg_database" name="pg_database" /></li>
<li><label for="pg_user">User</label> <input type="text" placeholder="user" id="pg_user" name="pg_user" /></li> <li><label for="pg_user">User</label> <input type="text" placeholder="user" id="pg_user" name="pg_user" /></li>
<li><label for="pg_password">Password</label> <input type="password" placeholder="p4ssw0rd" id="pg_password" name="pg_password" /></li> <li><label for="pg_password">Password</label> <input type="password" placeholder="p4ssw0rd" id="pg_password" name="pg_password" /></li>
</ul> </ul>
</li> <?php } else { ?>
<div class="messages notice">
<p>You have to enable <a href="https://php.net/manual/ref.pdo-pgsql.php">pdo_pgsql extension</a> to use PostgreSQL.</p>
</div>
<?php } ?>
</li>
</ul> </ul>
</p> </p>
</fieldset> </fieldset>
@ -672,17 +688,6 @@ php composer.phar install</code></pre>
endif; endif;
?> ?>
<?php
if (!extension_loaded('pdo_sqlite')) : ?>
$("#install_button").hide();
<?php
else :
?>
$("#pdo_sqlite").hide();
<?php
endif;
?>
$("#mysql_utf8_mb4").click(function() { $("#mysql_utf8_mb4").click(function() {
$("#utf8_mb4_infos").toggle(); $("#utf8_mb4_infos").toggle();
}); });
@ -720,13 +725,6 @@ php composer.phar install</code></pre>
$("#sqlite_description").show(); $("#sqlite_description").show();
$("#mysql_description").hide(); $("#mysql_description").hide();
$("#postgres_description").hide(); $("#postgres_description").hide();
<?php
if (!extension_loaded('pdo_sqlite')) : ?>
$("#pdo_sqlite").show();
$("#install_button").hide();
<?php
endif;
?>
} }
} }
}); });

View file

@ -26,7 +26,10 @@ $allow_url_fopen_ok = (bool)ini_get('allow_url_fopen');
$filter_ok = extension_loaded('filter'); $filter_ok = extension_loaded('filter');
$gettext_ok = function_exists("gettext"); $gettext_ok = function_exists("gettext");
$gd_ok = extension_loaded('gd'); $gd_ok = extension_loaded('gd');
$pdo_drivers_passing = extension_loaded('pdo_sqlite') || extension_loaded('pdo_mysql') || extension_loaded('pdo_pgsql'); $pdo_drivers = pdoDrivers();
$pdo_drivers_passing = $pdo_drivers['sqlite'] || $pdo_drivers['mysql'] || $pdo_drivers['postgres'];
if (extension_loaded('xmlreader')) { if (extension_loaded('xmlreader')) {
$xml_ok = true; $xml_ok = true;
@ -39,7 +42,11 @@ if (extension_loaded('xmlreader')) {
$xml_ok = false; $xml_ok = false;
} }
$status = array('app_name' => $app_name, 'php' => $php_ok, 'pdo' => $pdo_ok, 'pdo_drivers_passing' => $pdo_drivers_passing, 'xml' => $xml_ok, 'pcre' => $pcre_ok, 'zlib' => $zlib_ok, 'mbstring' => $mbstring_ok, 'dom' => $dom_ok, 'iconv' => $iconv_ok, 'tidy' => $tidy_ok, 'curl' => $curl_ok, 'parse_ini' => $parse_ini_ok, 'parallel' => $parallel_ok, 'allow_url_fopen' => $allow_url_fopen_ok, 'filter' => $filter_ok, 'gettext' => $gettext_ok, 'gd' => $gd_ok); $status = array('app_name' => $app_name, 'php' => $php_ok, 'pdo' => $pdo_ok,
'pdo_drivers_passing' => $pdo_drivers_passing, 'xml' => $xml_ok, 'pcre' => $pcre_ok,
'zlib' => $zlib_ok, 'mbstring' => $mbstring_ok, 'dom' => $dom_ok, 'iconv' => $iconv_ok, 'tidy' => $tidy_ok, 'curl' => $curl_ok,
'parse_ini' => $parse_ini_ok, 'parallel' => $parallel_ok, 'allow_url_fopen' => $allow_url_fopen_ok, 'filter' => $filter_ok,
'gettext' => $gettext_ok, 'gd' => $gd_ok);
return $status; return $status;
} }
@ -53,6 +60,17 @@ function isPassing() {
return !in_array(false, $status); return !in_array(false, $status);
} }
function pdoDrivers() {
$pdo_driver_sqlite = extension_loaded('pdo_sqlite');
$pdo_driver_mysql = extension_loaded('pdo_mysql');
$pdo_driver_postgres = extension_loaded('pdo_pgsql');
$pdo_drivers = array('sqlite' => $pdo_driver_sqlite, 'mysql' => $pdo_driver_mysql,
'postgres' => $pdo_driver_postgres);
return $pdo_drivers;
}
/* Function taken from at http://php.net/manual/en/function.rmdir.php#110489 /* Function taken from at http://php.net/manual/en/function.rmdir.php#110489
* Idea : nbari at dalmp dot com * Idea : nbari at dalmp dot com
* Rights unknown * Rights unknown