You are here

function avatar_selection_update_6002 in Avatar Selection 7

Same name and namespace in other branches
  1. 6 avatar_selection.install \avatar_selection_update_6002()

Updates the avatar entry so it's just a filename, rather than a path + filename.

File

./avatar_selection.install, line 182
The Avatar Selection module install file.

Code

function avatar_selection_update_6002() {
  $result = db_query("SELECT avatar FROM {avatar_selection}");
  while ($avatar_info = db_fetch_object($result)) {
    $avatar = $avatar_info->avatar;
    $path_info = pathinfo($avatar);
    db_update('avatar_selection')
      ->fields(array(
      'avatar' => $path_info['basename'],
    ))
      ->condition('avatar', $avatar)
      ->execute();
  }
  return t("Updated avatar entry so it's just a filename with no path.");
}