DB lookup was failing to retrieve correct theme info
| Project: | Color.module: Next generation |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
The first time I tried this, it just didn't work (no color options at all on /admin/build/themes/settings/friendselectric & others) so I thought it was unstable.
So I went back to colorizing with core color.module for an hour or two before deciding that I really did need more gradients and more color names.
So I tried again. And it DID work.
And was going well.
Then suddenly (after a themes cache rebuild or something) it inexplicably disappeared again... even on the distro themes.
:-/
Debugging led me to:
<?php
function color_compatible($theme_name) {
static $static;
$theme_info = unserialize(db_result(db_query("SELECT info FROM {system} WHERE type = '%s'", 'theme')));
if ($theme_info['color'] == TRUE) {
$static[$theme_name] = TRUE;
}
else {
$static[$theme_name] = FALSE;
}
return $static[$theme_name];
}
?>That query does NOT retrieve the requested theme info, just any random theme info! Not all of which are color-enabled :-}
Here's a fix. Including a PHP-STRICT-NOTICE avoidance also.
<?php
function color_compatible($theme_name) {
static $static;
$theme_info = unserialize(db_result(db_query("SELECT info FROM {system} WHERE type = '%s' AND name = '%s' ", 'theme', $theme_name)));
if (!empty($theme_info['color'])) {
$static[$theme_name] = TRUE;
}
else {
$static[$theme_name] = FALSE;
}
return $static[$theme_name];
}
?>Other than that, so far so good... I'm getting results on a zen-based subtheme.
| Attachment | Size |
|---|---|
| color.misc-20081010.patch | 835 bytes |

#1
Committed
#2
Automatically closed -- issue fixed for two weeks with no activity.