You are here

function coder_upgrade_convert_schema in Coder 7

Same name in this branch
  1. 7 coder_upgrade/conversions/other.inc \coder_upgrade_convert_schema()
  2. 7 coder_upgrade/conversions/function.inc \coder_upgrade_convert_schema()
Same name and namespace in other branches
  1. 7.2 coder_upgrade/conversions/other.inc \coder_upgrade_convert_schema()
  2. 7.2 coder_upgrade/conversions/function.inc \coder_upgrade_convert_schema()

Updates hook_schema().

Parameters

PGPNode $node: A node object containing a PGPClass (or function) item.

2 calls to coder_upgrade_convert_schema()
coder_upgrade_callback_functions in coder_upgrade/conversions/other.inc
Callback routine for function changes using grammar parser.
coder_upgrade_upgrade_hook_schema_alter in coder_upgrade/conversions/function.inc
Implements hook_upgrade_hook_schema_alter().

File

coder_upgrade/conversions/other.inc, line 1269
Other conversion routine file for the coder_upgrade module.

Code

function coder_upgrade_convert_schema(&$node) {
  cdp("inside " . __FUNCTION__);
  $item =& $node->data;
  $body =& $item->body;
  if (!($return = $body
    ->find(T_RETURN, 'reverse'))) {
    clp("ERROR: return statement not found in hook_schema");
    return;
  }

  //  cdp("Printing return item");
  cdp($item
    ->print_r(0, $return));

  //  cdp("Printing return item DONE");
  $variable = $return->value
    ->first();

  /*
   * Traverse the body statements looking for:
   * - assignment to the return variable
   * - in the assignment
   *   - a PGPArray operand
   *   - in the operand
   *     - key of 'description'
   *     - value whose first operand is PGPArray (recurse into this)
   *       - if the value calls t() then remove t()
   */
  $body
    ->searchCallback($body, 'coder_upgrade_convert_schema_callback', 'PGPFunctionCall', 'name', 'value', 't');
}