Installation NG continued (still not fully working)
[mailer.git] / inc / sql-functions.php
index c1840fa1bcb278ccfeabe081afc20c7b6600bdbe..4f57bf88ca1a5a919899947f4d3fcbaf78c1f11e 100644 (file)
@@ -260,5 +260,23 @@ function initSqlLink () {
        }
 }
 
+// Imports given SQL dump from given (relative) path
+function importSqlDump ($path, $dumpName) {
+       // Construct FQFN
+       $FQFN = getPath() . $path . '/' . $dumpName . '.sql';
+
+       // Is the file readable?
+       if (!isFileReadable($FQFN)) {
+               // Not found, which is bad
+               reportBug(__FILE__, __LINE__, sprintf("SQL dump %s/%s.sql is not readable.", $path, $dumpName));
+       } // END - if
+
+       // Then read it
+       $fileContent = readSqlDump($FQFN);
+
+       // Merge it with existing SQL statements
+       mergeSqls(explode(";\n", $fileContent), 'install');
+}
+
 // [EOF]
 ?>