function hosting_task_migrate_form_validate in Hostmaster (Aegir) 6
Implementation of hook_validate().
A site may be migrated if it's URL, Platform or DB server has changed. Only one of these needs to change for a valid migration to be possible.
1 call to hosting_task_migrate_form_validate()
- hosting_task_clone_form_validate in modules/
hosting/ clone/ hosting_clone.module - Implementation of hook_hosting_task_TASK_TYPE_form_validate().
File
- modules/
hosting/ migrate/ hosting_migrate.module, line 70
Code
function hosting_task_migrate_form_validate($form, &$form_state) {
$migrate_possible = false;
$site = $form['parameters']['#node'];
$url = strtolower(trim($form_state['values']['parameters']['new_uri']));
// domain names are case-insensitive
if ($url != strtolower(trim($site->title))) {
$migrate_possible = TRUE;
if (!_hosting_valid_fqdn($url)) {
form_set_error('title', t("You have not specified a valid url for this site."));
}
if (hosting_site_exists($url)) {
form_set_error('title', t("The domain name you have specified is not unique."));
}
}
if ($form_state['values']['parameters']['target_platform'] != $site->platform) {
$migrate_possible = TRUE;
}
if ($form_state['values']['parameters']['new_db_server'] != $site->db_server) {
$migrate_possible = TRUE;
}
if (!$migrate_possible) {
form_set_error('parameters][target_platform', t("To migrate a site you need to modify at least one of the following fields: Domain name, Platform or Database server"));
}
}