Projects ⇒ Bugs ⇒ #542: bad code in kills upgrade ⇒ CPG Dragonfly™ CMS
Bug #542 bad code in kills upgrade
Project: Dragonfly 9.0.3 -> 9.3 Category: *CPG Core Issues
Submitted: Tuesday, June 07, 2005 (08:34:50) Modified: Tuesday, June 28, 2005 (23:20:44)
Status: Closed Assigned to:
PHP Version: 4.3.10 HTTPD Server: Apache 2.0
Votes: 1
Vote results:
Avg. Score: 4.0 ± 0.0 Reproduced: 1 of 1 (100.0%)
Same PHP Version: 1 (100.0%) Same HTTPD Server: 0 (0.0%)

View/Vote Add Comment

by: alva
------------ (revision 9.19 and above) kills upgrades from PHPNuke!!! And probably some other upgradepaths as well.

The problem is that the code queries a databasetable $prefix'_config_custom' that the installer has not created yet in the real database.

The point of the new code in rev. 9.19 was:
Renamed the 'gfx_chk' to 'sec_code' and changed to be bitwise (gfx_chk still available but depreciated)

Obviously, this code introduces something else as well!

Reproduce code:
Here is the code from revision 9.23:

if (version_compare($version, '', '<')) {
global $db, $prefix;
list($gfx_chk) = $db->sql_ufetchrow('SELECT cfg_value FROM '.$prefix."_config_custom WHERE cfg_name='global' AND cfg_field='gfx_chk'", SQL_NUM);
$sec_code = 0;
if ($gfx_chk == 1 || $gfx_chk >= 5) $sec_code |= 1;
if ($gfx_chk >= 2 && $gfx_chk != 3 && $gfx_chk != 6) $sec_code |= 2;
if ($gfx_chk >= 3 && $gfx_chk != 5) $sec_code |= 4;
$db->sql_query('INSERT INTO '.$prefix."_config_custom (cfg_name, cfg_field, cfg_value) VALUES ('global', 'sec_code', $sec_code)");
$db->sql_query('DELETE FROM '.$prefix."_config_custom WHERE cfg_name='global' AND cfg_field='gfx_chk'");
if (version_compare($version, '', '<')) {
$db->sql_query('INSERT INTO '.$prefix."_config_custom (cfg_name, cfg_field, cfg_value) VALUES ('sec_code', 'back_img', 1)");
$db->sql_query('INSERT INTO '.$prefix."_config_custom (cfg_name, cfg_field, cfg_value) VALUES ('sec_code', 'font', 'bahamas.ttf')");
$db->sql_query('INSERT INTO '.$prefix."_config_custom (cfg_name, cfg_field, cfg_value) VALUES ('sec_code', 'font_size', 12)");

Expected result:
The point of the code was:

Renamed the 'gfx_chk' to 'sec_code' and changed to be bitwise (gfx_chk still available but depreciated)

Actual result:
install is terminated with errormessage:

On /install.php
While executing query "SELECT cfg_value FROM nuke_config_custom WHERE cfg_name='global' AND cfg_field='gfx_chk'"

the following error occured: Table '[databasename].[prefix]_config_custom' doesn't exist

In: /install/mysql/upgrade/ on line: 21
by: alva
Just found out that has rev. 9.18 so this bugreport belongs in the project 9.0.3 -> 9.1.

Hope it doesn't matter too much.
by: alva
Possible fix:

use $tablelist[] and $installer->add_query()

instead of working with the real database.
by: DJMaze
This bug has been fixed in the CVS.

Snapshots of the sources are packaged every 6 hours; this change
will be in the next snapshot. You can grab the snapshot at the
Downloads section.

Thank you for the report, and for helping us to make CPG-Nuke 9.0.3 -> 9.1 better.
User Info

Welcome Anonymous


Support for DragonflyCMS in a other languages: