]> git.mxchange.org Git - mailer.git/blobdiff - inc/ajax/ajax_installer.php
Added update_year.sh (still not fully flexible) and updated all years with it.
[mailer.git] / inc / ajax / ajax_installer.php
index 5e6bf0d664c04a4c94d9d2b48caef3a3920ed4b6..c9b76c415fd20f722cc386c2db5ece1edc1be497 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : AJAX-bezogene Funktionen fuer Installer          *
  * -------------------------------------------------------------------- *
- * $Revision::                                                        $ *
- * $Date::                                                            $ *
- * $Tag:: 0.2.1-FINAL                                                 $ *
- * $Author::                                                          $ *
- * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2013 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2015 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -50,7 +45,7 @@ if (!defined('__SECURITY')) {
 // Establish a database link
 function establishAjaxInstallerDatabaseLink () {
        // This requires some session data
-       if (!isSessionDataSet(array('mysql_host', 'mysql_dbase', 'mysql_prefix', 'mysql_login', 'mysql_password1', 'mysql_password2', 'mysql_engine'))) {
+       if (!isSessionDataSet(array('mysql_host', 'mysql_dbase', 'mysql_prefix', 'mysql_login', 'mysql_password1', 'mysql_password2', 'mysql_engine', 'database_extension'))) {
                // Some required session data is not set
                reportBug(__FUNCTION__, __LINE__, 'Required session data for this step not found.');
        } // END - if
@@ -84,6 +79,7 @@ function establishAjaxInstallerDatabaseLink () {
 
        // Set type, prefix from POST data and database name for later queries
        setConfigEntry('_TABLE_TYPE'  , getSession('mysql_engine'));
+       setConfigEntry('_DB_TYPE'     , getSession('database_extension'));
        setConfigEntry('_MYSQL_PREFIX', getSession('mysql_prefix'));
        setConfigEntry('__DB_NAME'    , getSession('mysql_dbase'));
 }
@@ -324,7 +320,7 @@ function doAjaxInstallerSaveChanges () {
                        (isInstallerDataValid($saveStatus, $key, $value))
                &&
                        // And can it be stored in session?
-                       (setSession($key, $value))
+                       (setSessionCompiled($key, $value))
                );
 
                // Save the overall status for below final check
@@ -363,31 +359,31 @@ function doAjaxPrepareInstallerBaseData () {
        // Is 'base_path' not set?
        if (!isSessionVariableSet('base_path')) {
                // Then set it from PATH
-               setSession('base_path', getPath());
+               setSessionCompiled('base_path', getPath());
        } // END - if
 
        // Is 'base_url' not set?
        if (!isSessionVariableSet('base_url')) {
                // Then set it from URL
-               setSession('base_url', getUrl());
+               setSessionCompiled('base_url', getUrl());
        } // END - if
 
        // Is 'main_title' not set?
        if (!isSessionVariableSet('main_title')) {
                // Then set it from default main title
-               setSession('main_title', compileRawCode(getMessage('DEFAULT_MAIN_TITLE')));
+               setSessionCompiled('main_title', compileRawCode(getMessage('DEFAULT_MAIN_TITLE')));
        } // END - if
 
        // Is 'slogan' not set?
        if (!isSessionVariableSet('slogan')) {
                // Then set it from default slogan
-               setSession('slogan', compileRawCode(getMessage('DEFAULT_SLOGAN')));
+               setSessionCompiled('slogan', compileRawCode(getMessage('DEFAULT_SLOGAN')));
        } // END - if
 
        // Is 'webmaster' not set?
        if (!isSessionVariableSet('webmaster')) {
                // Then set it from default webmaster email address
-               setSession('webmaster', '{--DEFAULT_WEBMASTER--}');
+               setSessionCompiled('webmaster', '{--DEFAULT_WEBMASTER--}');
        } // END - if
 }
 
@@ -396,43 +392,49 @@ function doAjaxPrepareInstallerDatabaseConfig () {
        // Is 'mysql_host' not set?
        if (!isSessionVariableSet('mysql_host')) {
                // Then set it directly
-               setSession('mysql_host', 'localhost');
+               setSessionCompiled('mysql_host', 'localhost');
        } // END - if
 
        // Is 'mysql_dbase' not set?
        if (!isSessionVariableSet('mysql_dbase')) {
                // Then set it directly
-               setSession('mysql_dbase', 'your_database');
+               setSessionCompiled('mysql_dbase', 'your_database');
        } // END - if
 
        // Is 'mysql_prefix' not set?
        if (!isSessionVariableSet('mysql_prefix')) {
                // Then set it directly
-               setSession('mysql_prefix', 'mailer');
+               setSessionCompiled('mysql_prefix', 'mailer');
        } // END - if
 
        // Is 'mysql_login' not set?
        if (!isSessionVariableSet('mysql_login')) {
                // Then set it directly
-               setSession('mysql_login', 'your_login');
+               setSessionCompiled('mysql_login', 'your_login');
        } // END - if
 
        // Is 'mysql_dbase' not set?
        if (!isSessionVariableSet('mysql_password1')) {
                // Then set it directly
-               setSession('mysql_password1', '');
+               setSessionCompiled('mysql_password1', '');
        } // END - if
 
        // Is 'mysql_password2' not set?
        if (!isSessionVariableSet('mysql_password2')) {
                // Then set it directly
-               setSession('mysql_password2', '');
+               setSessionCompiled('mysql_password2', '');
        } // END - if
 
        // Is 'mysql_engine' not set?
        if (!isSessionVariableSet('mysql_engine')) {
                // Then set it directly
-               setSession('mysql_engine', 'MyISAM');
+               setSessionCompiled('mysql_engine', 'MyISAM');
+       } // END - if
+
+       // Is 'mysql_engine' not set?
+       if (!isSessionVariableSet('database_extension')) {
+               // Then set it directly
+               setSessionCompiled('database_extension', 'mysqli');
        } // END - if
 }
 
@@ -446,25 +448,25 @@ function doAjaxPrepareInstallerOtherConfig () {
        // Is 'output_mode' not set?
        if (!isSessionVariableSet('output_mode')) {
                // Then set it directly
-               setSession('output_mode', 'render');
+               setSessionCompiled('output_mode', 'render');
        } // END - if
 
        // Is 'warn_no_pass' not set?
        if (!isSessionVariableSet('warn_no_pass')) {
                // Then set it directly
-               setSession('warn_no_pass', 'Y');
+               setSessionCompiled('warn_no_pass', 'Y');
        } // END - if
 
        // Is 'write_footer' not set?
        if (!isSessionVariableSet('write_footer')) {
                // Then set it directly
-               setSession('write_footer', 'Y');
+               setSessionCompiled('write_footer', 'Y');
        } // END - if
 
        // Is 'enable_backlink' not set?
        if (!isSessionVariableSet('enable_backlink')) {
                // Then set it directly
-               setSession('enable_backlink', 'Y');
+               setSessionCompiled('enable_backlink', 'Y');
        } // END - if
 }
 
@@ -476,10 +478,10 @@ function doAjaxPrepareInstallerExtensions () {
                 * At least ext-admins, ext-sql_patches and ext-task should be installed
                 * (ext-sql_patches is a must!)
                 */
-               setSession('extensions', 'admins:sql_patches:task');
+               setSessionCompiled('extensions', 'admins:sql_patches:task');
        } elseif (strpos(getSession('extensions'), 'sql_patches') === FALSE) {
                // Add missing ext-sql_patches
-               setSession('extensions', getSession('extensions') . ':sql_patches');
+               setSessionCompiled('extensions', getSession('extensions') . ':sql_patches');
        }
 }
 
@@ -488,25 +490,25 @@ function doAjaxPrepareInstallerFirstAdmin () {
        // Is 'admin_login' set?
        if (!isSessionVariableSet('admin_login')) {
                // Set it
-               setSession('admin_login', 'admin');
+               setSessionCompiled('admin_login', 'admin');
        } // END - if
 
        // Is 'admin_email' set?
        if (!isSessionVariableSet('admin_email')) {
                // Set it
-               setSession('admin_email', getSession('webmaster'));
+               setSessionCompiled('admin_email', getSession('webmaster'));
        } // END - if
 
        // Is 'admin_password1' set?
        if (!isSessionVariableSet('admin_password1')) {
                // Set it
-               setSession('admin_password1', '');
+               setSessionCompiled('admin_password1', '');
        } // END - if
 
        // Is 'admin_password2' set?
        if (!isSessionVariableSet('admin_password2')) {
                // Set it
-               setSession('admin_password2', '');
+               setSessionCompiled('admin_password2', '');
        } // END - if
 }
 
@@ -666,9 +668,17 @@ function doAjaxInstallerStepInstallExtensions () {
 
        // "Walk" through all extensions
        foreach ($extensions as $key => $ext_name) {
+               // Debug message
+               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',ext_name=' . $ext_name);
+
                // Is ext-sql_patches not at key=0?
-               if (($key == 0) && ($ext_name == 'sql_patches')) {
+               if (($ext_name == 'sql_patches') && ($key > 0)) {
                        // Then skip this entry
+                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Skipping sql_changes at key=' . $key);
+                       continue;
+               } elseif (isExtensionInstalled($ext_name)) {
+                       // Skip already installed extensions
+                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Skipping extension ' . $ext_name . ' at key=' . $key . ': Already installed.');
                        continue;
                } elseif ((!loadExtension($ext_name, 'test', '0.0.0', TRUE)) || (!registerExtension($ext_name, NULL))) {
                        // Didn't work
@@ -683,7 +693,7 @@ function doAjaxInstallerStepInstallExtensions () {
 // Call-back function to write local configuration file
 function doAjaxInstallerStepWriteLocalConfig () {
        // Is all set?
-       if (!isSessionDataSet(array('base_path', 'base_url', 'main_title', 'slogan', 'webmaster', 'mysql_host', 'mysql_dbase', 'mysql_prefix', 'mysql_login', 'mysql_password1', 'mysql_password2', 'mysql_engine', 'output_mode', 'warn_no_pass', 'write_footer', 'enable_backlink'))) {
+       if (!isSessionDataSet(array('base_path', 'base_url', 'main_title', 'slogan', 'webmaster', 'mysql_host', 'mysql_dbase', 'mysql_prefix', 'mysql_login', 'mysql_password1', 'mysql_password2', 'mysql_engine', 'database_extension', 'output_mode', 'warn_no_pass', 'write_footer', 'enable_backlink'))) {
                // Some required session data is not set
                reportBug(__FUNCTION__, __LINE__, 'Required session data for this step not found.');
        } elseif (isInstalled()) {
@@ -713,6 +723,7 @@ function doAjaxInstallerStepWriteLocalConfig () {
                getSession('mysql_password1'),
                getSession('mysql_prefix'),
                getSession('mysql_engine'),
+               getSession('database_extension'),
                getSession('smtp_host'),
                getSession('smtp_user'),
                getSession('smtp_password1')