function fb_connect_update_6200 in Drupal for Facebook 6.2
Same name and namespace in other branches
- 6.3 fb_connect.install \fb_connect_update_6200()
@file Install functions for fb_connect.module.
File
- ./
fb_connect.install, line 9 - Install functions for fb_connect.module.
Code
function fb_connect_update_6200() {
$items = array();
foreach (array(
'fb_connect_primary',
'fb_connect_login',
) as $prefix) {
$oldvar = $prefix . '_apikey';
$newvar = $prefix . '_nid';
// Variable fb_connect_primary_apikey is now fb_connect_primary_nid
if ($apikey = variable_get($oldvar, NULL)) {
$result = db_query("SELECT * FROM {fb_app} WHERE apikey = '%s'", $apikey);
$data = db_fetch_object($result);
if ($data->nid) {
variable_set($newvar, $data->nid);
$items[] = array(
'success' => TRUE,
'query' => "updated {$newvar} to be {$data->label} ({$data->nid})",
);
variable_del($oldvar);
}
else {
$items[] = array(
'success' => FALSE,
'query' => "Could not find {$oldvar} by apikey ({$apikey})",
);
}
}
}
return $items;
}