aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xinstall/index.php92
-rw-r--r--install/install_functions.php22
2 files changed, 65 insertions, 49 deletions
diff --git a/install/index.php b/install/index.php
index 30bc2f6b..1f11413a 100755
--- a/install/index.php
+++ b/install/index.php
@@ -296,7 +296,7 @@ cursor: pointer;
296} 296}
297.compatibity_result { 297.compatibity_result {
298 margin: auto; 298 margin: auto;
299 max-width: 300px; 299 max-width: 350px;
300 min-height: 50px; 300 min-height: 50px;
301 line-height: 50px; 301 line-height: 50px;
302 text-align: center; 302 text-align: center;
@@ -386,10 +386,10 @@ border: 1px solid #000;
386 <?php if (isOkay()) { ?> 386 <?php if (isOkay()) { ?>
387 <div class="compatibity_result detail good">All good</div> 387 <div class="compatibity_result detail good">All good</div>
388 <?php } elseif (isPassing()) { ?> 388 <?php } elseif (isPassing()) { ?>
389 <div class="compatibity_result detail pass">Some problems, but it's OK !</div> 389 <div class="compatibity_result detail pass">Some warnings, but the minimum is here !</div>
390 <?php } else { ?> 390 <?php } else { ?>
391 <div class="compatibity_result detail bad">Bad news : you can't run wallabag</div> 391 <div class="compatibity_result detail bad">Bad news : you can't run wallabag</div>
392 <?php } $status = status(); ?> 392 <?php } $status = status(); $pdo_drivers = pdoDrivers(); ?>
393 </div> 393 </div>
394 394
395 <div class="details"> 395 <div class="details">
@@ -569,38 +569,54 @@ php composer.phar install</code></pre>
569 <p> 569 <p>
570 Database engine: 570 Database engine:
571 <ul> 571 <ul>
572 <li><label for="sqlite">SQLite</label> <input name="db_engine" type="radio" checked="" id="sqlite" value="sqlite" /> 572 <li>
573 <div id="pdo_sqlite" class='messages error install'> 573 <?php if ($pdo_drivers['sqlite']) { ?>
574 <p>You have to enable <a href="http://php.net/manual/ref.pdo-sqlite.php">pdo_sqlite extension</a>.</p> 574 <label for="sqlite">SQLite</label> <input name="db_engine" type="radio" checked="" id="sqlite" value="sqlite" />
575 </div> 575 <?php } else { ?>
576 </li> 576 <div class="messages notice">
577 <li> 577 <p>You have to enable <a href="http://php.net/manual/ref.pdo-sqlite.php">pdo_sqlite extension</a> to use SQLite.</p>
578 <label for="mysql">MySQL</label> <input name="db_engine" type="radio" id="mysql" value="mysql" /> 578 </div>
579 <div id="pdo_mysql" class='messages notice install'> 579 <?php } ?>
580 <p>All fields have to be filled.</p> 580 </li>
581 </div> 581 <li>
582 <ul id="mysql_infos"> 582 <?php if ($pdo_drivers['mysql']) { ?>
583 <li><label for="mysql_server">Server</label> <input type="text" placeholder="localhost" id="mysql_server" name="mysql_server" /></li> 583 <label for="mysql">MySQL</label> <input name="db_engine" type="radio" id="mysql" value="mysql" />
584 <li><label for="mysql_database">Database</label> <input type="text" placeholder="wallabag" id="mysql_database" name="mysql_database" /></li> 584 <div id="pdo_mysql" class='messages notice install'>
585 <li><label for="mysql_user">User</label> <input type="text" placeholder="user" id="mysql_user" name="mysql_user" /></li> 585 <p>All fields have to be filled.</p>
586 <li><label for="mysql_password">Password</label> <input type="password" placeholder="p4ssw0rd" id="mysql_password" name="mysql_password" /></li> 586 </div>
587 <li><label for="mysql_utf8_mb4">Use UTF-8 MB4</label> <input id="mysql_utf8_mb4" type="checkbox" name="mysql_utf8_mb4"> 587 <ul id="mysql_infos">
588 <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. 588 <li><label for="mysql_server">Server</label> <input type="text" placeholder="localhost" id="mysql_server" name="mysql_server" /></li>
589 <li><label for="mysql_database">Database</label> <input type="text" placeholder="wallabag" id="mysql_database" name="mysql_database" /></li>
590 <li><label for="mysql_user">User</label> <input type="text" placeholder="user" id="mysql_user" name="mysql_user" /></li>
591 <li><label for="mysql_password">Password</label> <input type="password" placeholder="p4ssw0rd" id="mysql_password" name="mysql_password" /></li>
592 <li><label for="mysql_utf8_mb4">Use UTF-8 MB4</label> <input id="mysql_utf8_mb4" type="checkbox" name="mysql_utf8_mb4">
593 <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.
589 Install will failed if you check this while using an older MySQL server.</div></li> 594 Install will failed if you check this while using an older MySQL server.</div></li>
590 </ul> 595 </ul>
591 </li> 596 <?php } else { ?>
592 <li> 597 <div class="messages notice">
593 <label for="postgres">PostgreSQL</label> <input name="db_engine" type="radio" id="postgres" value="postgres" /> 598 <p>You have to enable <a href="http://php.net/manual/ref.pdo-mysql.php">pdo_mysql extension</a> to use MySQL.</p>
594 <div id="pdo_postgres" class='messages notice install'> 599 </div>
600 <?php } ?>
601 </li>
602 <li>
603 <?php if ($pdo_drivers['postgres']) { ?>
604 <label for="postgres">PostgreSQL</label> <input name="db_engine" type="radio" id="postgres" value="postgres" />
605 <div id="pdo_postgres" class='messages notice install'>
595 <p>All fields have to be filled.</p> 606 <p>All fields have to be filled.</p>
596 </div> 607 </div>
597 <ul id="pg_infos"> 608 <ul id="pg_infos">
598 <li><label for="pg_server">Server</label> <input type="text" placeholder="localhost" id="pg_server" name="pg_server" /></li> 609 <li><label for="pg_server">Server</label> <input type="text" placeholder="localhost" id="pg_server" name="pg_server" /></li>
599 <li><label for="pg_database">Database</label> <input type="text" placeholder="wallabag" id="pg_database" name="pg_database" /></li> 610 <li><label for="pg_database">Database</label> <input type="text" placeholder="wallabag" id="pg_database" name="pg_database" /></li>
600 <li><label for="pg_user">User</label> <input type="text" placeholder="user" id="pg_user" name="pg_user" /></li> 611 <li><label for="pg_user">User</label> <input type="text" placeholder="user" id="pg_user" name="pg_user" /></li>
601 <li><label for="pg_password">Password</label> <input type="password" placeholder="p4ssw0rd" id="pg_password" name="pg_password" /></li> 612 <li><label for="pg_password">Password</label> <input type="password" placeholder="p4ssw0rd" id="pg_password" name="pg_password" /></li>
602 </ul> 613 </ul>
603 </li> 614 <?php } else { ?>
615 <div class="messages notice">
616 <p>You have to enable <a href="https://php.net/manual/ref.pdo-pgsql.php">pdo_pgsql extension</a> to use PostgreSQL.</p>
617 </div>
618 <?php } ?>
619 </li>
604 </ul> 620 </ul>
605 </p> 621 </p>
606 </fieldset> 622 </fieldset>
@@ -672,17 +688,6 @@ php composer.phar install</code></pre>
672 endif; 688 endif;
673 ?> 689 ?>
674 690
675 <?php
676 if (!extension_loaded('pdo_sqlite')) : ?>
677 $("#install_button").hide();
678 <?php
679 else :
680 ?>
681 $("#pdo_sqlite").hide();
682 <?php
683 endif;
684 ?>
685
686 $("#mysql_utf8_mb4").click(function() { 691 $("#mysql_utf8_mb4").click(function() {
687 $("#utf8_mb4_infos").toggle(); 692 $("#utf8_mb4_infos").toggle();
688 }); 693 });
@@ -720,13 +725,6 @@ php composer.phar install</code></pre>
720 $("#sqlite_description").show(); 725 $("#sqlite_description").show();
721 $("#mysql_description").hide(); 726 $("#mysql_description").hide();
722 $("#postgres_description").hide(); 727 $("#postgres_description").hide();
723 <?php
724 if (!extension_loaded('pdo_sqlite')) : ?>
725 $("#pdo_sqlite").show();
726 $("#install_button").hide();
727 <?php
728 endif;
729 ?>
730 } 728 }
731 } 729 }
732 }); 730 });
diff --git a/install/install_functions.php b/install/install_functions.php
index 3b465851..4a18d7d8 100644
--- a/install/install_functions.php
+++ b/install/install_functions.php
@@ -26,7 +26,10 @@ $allow_url_fopen_ok = (bool)ini_get('allow_url_fopen');
26$filter_ok = extension_loaded('filter'); 26$filter_ok = extension_loaded('filter');
27$gettext_ok = function_exists("gettext"); 27$gettext_ok = function_exists("gettext");
28$gd_ok = extension_loaded('gd'); 28$gd_ok = extension_loaded('gd');
29$pdo_drivers_passing = extension_loaded('pdo_sqlite') || extension_loaded('pdo_mysql') || extension_loaded('pdo_pgsql'); 29$pdo_drivers = pdoDrivers();
30$pdo_drivers_passing = $pdo_drivers['sqlite'] || $pdo_drivers['mysql'] || $pdo_drivers['postgres'];
31
32
30 33
31if (extension_loaded('xmlreader')) { 34if (extension_loaded('xmlreader')) {
32 $xml_ok = true; 35 $xml_ok = true;
@@ -39,7 +42,11 @@ if (extension_loaded('xmlreader')) {
39 $xml_ok = false; 42 $xml_ok = false;
40} 43}
41 44
42$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); 45$status = array('app_name' => $app_name, 'php' => $php_ok, 'pdo' => $pdo_ok,
46 'pdo_drivers_passing' => $pdo_drivers_passing, 'xml' => $xml_ok, 'pcre' => $pcre_ok,
47 'zlib' => $zlib_ok, 'mbstring' => $mbstring_ok, 'dom' => $dom_ok, 'iconv' => $iconv_ok, 'tidy' => $tidy_ok, 'curl' => $curl_ok,
48 'parse_ini' => $parse_ini_ok, 'parallel' => $parallel_ok, 'allow_url_fopen' => $allow_url_fopen_ok, 'filter' => $filter_ok,
49 'gettext' => $gettext_ok, 'gd' => $gd_ok);
43 50
44return $status; 51return $status;
45} 52}
@@ -53,6 +60,17 @@ function isPassing() {
53 return !in_array(false, $status); 60 return !in_array(false, $status);
54} 61}
55 62
63function pdoDrivers() {
64 $pdo_driver_sqlite = extension_loaded('pdo_sqlite');
65 $pdo_driver_mysql = extension_loaded('pdo_mysql');
66 $pdo_driver_postgres = extension_loaded('pdo_pgsql');
67
68 $pdo_drivers = array('sqlite' => $pdo_driver_sqlite, 'mysql' => $pdo_driver_mysql,
69 'postgres' => $pdo_driver_postgres);
70
71 return $pdo_drivers;
72}
73
56/* Function taken from at http://php.net/manual/en/function.rmdir.php#110489 74/* Function taken from at http://php.net/manual/en/function.rmdir.php#110489
57 * Idea : nbari at dalmp dot com 75 * Idea : nbari at dalmp dot com
58 * Rights unknown 76 * Rights unknown