function recaptcha_update_6200 in reCAPTCHA 6.2
Update variables from 6.x-1.x.
File
- ./
recaptcha.install, line 24 - Installation file for reCAPTCHA module.
Code
function recaptcha_update_6200() {
$ret = array();
// Migrate the public key to site key.
$public_key = variable_get('recaptcha_public_key', '');
variable_set('recaptcha_site_key', $public_key);
variable_del('recaptcha_public_key');
$private_key = variable_get('recaptcha_private_key', '');
variable_set('recaptcha_secret_key', $private_key);
variable_del('recaptcha_private_key');
// Migrate previous 6.x-1.x themes to 6.x-2.x as good as possible.
$recaptcha_themes = array(
'red' => 'light',
'white' => 'light',
'blackglass' => 'dark',
'clean' => 'light',
'custom' => 'light',
);
$recaptcha_theme = variable_get('recaptcha_theme', 'light');
variable_set('recaptcha_theme', $recaptcha_themes[$recaptcha_theme]);
// Change an empty tabindex to value 0 for consistency with D7/D8.
$recaptcha_tabindex = variable_get('recaptcha_tabindex', '');
if ($recaptcha_tabindex == '') {
variable_set('recaptcha_tabindex', 0);
}
// Delete obsolete variables.
variable_del('recaptcha_ajax_api');
variable_del('recaptcha_nocookies');
variable_del('recaptcha_server_status_check_interval');
// Remove stale variables not cleaned up properly in previous releases.
variable_del('recaptcha_api_server');
variable_del('recaptcha_api_secure_server');
variable_del('recaptcha_secure_connection');
variable_del('recaptcha_verify_server');
// Mailhide module is not available, delete obsolete variables:
// - recaptcha_mailhide_public_key
// - recaptcha_mailhide_public_key_*
// - recaptcha_mailhide_private_key
// - recaptcha_mailhide_private_key_*
db_query("DELETE FROM {variable} WHERE name LIKE '%s%%'", 'recaptcha_mailhide_');
cache_clear_all('variables', 'cache');
$ret[] = array(
'success' => TRUE,
'query' => 'Migrated settings. You may need to create a new site key and secret key if it does not work.',
);
return $ret;
}