You are here

function coder_upgrade_upgrade_call_alter in Coder 7.2

Same name and namespace in other branches
  1. 7 coder_upgrade/conversions/call.inc \coder_upgrade_upgrade_call_alter()

Implements hook_upgrade_call_alter().

File

coder_upgrade/conversions/call.inc, line 148
Provides conversion routines applied to function calls.

Code

function coder_upgrade_upgrade_call_alter(&$node, &$reader, $name) {

  // NEEDS WORK
  // Create helper objects.
  $editor = PGPEditor::getInstance();

  // Get the function call object.
  $item =& $node->data;

  // Process function call.
  //  $name = &$item->name;
  switch ($name) {

    // http://drupal.org/node/224333#custom_block
    // All 'box' functions renamed to 'custom_block'.
    case 'block_box_delete':
    case 'block_box_delete_submit':
    case 'block_box_form':
    case 'block_box_get':
    case 'block_box_save':
      $item->name['value'] = str_replace('box', 'custom_block', $item->name['value']);
      break;
    case 'db_add_field':

    // includes/database.pgsql.inc Add a new field to a table.
    case 'db_add_index':

    // includes/database.pgsql.inc Add an index.
    case 'db_add_primary_key':

    // includes/database.pgsql.inc Add a primary key.
    case 'db_add_unique_key':

    // includes/database.pgsql.inc Add a unique key.
    case 'db_change_field':

    // includes/database.pgsql.inc Change a field definition.
    case 'db_create_table':

    // includes/database.inc Create a new table from a Drupal table definition.
    case 'db_create_table_sql':

    // includes/database.pgsql.inc Generate SQL to create a new table from a Drupal schema definition.
    case 'db_drop_field':

    // includes/database.pgsql.inc Drop a field.
    case 'db_drop_index':

    // includes/database.pgsql.inc Drop an index.
    case 'db_drop_primary_key':

    // includes/database.pgsql.inc Drop the primary key.
    case 'db_drop_table':

    // includes/database.pgsql.inc Drop a table.
    case 'db_drop_unique_key':

    // includes/database.pgsql.inc Drop a unique key.
    case 'db_field_names':

    // includes/database.inc Return an array of field names from an array of key/index column specifiers.
    case 'db_field_set_default':

    // includes/database.pgsql.inc Set the default value for a field.
    case 'db_field_set_no_default':

    // includes/database.pgsql.inc Set a field to have no default value.
    case 'db_rename_table':

      // includes/database.pgsql.inc Rename a table.
      $item
        ->deleteParameter();

      /*
       * TODO
       * See http://drupal.org/node/224333#update_sql
       * Search for assignments to and return statements with the $ret parameter
       * used in these db_operation function calls.
       *
       * These could be moved to the install file although it may be possible to
       * call them in other files.
       */
      break;

    // http://drupal.org/node/224333#admin_path_changes
    // logout path changed to user/logout.
    case 'drupal_goto':
    case 'url':
    case 'drupal_get_path_alias':
    case 'drupal_get_normal_path':
      if (trim($item
        ->printParameter(), "'\"") == 'logout') {
        $editor
          ->setParameter($item, 0, "'user/logout'");
      }
      break;
    case 'drupal_lookup_path':
    case 'l':
      if (trim($item
        ->printParameter(1), "'\"") == 'logout') {
        $editor
          ->setParameter($item, 1, "'user/logout'");
      }
      break;
    case 'drupal_urlencode':

      // http://drupal.org/node/224333#remove-drupal-urlencode
      $item->name['value'] = 'drupal_encode_path';
      break;
    case 'require':
    case 'require_once':
    case 'include':
    case 'include_once':

      // These are included by $reader in function call list.
      // Use with http://drupal.org/node/224333#absolute_includes
      coder_upgrade_convert_require($item, $reader);
      break;

    // http://drupal.org/node/224333#no-synonyms-taxonomy
    // Taxonomy synonyms have been removed.
    case 'taxonomy_get_synonyms':
    case 'taxonomy_get_synonym_root':
      coder_upgrade_convert_taxonomy_synonyms($item);
      break;
    default:
      break;
  }
}