View Issue Details

IDProjectCategoryView StatusLast Update
0000426WackoWikicode cleanuppublic2014-03-18 11:17
ReportervarahaAssigned Toadministrator 
PrioritynormalSeveritytweakReproducibilityhave not tried
Status resolvedResolutionfixed 
Product Version5.1.0 
Target Version5.4.0Fixed in Version5.4.0 
Summary0000426: small patch of write/read database tables structure
Descriptionincluded small patch of write/read database tables structure - fix of ugly programming
TagsNo tags attached.

Relationships

related to 0000425 resolvedadministrator admin panel database restore problem with PDO 

Activities

administrator

2012-09-08 06:00

administrator  

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
database.php.patch (2,423 bytes)

administrator

2012-09-08 06:54

administrator   ~0000861

Commit: http://wackowiki.hg.sourceforge.net/hgweb/wackowiki/dev/rev/eb604061c4e7

Issue History

Date Modified Username Field Change
2012-09-08 05:50 administrator New Issue
2012-09-08 05:50 administrator Status new => assigned
2012-09-08 05:50 administrator Assigned To => administrator
2012-09-08 05:50 administrator File Added: database.php.patch
2012-09-08 05:50 administrator Reporter administrator => varaha
2012-09-08 06:00 administrator File Deleted: database.php.patch
2012-09-08 06:00 administrator File Added: database.php.patch
2012-09-08 06:52 administrator Summary fix of ugly programming => small patch of write/read database tables structure
2012-09-08 06:54 administrator Note Added: 0000861
2012-09-08 06:55 administrator Relationship added related to 0000425
2014-03-18 11:17 administrator Status assigned => resolved
2014-03-18 11:17 administrator Resolution open => fixed
2014-03-18 11:17 administrator Fixed in Version => 5.4.0
2014-03-18 11:17 administrator Target Version 5.1.x => 5.4.0