<?php
/**
 * Rename 'text' to 'php' in custom action effect data
 */
function imagecache_customactions_update_7100(&$sandbox) {
  $effects = db_select('image_effects')
    ->fields('image_effects')
    ->condition('name', 'imagecache_customactions', '=')
    ->execute()
    ->fetchAll();
  foreach ($effects as $effect) {
    $data = unserialize($effect->data);
    if (array_key_exists('text', $data)) {
      $data['php'] = $data['text'];
      unset($data['text']);
      $data = serialize($data);
      db_update('image_effects')
        ->condition('ieid', $effect->ieid)
        ->fields(array('data' => $data))
        ->execute();
    }
  }
}
