You are here

function uc_catalog_enable in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_catalog/uc_catalog.module \uc_catalog_enable()
  2. 7.3 uc_catalog/uc_catalog.install \uc_catalog_enable()

Implementation of hook_enable().

Add imagecache preset "uc_category".

File

uc_catalog/uc_catalog.module, line 142
Übercart Catalog module.

Code

function uc_catalog_enable() {
  if (module_exists('imagecache')) {
    $result = db_query("SELECT presetid FROM {imagecache_preset} WHERE presetname = 'uc_category'");
    if (!db_fetch_object($result)) {
      $id = db_next_id('{imagecache_preset}_presetid');
      db_query("INSERT INTO {imagecache_preset} (presetid, presetname) VALUES (%d, 'uc_category')", $id);
      db_query("INSERT INTO {imagecache_action} (actionid, presetid, weight, data) VALUES (%d, %d, 0, '%s')", db_next_id('{imagecache_action}_actionid'), $id, 'a:4:{s:8:"function";s:5:"scale";s:3:"fit";s:6:"inside";s:5:"width";s:2:"96";s:6:"height";s:2:"96";}');
      cache_clear_all('imagecache:presets', 'cache');
    }
  }
}