database.php.patch (2,423 bytes)
diff --git a/wacko/admin/common/database.php b/wacko/admin/common/database.php
--- a/wacko/admin/common/database.php 2012-06-17 15:28:26.000000000 +0000
+++ b/wacko/admin/common/database.php 2012-08-22 15:54:38.690039334 +0000
@@ -273,14 +273,13 @@
***************************************************************************/
$schema_create = "";
$field_query = "SHOW FIELDS FROM $table";
$key_query = "SHOW KEYS FROM $table";
- $collation_db = $engine->load_single("SELECT @@collation_database");
-
- if ($drop == true) $schema_create .= "DROP TABLE IF EXISTS $table;\n";
+ //$collation_db = $engine->load_single("SELECT @@collation_database");
+ if ($drop == true) $schema_create .= "DROP TABLE IF EXISTS `$table`;\n";
$schema_create .= "CREATE TABLE IF NOT EXISTS `$table` (\n";
//
// Ok lets grab the fields...
//
@@ -338,11 +337,13 @@
$schema_create .= ' FULLTEXT KEY `' . substr($x,9) . '` (' . implode($columns, ', ') . ')';
else
$schema_create .= " KEY `$x` (" . implode($columns, ', ') . ')';
}
- $schema_create .= "\n) ENGINE=MyISAM DEFAULT CHARSET={$collation_db['@@collation_database']};"; // TODO: CHARSET per table
+ $schema_create .= "\n) ENGINE=InnoDB DEFAULT CHARSET=cp1251;"; // Old: ENGINE=MyISAM
+ // "{$collation_db['@@collation_database']};";
+ // TODO: CHARSET per table
if (get_magic_quotes_runtime())
return (stripslashes($schema_create));
else
return ($schema_create);
@@ -523,10 +524,11 @@
function PutTable(&$engine, $pack)
{
// read sql data
$dir = $engine->config['upload_path_backup'].'/'.$pack.'/';
$sql = explode(';', file_get_contents($dir.BACKUP_FILE_STRUCTURE));
+ array_pop($sql);
// perform
$t = 0;
diff --git a/wacko/admin/modules/dbbackup.php b/wacko/admin/modules/dbbackup.php
--- a/wacko/admin/modules/dbbackup.php 2012-08-22 16:27:47.575039345 +0000
+++ b/wacko/admin/modules/dbbackup.php 2012-08-22 16:35:21.072038460 +0000
@@ -126,11 +126,12 @@
// open file with writa access
$file = fopen($filename, 'w');
// write data (strip last semicolon
// off the sql) and close file
- fwrite($file, substr($sql, 0, strrpos($sql, ';')));
+ // fwrite($file, substr($sql, 0, strrpos($sql, ';')));
+ fwrite($file, $sql); // see array_pop($sql); on database.php:529
fclose($file);
chmod($filename, 0644);
}
// save backup log