Advertisement:
Anonymous Login
12-07-2016 09:20 AM

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0004190SMF 2.0Generalpublic2010-05-09 06:13
ReporterArantor_old 
PrioritylowSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Summary0004190: <database> not logging edits correctly if there are two <database> blocks
DescriptionWith SimpleDesk development, I created two files, install.php and install-testdata.php, to be run on install, both specified in <database> blocks. install.php uses all the correct DB functions and ordinarily it would be logged correctly.

If, however, there is a second <database> block, that doesn't trigger any DB log actions (i.e. no created tables, no created columns etc), nothing gets logged by the packman.

It's not a huge issue for SD, really, because it's test data and I only separated it out for now for practicality and we won't be doing it quite like that in the live build.

However, it's a bug that it doesn't build the complete list of changes between <database> blocks and store the final list.
TagsPackage Manager, With Fix
Attached Files
  • patch file icon bug_4190.patch (1,980 bytes) 2010-05-06 05:32 -
    --- Sources/DbPackages-mysql.php	Fri Jan 16 06:26:28 1970
    +++ Sources/DbPackages-mysql.php	Fri Jan 16 06:26:28 1970
    @@ -58,11 +58,11 @@
     // Add the file functions to the $smcFunc array.
     function db_packages_init()
     {
     	global $smcFunc, $reservedTables, $db_package_log, $db_prefix;
     
    -	if (!isset($smcFunc['db_create_table']) || $smcFunc['db_create_table'] != 'db_create_table')
    +	if (!isset($smcFunc['db_create_table']) || $smcFunc['db_create_table'] != 'smf_db_create_table')
     	{
     		$smcFunc += array(
     			'db_add_column' => 'smf_db_add_column',
     			'db_add_index' => 'smf_db_add_index',
     			'db_calculate_type' => 'smf_db_calculate_type',
    --- Sources/DbPackages-postgresql.php	Fri Jan 16 06:26:28 1970
    +++ Sources/DbPackages-postgresql.php	Fri Jan 16 06:26:28 1970
    @@ -58,11 +58,11 @@
     // Add the file functions to the $smcFunc array.
     function db_packages_init()
     {
     	global $smcFunc, $reservedTables, $db_package_log, $db_prefix;
     
    -	if (!isset($smcFunc['db_create_table']) || $smcFunc['db_create_table'] != 'db_create_table')
    +	if (!isset($smcFunc['db_create_table']) || $smcFunc['db_create_table'] != 'smf_db_create_table')
     	{
     		$smcFunc += array(
     			'db_add_column' => 'smf_db_add_column',
     			'db_add_index' => 'smf_db_add_index',
     			'db_calculate_type' => 'smf_db_calculate_type',
    --- Sources/DbPackages-sqlite.php	Fri Jan 16 06:26:28 1970
    +++ Sources/DbPackages-sqlite.php	Fri Jan 16 06:26:28 1970
    @@ -58,11 +58,11 @@
     // Add the file functions to the $smcFunc array.
     function db_packages_init()
     {
     	global $smcFunc, $reservedTables, $db_package_log, $db_prefix;
     
    -	if (!isset($smcFunc['db_create_table']) || $smcFunc['db_create_table'] != 'db_create_table')
    +	if (!isset($smcFunc['db_create_table']) || $smcFunc['db_create_table'] != 'smf_db_create_table')
     	{
     		$smcFunc += array(
     			'db_add_column' => 'smf_db_add_column',
     			'db_add_index' => 'smf_db_add_index',
     			'db_alter_table' => 'smf_db_alter_table',
    
    patch file icon bug_4190.patch (1,980 bytes) 2010-05-06 05:32 +

-Relationships
+Relationships

-Notes

bugnote:0011867

[SiNaN] (Viewer)

This is because of this code, that is used to prevent the package database functions not to be loaded twice:

if (!isset($smcFunc['db_create_table']) || $smcFunc['db_create_table'] != 'db_create_table')

$smcFunc['db_create_table'] will not be 'db_create_table', but will be 'smf_db_create_table' (lacking the prefix "smf_"). So it loads the functions twice and refreshes the $db_package_log variable.

Attached a patch that:

+ fixes the issue for all database systems.

bugnote:0011899

[SiNaN] (Viewer)

! Package database functions were loaded more than once if initialized multiple times (DbPackages-mysql.php, DbPackages-postgresql.php, DbPackages-sqlite.php) Revision 9860
+Notes
MantisBT (Modified for SMF Intergration)[^] Copyright © 2000 - 2010 Mantis Group