function backup_migrate_destination_nodesquirrel::vaidate_key in Backup and Migrate 6.3
Same name and namespace in other branches
- 8.3 includes/destinations.nodesquirrel.inc \backup_migrate_destination_nodesquirrel::vaidate_key()
Validate a secret key. Returns error text if the key is invalid.
2 calls to backup_migrate_destination_nodesquirrel::vaidate_key()
- backup_migrate_destination_nodesquirrel::before_backup_form_validate in includes/
destinations.nodesquirrel.inc - Validate the before_backup_form form.
- backup_migrate_destination_nodesquirrel::edit_form_validate in includes/
destinations.nodesquirrel.inc - Submit the configuration form. Glue the url together and add the old password back if a new one was not specified.
File
- includes/
destinations.nodesquirrel.inc, line 397 - Functions to handle the NodeSquirrel backup destination.
Class
- backup_migrate_destination_nodesquirrel
- A destination for sending database backups to the NodeSquirel backup service.
Code
function vaidate_key($key) {
$error = FALSE;
if ($key) {
if (!preg_match(NODESQUIRREL_SECRET_KEY_PATTERN, $key)) {
return 'The secret key you entered is not the right format. Please make sure you copy it exactly.';
}
$this->settings['secret_key'] = check_plain($key);
$limits = $this
->check_limits();
if (!$limits) {
$err = xmlrpc_error();
if (!empty($err->code) && $err->code == '401') {
return 'Could not log in to the NodeSquirrel server. Please check that your secret key is correct.';
}
else {
return 'Your site could not be found on NodeSquirrel. Please check that your secret key is correct.';
}
}
}
else {
return 'You must enter a NodeSquirrel secret key.';
}
return FALSE;
}