function sharethis_update_7001 in ShareThis 7.2
Remove the custom ShareThis table.
File
- ./
sharethis.install, line 42 - This file holds the install information for the ShareThis Module.
Code
function sharethis_update_7001() {
// Move from the st_table to the variables table.
if (db_table_exists('st_table')) {
// Select all options in the ShareThis table.
$result = db_select('st_table', 's')
->fields('s', array(
'st_option',
'st_value',
))
->execute();
while ($record = $result
->fetchAssoc()) {
// Variable name switches. publisherID stays the same.
switch ($record['st_option']) {
case 'buttons':
$record['st_option'] = 'button_option';
break;
case 'nodeType':
$record['st_option'] = 'node_option';
break;
case 'services':
$record['st_option'] = 'service_option';
break;
case 'viewMode':
$record['st_option'] = 'teaser_option';
break;
case 'widget':
$record['st_option'] = 'widget_option';
break;
}
// Prefix the option with a "sharethis_" namespace.
variable_set('sharethis_' . $record['st_option'], $record['st_value']);
}
// Now that our settings are in the variables table, safely drop the table.
db_drop_table('st_table');
// Return a success message.
return t('Switched from the custom ShareThis table to the Variables table.');
}
}