I have simple question concerning enabling a custom module after having disinstalled it.
The module provides a simple creation of a new content type based on node content.
It implements a hook_install()
function that first time i enabled the module worked perfectly. For debugging reasons i had to disable and unistall the module, then when i tried to enable again the module the system checks it as enabled but the new content type that is the result of the hook_install()
function does not appear anymore.
It seems to me that when i try to re-activate the module the installation script doesn't work anymore, and this although i cleared the cache after unistallind the module the first time.
Any ideas?
Here's the install code:
function bachecanews_install() { $t = get_t(); $node_bachecanews = array( 'type' => 'node_bachecanews', 'name' => $t('Bacheca News'), 'base' => 'node_content', 'description' => $t('Usa Bacheca News per inserire le notizio sul sito.'), 'body_label' => $t('Contenuto della News') ); $content_type = node_type_set_defaults($node_bachecanews); node_add_body_field($content_type); node_add_date_field($content_type); $status = node_type_save($content_type); $t_args = array('%name' => $content_type->name); if ($status == SAVED_UPDATED) { // in caso di modifica drupal_set_message($t('Il nuovo tipo di contenuto %name è stato modificato.', $t_args)); } elseif ($status == SAVED_NEW) { // in caso di creazione drupal_set_message($t('Il nuovo tipo di contenuto %name è stato creato.', $t_args)); watchdog('node', 'Creato il nuovo tipo di contenuto %name.', $t_args, WATCHDOG_NOTICE, l($t('view'), 'admin/structure/types')); } } function bachecanews_uninstall() { $sql = 'SELECT nid FROM {node} n WHERE n.type = :type'; $result = db_query($sql, array(':type' => 'node_bachecanews')); $nids = array(); foreach ($result as $row) { $nids[] = $row->nid; } node_delete_multiple($nids); node_type_delete('node_bachecanews'); }