function coder_upgrade_convert_install in Coder 7.2
Same name in this branch
- 7.2 coder_upgrade/conversions/other.inc \coder_upgrade_convert_install()
- 7.2 coder_upgrade/conversions/function.inc \coder_upgrade_convert_install()
Same name and namespace in other branches
- 7 coder_upgrade/conversions/other.inc \coder_upgrade_convert_install()
- 7 coder_upgrade/conversions/function.inc \coder_upgrade_convert_install()
Updates hook_install() or hook_uninstall().
Database schema (un)installed automatically.
Parameters
PGPNode $node: A node object containing a PGPClass (or function) item.
3 calls to coder_upgrade_convert_install()
- coder_upgrade_callback_functions in coder_upgrade/
conversions/ other.inc - Callback routine for function changes using grammar parser.
- coder_upgrade_upgrade_hook_install_alter in coder_upgrade/
conversions/ function.inc - Implements hook_upgrade_hook_install_alter().
- coder_upgrade_upgrade_hook_uninstall_alter in coder_upgrade/
conversions/ function.inc - Implements hook_upgrade_hook_uninstall_alter().
File
- coder_upgrade/
conversions/ other.inc, line 1133 - Other conversion routine file for the coder_upgrade module.
Code
function coder_upgrade_convert_install($node) {
cdp("inside " . __FUNCTION__);
$item =& $node->data;
// Get body statements.
$body =& $item->body;
/*
* In 6.x, drupal_install_schema has a return value, but not in 7.x.
* The code below asssumes the return value is not utilized. Otherwise,
* set the variable to empty string.
*/
$current = $body
->first();
while ($current->next != NULL) {
$statement =& $current->data;
cdp($statement
->print_r());
if (is_a($statement, 'PGPAssignment')) {
$text = $statement->values
->toString();
cdp($text);
if (preg_match('(drupal_install_schema|drupal_uninstall_schema)', $text)) {
$editor = new PGPEditor();
// Insert comment.
$statements = $editor
->textToStatements('// TODO The drupal_(un)install_schema functions are called automatically in D7.');
$body
->insertBefore($current, $statements
->getElement(), 'comment');
// Comment out the statement.
$statements = $editor
->textToStatements('// ' . $text);
$statement = $statements
->getElement();
break;
}
}
$current =& $current->next;
}
}