notifications_content.install in Notifications 7
File
notifications_content/notifications_content.install
View source
<?php
function notifications_content_install() {
notifications_content_install_trigger_action('node_publish', 'notifications_content_node_post_action');
notifications_content_install_trigger_action('node_update', 'notifications_content_node_update_action');
notifications_content_install_trigger_action('comment_insert', 'notifications_content_comment_action');
notifications_content_install_trigger_action('comment_update', 'notifications_content_comment_action');
}
function notifications_content_install_trigger_action($trigger, $action) {
$check = db_select('trigger_assignments', 'ta')
->fields('ta', array(
'hook',
'aid',
))
->condition('hook', $trigger)
->condition('aid', $action)
->execute()
->fetchObject();
if (!$check) {
db_insert('trigger_assignments')
->fields(array(
'hook' => $trigger,
'aid' => $action,
))
->execute();
}
}
function notifications_content_uninstall() {
variable_del('notifications_content_types');
variable_del('notifications_content_per_type');
foreach (array_keys(node_type_get_types()) as $type) {
variable_del('notifications_content_type_' . $type);
}
}
function notifications_content_update_6000() {
notifications_content_install();
return array();
}
function notifications_content_update_6001() {
drupal_set_message(t('Please, check all your Notifications content settings and note the new options.'));
return array();
}
function notifications_content_update_6002() {
if ($events = variable_get('notifications_events', array())) {
$enabled = array();
foreach ($events as $type => $type_info) {
foreach ($type_info as $action => $status) {
$enabled[$type . '-' . $action] = 1;
}
}
variable_set('notifications_event_enabled', $enabled);
variable_del('notifications_events');
}
return array();
}