The cache table schema changed in Drupal 7, but the cache_browscap table was not updated to reflect this change. This does not result in any obvious errors, but if you use the schema module or do other database schema comparisons, the difference shows up.

The attached patch corrects the problem.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

AohRveTPV’s picture

Status: Active » Needs review
FileSize
507 bytes

Hello, I think this patch is a little simpler. Rather than get the new cache_browscap schema in a different way than browscap_schema(), we can re-use browscap_schema().

Also I capitalized Browscap in the function comment for consistency with another comment in the .install.

AohRveTPV’s picture

Version: 7.x-2.1 » 7.x-2.x-dev
greggles’s picture

Status: Needs review » Needs work

From Updating tables: hook_update_N() functions:

Important note: You may be tempted to pass a table definition from your own hook_schema function directly to db_create_table(). Please read why you cannot use hook_schema from within hook_update_N().

;)

AohRveTPV’s picture

Status: Needs work » Needs review
FileSize
1.01 KB

Makes sense. The original patch seems to be a fine way to do this, then. However, browscap_schema() is currently defining the cache table using drupal_get_schema_unprocessed(), which also causes the problem referenced in #3. This patch also changes browscap_schema() to define the cache table in the same way as the original patch, without duplicating code.

AohRveTPV’s picture

Changed function name _browscap_cache_7201() to _browscap_schema_cache_7201() for consistency with system_schema_cache_7052().

AohRveTPV’s picture

Status: Needs review » Needs work

On second thought, it would probably be clearer to just duplicate code between hook_schema() and hook_update_N(). Will prepare an alternative patch.

AohRveTPV’s picture

Status: Needs work » Needs review
FileSize
857 bytes

This is Kevin Rogers' patch with an additional change:
browscap_install() is changed to also use system_schema_cache_7054() for consistency and to avoid the problem mentioned in #3. Specifically, the problem is that browscap_install() currently uses drupal_get_schema_unprocessed('system', 'cache'). If the system cache schema changes, Browscap users will have different cache schemas depending on when they installed the module, which is probably a situation best avoided.

AohRveTPV’s picture

Removed accidental blank line versus #7.

AstonVictor’s picture

Status: Needs review » Closed (outdated)

I'm closing it because the issue was created a long time ago without any further steps.

if you still need it then raise a new one.
thanks