function fb_update_7401 in Drupal for Facebook 7.4
Upgrade applications from modules/fb 3.x to 4.x.
File
- ./
fb.install, line 276
Code
function fb_update_7401() {
require_once drupal_get_path('module', 'fb') . '/fb.admin.inc';
$result = db_query("SELECT * FROM {fb_app}");
while ($row = $result
->fetchAssoc()) {
try {
$form_state = array(
'values' => array(
'fba' => $row['id'],
'secret' => $row['secret'],
'states' => array(
'enabled' => $row['status'],
),
),
);
drupal_form_submit('fb_admin_application_edit_form', $form_state);
if (!$form_state['submitted'] || !$form_state['executed']) {
// drupal_form_submit did not succeed.
$message = t('Drupal for Facebook failed to upgrade application %name (%id). You must configure it manually.', array(
'%name' => $row['title'],
'%id' => $row['id'],
));
drupal_set_message($message, 'error');
}
} catch (Exception $e) {
$message = t('Drupal for Facebook failed to upgrade application %name (%id). You must configure it manually.', array(
'%name' => $row['title'],
'%id' => $row['id'],
));
fb_log_exception($e, $message);
drupal_set_message($message, 'error');
}
}
}