aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-08-03 15:29:40 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-08-03 15:29:40 +0200
commit78b9c82aa38c076e9d8d057548e6ab50afbc1f16 (patch)
treefd17a3cc303a8143c570e2a58d637f0da3dfad61
parenta9a61929485279c819d42b7a2d65b8a1f5e2cfdd (diff)
parente05e9a87021862b334bccedb3d2383e9fa568a9b (diff)
Merge pull request #562 from aledeg/install
Refactor install file to check available databases
-rw-r--r--app/i18n/install.en.php4
-rw-r--r--app/i18n/install.fr.php4
-rw-r--r--app/install.php18
3 files changed, 17 insertions, 9 deletions
diff --git a/app/i18n/install.en.php b/app/i18n/install.en.php
index 553a79921..50208fcef 100644
--- a/app/i18n/install.en.php
+++ b/app/i18n/install.en.php
@@ -28,8 +28,8 @@ return array (
'minz_is_nok' => 'You lack the Minz framework. You should execute <em>build.sh</em> script or <a href="https://github.com/marienfressinaud/MINZ">download it on Github</a> and install in <em>%s</em> directory the content of its <em>/lib</em> directory.',
'curl_is_ok' => 'You have version %s of cURL',
'curl_is_nok' => 'You lack cURL (php5-curl package)',
- 'pdomysql_is_ok' => 'You have PDO and its driver for MySQL',
- 'pdomysql_is_nok' => 'You lack PDO or its driver for MySQL (php5-mysql package)',
+ 'pdo_is_ok' => 'You have PDO and at least one of the supported drivers (pdo_mysql, pdo_sqlite)',
+ 'pdo_is_nok' => 'You lack PDO or one of the supported drivers (pdo_mysql, pdo_sqlite)',
'dom_is_ok' => 'You have the required library to browse the DOM',
'dom_is_nok' => 'You lack a required library to browse the DOM (php-xml package)',
'pcre_is_ok' => 'You have the required library for regular expressions (PCRE)',
diff --git a/app/i18n/install.fr.php b/app/i18n/install.fr.php
index 470d83e1a..9c039f904 100644
--- a/app/i18n/install.fr.php
+++ b/app/i18n/install.fr.php
@@ -28,8 +28,8 @@ return array (
'minz_is_nok' => 'Vous ne disposez pas de la librairie Minz. Vous devriez exécuter le script <em>build.sh</em> ou bien <a href="https://github.com/marienfressinaud/MINZ">la télécharger sur Github</a> et installer dans le répertoire <em>%s</em> le contenu de son répertoire <em>/lib</em>.',
'curl_is_ok' => 'Vous disposez de cURL dans sa version %s',
'curl_is_nok' => 'Vous ne disposez pas de cURL (paquet php5-curl)',
- 'pdomysql_is_ok' => 'Vous disposez de PDO et de son driver pour MySQL (paquet php5-mysql)',
- 'pdomysql_is_nok' => 'Vous ne disposez pas de PDO ou de son driver pour MySQL',
+ 'pdo_is_ok' => 'Vous disposez de PDO et d’au moins un des drivers supportés (pdo_mysql, pdo_sqlite)',
+ 'pdo_is_nok' => 'Vous ne disposez pas de PDO ou d’un des drivers supportés (pdo_mysql, pdo_sqlite)',
'dom_is_ok' => 'Vous disposez du nécessaire pour parcourir le DOM',
'dom_is_nok' => 'Il manque une librairie pour parcourir le DOM (paquet php-xml)',
'pcre_is_ok' => 'Vous disposez du nécessaire pour les expressions régulières (PCRE)',
diff --git a/app/install.php b/app/install.php
index 66d663114..eaa1100c1 100644
--- a/app/install.php
+++ b/app/install.php
@@ -574,7 +574,9 @@ function checkStep1 () {
$php = version_compare (PHP_VERSION, '5.2.1') >= 0;
$minz = file_exists (LIB_PATH . '/Minz');
$curl = extension_loaded ('curl');
- $pdo = extension_loaded ('pdo_mysql');
+ $pdo_mysql = extension_loaded ('pdo_mysql');
+ $pdo_sqlite = extension_loaded ('pdo_sqlite');
+ $pdo = $pdo_mysql || $pdo_sqlite;
$pcre = extension_loaded ('pcre');
$ctype = extension_loaded ('ctype');
$dom = class_exists('DOMDocument');
@@ -588,7 +590,9 @@ function checkStep1 () {
'php' => $php ? 'ok' : 'ko',
'minz' => $minz ? 'ok' : 'ko',
'curl' => $curl ? 'ok' : 'ko',
- 'pdo-mysql' => $pdo ? 'ok' : 'ko',
+ 'pdo-mysql' => $pdo_mysql ? 'ok' : 'ko',
+ 'pdo-sqlite' => $pdo_sqlite ? 'ok' : 'ko',
+ 'pdo' => $pdo ? 'ok' : 'ko',
'pcre' => $pcre ? 'ok' : 'ko',
'ctype' => $ctype ? 'ok' : 'ko',
'dom' => $dom ? 'ok' : 'ko',
@@ -766,10 +770,10 @@ function printStep1 () {
<p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('minz_is_nok', LIB_PATH . '/Minz'); ?></p>
<?php } ?>
- <?php if ($res['pdo-mysql'] == 'ok') { ?>
- <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('pdomysql_is_ok'); ?></p>
+ <?php if ($res['pdo'] == 'ok') { ?>
+ <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('pdo_is_ok'); ?></p>
<?php } else { ?>
- <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('pdomysql_is_nok'); ?></p>
+ <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('pdo_is_nok'); ?></p>
<?php } ?>
<?php if ($res['curl'] == 'ok') { ?>
@@ -923,14 +927,18 @@ function printStep3 () {
<label class="group-name" for="type"><?php echo _t ('bdd_type'); ?></label>
<div class="group-controls">
<select name="type" id="type" onchange="mySqlShowHide()">
+ <?php if (extension_loaded('pdo_mysql')) {?>
<option value="mysql"
<?php echo (isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'mysql') ? 'selected="selected"' : ''; ?>>
MySQL
</option>
+ <?php }?>
+ <?php if (extension_loaded('pdo_sqlite')) {?>
<option value="sqlite"
<?php echo (isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'sqlite') ? 'selected="selected"' : ''; ?>>
SQLite
</option>
+ <?php }?>
</select>
</div>
</div>