rewritten to new functions, some parts rewritten to filters
[mailer.git] / inc / install-inc.php
index fd5572b0331c83bc458a3fb2c796b0a9652b6034..c852bdd5d71685ef6ae1403980d940f999cdae23 100644 (file)
@@ -269,7 +269,7 @@ if ((!isInstalled()) || (!isAdminRegistered()))
        case "finalize": // Write captured data to files
                if ((REQUEST_ISSET_POST(('finalize'))) && (!isInstalled())) {
                        // You have submitted data then we have to reset the fatal messages
-                       $SQLs = array();
+                       INIT_SQLS();
 
                        // Connect to MySQL server
                        SQL_CONNECT($mysql['host'], $mysql['login'], $mysql['pass1'], __FILE__, __LINE__);
@@ -287,7 +287,7 @@ if ((!isInstalled()) || (!isAdminRegistered()))
                                                                $fileContent = READ_FILE($FQFN, true);
 
                                                                // And split it up against ;\n ...
-                                                               $SQLs = merge_array($SQLs, explode(";\n", $fileContent));
+                                                               SET_SQLS(merge_array(GET_SQLS(), explode(";\n", $fileContent)));
                                                        } else {
                                                                // Not readable!
                                                                debug_report_bug(sprintf("SQL dump %s is not readable!", $dump));
@@ -295,23 +295,14 @@ if ((!isInstalled()) || (!isAdminRegistered()))
                                                } // END - foreach
 
                                                // Are some SQLs found?
-                                               if (count($SQLs) == 0) {
+                                               if (COUNT_SQLS() == 0) {
                                                        // Abort here
                                                        addFatalMessage(__FILE__, __LINE__, getMessage('INSTALL_SQL_IMPORT_FAILED'));
                                                        return;
                                                } // END - if
 
                                                // Now run all queries through and try to keep out empty or comment queries
-                                               foreach ($SQLs as $sql) {
-                                                       // Trim spaces away
-                                                       $sql = trim($sql);
-
-                                                       // Is this query not empty and not a comment?
-                                                       if ((!empty($sql)) && (substr($sql, 0, 2) != "--") && (substr($sql, 0, 1) != "#")) {
-                                                               // Then run it!
-                                                               SQL_QUERY($sql, __FILE__, __LINE__);
-                                                       } // END - if
-                                               } // END - foreach
+                                               RUN_FILTER('run_sqls', array('dry_run' => false));
 
                                                // Ok, all done. So we can write the config data to the php files
                                                if (REQUEST_POST('spath') != constant('PATH')) changeDataInFile(REQUEST_POST('spath')."inc/config.php", "SERVER-PATH", "define('PATH', \"", "\");", REQUEST_POST('spath'), 0);