function themekey_update_6001 in ThemeKey 6.2
Same name and namespace in other branches
- 6.4 themekey.install \themekey_update_6001()
- 6 themekey.install \themekey_update_6001()
- 6.3 themekey.install \themekey_update_6001()
- 7.3 themekey.install \themekey_update_6001()
- 7 themekey.install \themekey_update_6001()
- 7.2 themekey.install \themekey_update_6001()
Implements hook_update_N().
Update property 'nid' to 'node:nid'
File
- ./
themekey.install, line 82 - Database schema of @author Markus Kalkbrenner | Cocomore AG
Code
function themekey_update_6001() {
$ret = array();
//
$result = db_query('SELECT * FROM {themekey_properties} WHERE property = \'nid\'');
while ($item = db_fetch_array($result)) {
if (db_result(db_query('SELECT COUNT(id) FROM {themekey_properties} WHERE property = \'node:nid\' AND value = \'%s\'', $item['value'])) > 0) {
$ret[] = update_sql('DELETE FROM {themekey_properties} WHERE id = ' . $item['id']);
}
else {
$ret[] = update_sql('UPDATE {themekey_properties} SET property = \'node:nid\' WHERE id = ' . $item['id']);
}
}
return $ret;
}