aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include/functions_install.inc.php
diff options
context:
space:
mode:
authornikrou <nikrou@piwigo.org>2010-02-27 20:00:00 +0000
committernikrou <nikrou@piwigo.org>2010-02-27 20:00:00 +0000
commitd4287e2ad82770d8903dc1eb6cb906bb690de63a (patch)
tree614d7d8e12c9cbf94ba09682e09206aef370dd82 /admin/include/functions_install.inc.php
parent4986d620e35d0ddecfb88c444cc220d379a48cda (diff)
Feature 1460 : Customize form installation depending on database engine
- sqlite is proposed by default if severals database engine are available (cf conf) - sqlite is proposed before pdo-sqlite - remove host, user and password for sqlite git-svn-id: http://piwigo.org/svn/trunk@4985 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/include/functions_install.inc.php')
-rw-r--r--admin/include/functions_install.inc.php39
1 files changed, 30 insertions, 9 deletions
diff --git a/admin/include/functions_install.inc.php b/admin/include/functions_install.inc.php
index 65b1a24d6..166ed6b7d 100644
--- a/admin/include/functions_install.inc.php
+++ b/admin/include/functions_install.inc.php
@@ -86,20 +86,41 @@ function available_engines()
foreach ($dblayers as $engine_name => $engine)
{
- if (file_exists(sprintf($pattern, $engine_name))
- && isset($engine['function_available'])
- && function_exists($engine['function_available']))
+ if (file_exists(sprintf($pattern, $engine_name)))
{
- $engines[$engine_name] = $engine['engine'];
+ $engines[$engine_name]['label'] = $engine['engine'];
+ $engines[$engine_name]['available'] = 'disabled';
+
+ if (isset($engine['function_available'])
+ && function_exists($engine['function_available']))
+ {
+ $engines[$engine_name]['available'] = true;
+ }
+ elseif (isset($engine['class_available'])
+ && class_exists($engine['class_available']))
+ {
+ $engines[$engine_name]['available'] = true;
+ }
+ }
+ }
+
+ if (count($engines)>1)
+ {
+ $engines[$GLOBALS['conf']['dbengine_select_default']]['selected'] = true;
+ }
+
+ if ($engines['sqlite']['available'] && $engines['pdo-sqlite']['available'])
+ {
+ if ($GLOBALS['conf']['db_sqlite_default']=='native')
+ {
+ unset($engines['pdo-sqlite']);
}
- elseif (file_exists(sprintf($pattern, $engine_name))
- && isset($engine['class_available'])
- && class_exists($engine['class_available']))
+ else
{
- $engines[$engine_name] = $engine['engine'];
+ unset($engines['sqlite']);
}
}
-
+
return $engines;
}
?> \ No newline at end of file