|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0004190||SMF 2.0||General||public||2010-02-01 06:11||2010-05-09 06:13|
|Summary||0004190: <database> not logging edits correctly if there are two <database> blocks|
|Description||With 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.
|Tags||Package Manager, With Fix|
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.
|! Package database functions were loaded more than once if initialized multiple times (DbPackages-mysql.php, DbPackages-postgresql.php, DbPackages-sqlite.php) Revision 9860|