You are here

function taxonomy_image_update_6101 in Taxonomy Image 6

Implementation of hook_update_N(). Make file path relative to TI image path.

File

./taxonomy_image.install, line 174
taxonomy_image.install. Simple module for providing an association between taxonomy terms and images. Written by Jeremy Andrews <jeremy@kerneltrap.org>, May 2004.

Code

function taxonomy_image_update_6101() {
  $ret = array();
  $mypath = file_directory_path() . '/' . variable_get('taxonomy_image_path', 'category_pictures') . '/';
  $path_len = drupal_strlen($mypath);
  $sub_len = $path_len + 1;
  $update = "UPDATE {term_image} SET path = SUBSTR(path, " . $sub_len . ")" . " WHERE SUBSTR(path, 1, " . $path_len . ") = '{$mypath}'";
  $ret[] = update_sql($update);

  // Delete the cached version.
  cache_clear_all("taxonomy_image:{$tid}", 'cache_tax_image');
  drupal_set_message(t('Taxonomy Image cache has been cleared.'));
  return $ret;
}