function coder_upgrade_convert_schema in Coder 7
Same name in this branch
- 7 coder_upgrade/conversions/other.inc \coder_upgrade_convert_schema()
- 7 coder_upgrade/conversions/function.inc \coder_upgrade_convert_schema()
Same name and namespace in other branches
- 7.2 coder_upgrade/conversions/other.inc \coder_upgrade_convert_schema()
- 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/ function.inc, line 1206 - Provides conversion routines applied to functions (or hooks).
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
->getParameter()
->getElement();
// TODO This fits with the coder_upgrade_convert_return pattern.
/*
* 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('coder_upgrade_convert_schema_callback', 'PGPFunctionCall', 'name', 'value', 't');
}