function _redirect_migrate_path_redirect_variables in Redirect 7.2
Same name and namespace in other branches
- 7 redirect.install \_redirect_migrate_path_redirect_variables()
Migrate path redirect variables to redirect variables.
1 call to _redirect_migrate_path_redirect_variables()
- _redirect_migrate_path_redirect_redirects in ./
redirect.install - Migrate data and variables from the Drupal 6 path_redirect module.
File
- ./
redirect.install, line 436 - Install, update and uninstall functions for the redirect module.
Code
function _redirect_migrate_path_redirect_variables() {
// Port path_redirect variables.
$variables = array(
'path_redirect_default_status' => 'redirect_default_status_code',
'path_redirect_purge_inactive' => 'redirect_purge_inactive',
'path_redirect_retain_query_string' => 'redirect_passthrough_querystring',
'path_redirect_auto_redirect' => 'redirect_auto_redirect',
'path_redirect_redirect_warning' => 'redirect_warning',
'path_redirect_allow_bypass' => NULL,
);
foreach ($variables as $old_variable => $new_variable) {
if (!empty($new_variable)) {
$old_value = variable_get($old_variable);
$new_value = variable_get($new_variable);
// Only if the old variable exists, and the new variable hasn't been set
// yet, do we set the new variable with the old value.
if (isset($old_value) && !isset($new_value)) {
variable_set($new_variable, $old_value);
}
}
// Delete the old path redirect variable.
variable_del($old_variable);
}
}