function simplenews_update_6000 in Simplenews 6.2
Same name and namespace in other branches
- 6 simplenews.install \simplenews_update_6000()
Data conversion of block delta. Field type conversions: newsletter priority. Field name change in simplenews_subscriptions table.
File
- ./
simplenews.install, line 392 - Simplenews installation.
Code
function simplenews_update_6000() {
$ret = array();
// Convert the block delta: remove 'newsletter-' prefix from the delta.
$result = db_query("\n SELECT module, delta\n FROM {blocks}\n WHERE module = 'simplenews'\n AND delta LIKE 'newsletter-%'");
while ($data = db_fetch_object($result)) {
$delta = strtr($data->delta, array(
'newsletter-' => '',
));
$ret[] = update_sql("\n UPDATE {blocks}\n SET delta = '%s'\n WHERE module = 'simplenews'\n AND delta = 'newsletter-%s'", $delta, $delta);
}
$result = db_query("\n SELECT module, delta\n FROM {blocks_roles}\n WHERE module = 'simplenews'\n AND delta LIKE 'newsletter-%'");
while ($data = db_fetch_object($result)) {
$delta = strtr($data->delta, array(
'newsletter-' => '',
));
$ret[] = update_sql("\n UPDATE {blocks_roles}\n SET delta = '%s'\n WHERE module = 'simplenews'\n AND delta = 'newsletter-%s'", $delta, $delta);
}
// Convert newsletter priority: change field type int to string
db_change_field($ret, 'simplenews_newsletters', 'priority', 'priority', array(
'type' => 'varchar',
'length' => 8,
'not null' => TRUE,
'default' => '',
));
// Convert subscription field name: change a_status to activated
db_change_field($ret, 'simplenews_subscriptions', 'a_status', 'activated', array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
));
// Convert subscription field name: change s_status to is_send
db_change_field($ret, 'simplenews_subscriptions', 's_status', 'is_send', array(
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0,
));
return $ret;
}