function notifications_update_6011 in Notifications 6.4
Language enable everything and normalize language field
File
- ./
notifications.install, line 467
Code
function notifications_update_6011() {
$ret = array();
$language_field = array(
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => '',
);
$language_default = language_default('language');
if (!variable_get('notifications_update_destinations', 0)) {
$ret = _notifications_update_queue_clean();
}
db_change_field($ret, 'notifications_queue', 'language', 'language', $language_field);
//db_change_field($ret, 'notifications_event', 'language', 'language', $language_field);
// Add language to 'notifications' and populate with user's language or default language
db_add_field($ret, 'notifications', 'language', $language_field);
$ret[] = update_sql("UPDATE {notifications} n SET language = (SELECT language FROM {users} u WHERE n.uid = u.uid AND u.language <> '')");
$ret[] = update_sql("UPDATE {notifications} SET language = '{$language_default}' WHERE language = '' OR language IS NULL");
return $ret;
}