]> git.mxchange.org Git - mailer.git/blobdiff - inc/install-functions.php
Added stuff for PHP extension selection in both installers.
[mailer.git] / inc / install-functions.php
index 5f027b3f7e1bf44e9e349f585a808337f2c0778f..9fd326f7e9dc5d059323845269fff44604aeb706 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Funktionen fuer die Installationsroutine         *
  * -------------------------------------------------------------------- *
- * $Revision::                                                        $ *
- * $Date::                                                            $ *
- * $Tag:: 0.2.1-FINAL                                                 $ *
- * $Author::                                                          $ *
- * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
  * Copyright (c) 2009 - 2013 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
@@ -82,7 +77,7 @@ function initInstaller () {
 }
 
 // Write the local config-local.php file from "template"
-function doInstallWriteLocalConfigurationFile ($path, $url, $title, $slogan, $email, $noPassword, $writeFooter, $backLink, $databaseHost, $databaseName, $databaseLogin, $databasePassword, $databasePrefix, $databaseType, $smtpHost, $smtpUser, $smtpPassword) {
+function doInstallWriteLocalConfigurationFile ($path, $url, $title, $slogan, $email, $noPassword, $writeFooter, $backLink, $databaseHost, $databaseName, $databaseLogin, $databasePassword, $databasePrefix, $tableType, $databaseExtension, $smtpHost, $smtpUser, $smtpPassword) {
        // Copy the config template and verify it
        copyFileVerified($path . 'inc/config-local.php.dist', $path . getCachePath() . 'config-local.php', 0644);
 
@@ -110,7 +105,8 @@ function doInstallWriteLocalConfigurationFile ($path, $url, $title, $slogan, $em
        changeDataInLocalConfigurationFile('MYSQL-LOGIN', "     'login'    => '", "',", $databaseLogin, 0);
        changeDataInLocalConfigurationFile('MYSQL-PASSWORD', "  'password' => '", "',", $databasePassword, 0);
        changeDataInLocalConfigurationFile('MYSQL-PREFIX', "setConfigEntry('_MYSQL_PREFIX', '", "');", $databasePrefix, 0);
-       changeDataInLocalConfigurationFile('TABLE-TYPE', "setConfigEntry('_TABLE_TYPE', '", "');", $databaseType, 0);
+       changeDataInLocalConfigurationFile('TABLE-TYPE', "setConfigEntry('_TABLE_TYPE', '", "');", $tableType, 0);
+       changeDataInLocalConfigurationFile('DATABASE-TYPE', "setConfigEntry('_DB_TYPE', '", "');", $databaseExtension, 0);
        changeDataInLocalConfigurationFile('SMTP-HOSTNAME', "setConfigEntry('SMTP_HOSTNAME', '", "');", $smtpHost, 0);
        changeDataInLocalConfigurationFile('SMTP-USER', "setConfigEntry('SMTP_USER', '", "');", $smtpUser, 0);
        changeDataInLocalConfigurationFile('SMTP-PASSWORD', "setConfigEntry('SMTP_PASSWORD', '", "');", $smtpPassword, 0);
@@ -192,12 +188,58 @@ function generateInstallerFooterNavigation () {
 function generateInstallerDatabaseTypeOptions () {
        return generateOptions(
                '/ARRAY/',
-               array('MyISAM', 'InnoDB'),
-               array('{--INSTALLER_TABLE_TYPE_MYISAM--}', '{--INSTALLER_TABLE_TYPE_INNODB--}'),
+               array(
+                       'MyISAM',
+                       'InnoDB'
+               ),
+               array(
+                       '{--INSTALLER_TABLE_TYPE_MYISAM--}',
+                       '{--INSTALLER_TABLE_TYPE_INNODB--}'
+               ),
                getSession('mysql_engine')
        );
 }
 
+// Generate an option list for database extensions for given default value
+function generateInstallerDatabaseExtensionOptions () {
+       // Init all arrays
+       $keys = array();
+       $values = array();
+       $foundExtensions = array();
+
+       // Scan directory
+       $drivers = getArrayFromDirectory('inc/db/', 'lib-', FALSE, FALSE);
+
+       // Remove prefix + extension
+       foreach ($drivers as $key => $driver) {
+               // Remove driver
+               $drivers[$key] = substr($driver, 4, -4);
+
+               // Is the corresponding extension loaded?
+               if (isPhpExtensionLoaded($drivers[$key])) {
+                       // Then add it
+                       array_push($foundExtensions, $drivers[$key]);
+               } // END - if
+       } // END - foreach
+
+       // Generate list for keys/values ("translations")
+       foreach ($foundExtensions as $extension) {
+               // Use it as direct key
+               array_push($keys, $extension);
+
+               // Add "translation" function around it as value
+               array_push($values, '{%pipe,translatePhpExtension=' . $extension . '%}');
+       } // END - if
+
+       // Get a directory list
+       return generateOptions(
+               '/ARRAY/',
+               $keys,
+               $values,
+               getSession('database_extension')
+       );
+}
+
 // Generate an option list for output mode types for given default value
 function generateInstallerOutputModeOptions ($defaultValue) {
        return generateOptions(