| 1 |
<?php |
<?php |
| 2 |
// $Id: backup_migrate.module,v 1.1.2.25.2.1.2.18 2009/04/05 04:18:09 ronan Exp $ |
// $Id: backup_migrate.module,v 1.1.2.25.2.1.2.19 2009/04/06 04:07:53 ronan Exp $ |
| 3 |
|
|
| 4 |
|
|
| 5 |
/** |
/** |
| 16 |
function backup_migrate_help($section, $arg) { |
function backup_migrate_help($section, $arg) { |
| 17 |
$help = array( |
$help = array( |
| 18 |
array( |
array( |
| 19 |
'body' => t('Backup and Migrate makes the task of backing up your Drupal database and migrating data from one Drupal install to another easier. It provides a function to backup the entire database to file or download, and to restore from a previous backup. You can also schedule the backup operation. Compression of backup files is also supported.'), |
'body' => |
| 20 |
|
t('Backup and Migrate makes the task of backing up your Drupal database and migrating data from one Drupal install to another easier. It provides a function to backup the entire database to file or download, and to restore from a previous backup. You can also schedule the backup operation. Compression of backup files is also supported. The database backup files created with this module can be imported into this or any other Drupal installation with the !restorelink, or you can use a database tool such as <a href="!phpmyadminurl">phpMyAdmin</a> or the mysql command line command.', |
| 21 |
|
array( |
| 22 |
|
'!restorelink' => user_access('restore from backup') ? l(t('restore feature'), 'admin/content/backup_migrate/restore') : t('restore feature'), |
| 23 |
|
'!phpmyadminurl' => 'http://www.phpmyadmin.net' |
| 24 |
|
) |
| 25 |
|
) |
| 26 |
), |
), |
| 27 |
'admin/content/backup_migrate' => array( |
'admin/content/backup_migrate' => array( |
| 28 |
'title' => t('Backup Tab'), |
'title' => t('Quick Backup Tab'), |
| 29 |
'body' => t('Use this form to run manual backups of your database. You can fill out the fields below, or if you have any !profilelink saved you can load one. The backup files created can be imported into this or any other Drupal installation with the !restorelink, or you can use a database tool such as <a href="!phpmyadminurl">phpMyAdmin</a> or the mysql command line command.', |
'body' => t('Use this form to run simple manual backups of your database. Visit the !helppage for more help using this module', |
| 30 |
|
array( |
| 31 |
|
'!helppage' => l(t('help page'), 'admin/help/backup_migrate')) |
| 32 |
|
), |
| 33 |
|
), |
| 34 |
|
'admin/content/backup_migrate/export/advanced' => array( |
| 35 |
|
'title' => t('Advanced Backup Tab'), |
| 36 |
|
'body' => t('Use this form to run manual backups of your database with more advanced options. If you have any !profilelink saved you can load those settings. You can save any of the changes you make to these settings as a new settings profile.', |
| 37 |
array("!profilelink" => user_access('administer backup and migrate') ? l(t('settings profiles'), 'admin/content/backup_migrate/profile') : t('settings profiles'), '!restorelink' => user_access('restore from backup') ? l(t('restore feature'), 'admin/content/backup_migrate/restore') : t('restore feature'), '!phpmyadminurl' => 'http://www.phpmyadmin.net')), |
array("!profilelink" => user_access('administer backup and migrate') ? l(t('settings profiles'), 'admin/content/backup_migrate/profile') : t('settings profiles'), '!restorelink' => user_access('restore from backup') ? l(t('restore feature'), 'admin/content/backup_migrate/restore') : t('restore feature'), '!phpmyadminurl' => 'http://www.phpmyadmin.net')), |
| 38 |
), |
), |
| 39 |
'admin/content/backup_migrate/restore' => array( |
'admin/content/backup_migrate/restore' => array( |
| 84 |
$items['admin/content/backup_migrate'] = array( |
$items['admin/content/backup_migrate'] = array( |
| 85 |
'title' => 'Backup and Migrate', |
'title' => 'Backup and Migrate', |
| 86 |
'description' => 'Backup/restore your database or migrate data to or from another Drupal site.', |
'description' => 'Backup/restore your database or migrate data to or from another Drupal site.', |
| 87 |
'page callback' => 'backup_migrate_ui_manual_backup', |
'page callback' => 'backup_migrate_ui_manual_backup_quick', |
| 88 |
'access arguments' => array('access backup and migrate'), |
'access arguments' => array('access backup and migrate'), |
| 89 |
'type' => MENU_NORMAL_ITEM, |
'type' => MENU_NORMAL_ITEM, |
| 90 |
); |
); |
| 92 |
'title' => 'Backup', |
'title' => 'Backup', |
| 93 |
'description' => 'Backup the database.', |
'description' => 'Backup the database.', |
| 94 |
'page callback' => 'backup_migrate_menu_callback', |
'page callback' => 'backup_migrate_menu_callback', |
| 95 |
'page arguments' => array('', 'backup_migrate_ui_manual_backup', TRUE), |
'page arguments' => array('', 'backup_migrate_ui_manual_backup_quick', TRUE), |
| 96 |
|
'access arguments' => array('access backup and migrate'), |
| 97 |
|
'weight' => 0, |
| 98 |
|
'type' => MENU_DEFAULT_LOCAL_TASK, |
| 99 |
|
); |
| 100 |
|
$items['admin/content/backup_migrate/export/quick'] = array( |
| 101 |
|
'title' => 'Quick Backup', |
| 102 |
|
'description' => 'Backup the database.', |
| 103 |
|
'page callback' => 'backup_migrate_menu_callback', |
| 104 |
|
'page arguments' => array('', 'backup_migrate_ui_manual_backup_quick', TRUE), |
| 105 |
'access arguments' => array('access backup and migrate'), |
'access arguments' => array('access backup and migrate'), |
| 106 |
'weight' => 0, |
'weight' => 0, |
| 107 |
'type' => MENU_DEFAULT_LOCAL_TASK, |
'type' => MENU_DEFAULT_LOCAL_TASK, |
| 108 |
); |
); |
| 109 |
|
$items['admin/content/backup_migrate/export/advanced'] = array( |
| 110 |
|
'title' => 'Advanced Backup', |
| 111 |
|
'description' => 'Backup the database.', |
| 112 |
|
'page callback' => 'backup_migrate_menu_callback', |
| 113 |
|
'page arguments' => array('', 'backup_migrate_ui_manual_backup_advanced', TRUE), |
| 114 |
|
'access arguments' => array('perform backup'), |
| 115 |
|
'weight' => 1, |
| 116 |
|
'type' => MENU_LOCAL_TASK, |
| 117 |
|
); |
| 118 |
$items['admin/content/backup_migrate/restore'] = array( |
$items['admin/content/backup_migrate/restore'] = array( |
| 119 |
'title' => 'Restore', |
'title' => 'Restore', |
| 120 |
'description' => 'Restore the database from a previous backup', |
'description' => 'Restore the database from a previous backup', |
| 204 |
'page callback' => 'backup_migrate_menu_callback', |
'page callback' => 'backup_migrate_menu_callback', |
| 205 |
'page arguments' => array('schedules', 'backup_migrate_ui_schedule_display_schedules', TRUE), |
'page arguments' => array('schedules', 'backup_migrate_ui_schedule_display_schedules', TRUE), |
| 206 |
'access arguments' => array('administer backup and migrate'), |
'access arguments' => array('administer backup and migrate'), |
| 207 |
'weight' => 3, |
'weight' => 4, |
| 208 |
'type' => MENU_LOCAL_TASK, |
'type' => MENU_LOCAL_TASK, |
| 209 |
); |
); |
| 210 |
$items['admin/content/backup_migrate/schedule/list'] = array( |
$items['admin/content/backup_migrate/schedule/list'] = array( |
| 245 |
'type' => MENU_LOCAL_TASK, |
'type' => MENU_LOCAL_TASK, |
| 246 |
); |
); |
| 247 |
$items['admin/content/backup_migrate/profile'] = array( |
$items['admin/content/backup_migrate/profile'] = array( |
| 248 |
'title' => 'Profiles', |
'title' => 'Settings Profiles', |
| 249 |
'description' => 'View existing profiles', |
'description' => 'View existing profiles', |
| 250 |
'page callback' => 'backup_migrate_menu_callback', |
'page callback' => 'backup_migrate_menu_callback', |
| 251 |
'page arguments' => array('profiles', 'backup_migrate_ui_profile_display_profiles', TRUE), |
'page arguments' => array('profiles', 'backup_migrate_ui_profile_display_profiles', TRUE), |
| 317 |
if (function_exists('drupal_get_path')) { |
if (function_exists('drupal_get_path')) { |
| 318 |
require_once './'. drupal_get_path('module', 'backup_migrate') .'/includes/files.inc'; |
require_once './'. drupal_get_path('module', 'backup_migrate') .'/includes/files.inc'; |
| 319 |
// Delete any temporary files generated during this execution. |
// Delete any temporary files generated during this execution. |
| 320 |
_backup_migrate_temp_files_delete(); |
backup_migrate_cleanup(); |
| 321 |
} |
} |
| 322 |
} |
} |
| 323 |
|
|
| 337 |
return array_keys($tests); |
return array_keys($tests); |
| 338 |
} |
} |
| 339 |
|
|
| 340 |
|
/** |
| 341 |
|
* Implementation of hook_theme(). |
| 342 |
|
*/ |
| 343 |
|
function backup_migrate_theme() { |
| 344 |
|
$themes = array( |
| 345 |
|
'backup_migrate_ui_manual_quick_backup_form' => array( |
| 346 |
|
'arguments' => array('form'), |
| 347 |
|
), |
| 348 |
|
); |
| 349 |
|
return $themes; |
| 350 |
|
} |
| 351 |
|
|
| 352 |
/* Menu Callbacks */ |
/* Menu Callbacks */ |
| 353 |
|
|
| 354 |
/** |
/** |
| 365 |
} |
} |
| 366 |
|
|
| 367 |
/** |
/** |
| 368 |
* The menu callback for manual backups. |
* The menu callback for easy manual backups. |
| 369 |
*/ |
*/ |
| 370 |
function backup_migrate_ui_manual_backup($profile_id = NULL) { |
function backup_migrate_ui_manual_backup_quick() { |
|
require_once './'. drupal_get_path('module', 'backup_migrate') .'/includes/profiles.inc'; |
|
| 371 |
$out = ""; |
$out = ""; |
| 372 |
if (user_access('perform backup')) { |
if (user_access('perform backup')) { |
| 373 |
$profile = _backup_migrate_profile_saved_default_profile($profile_id); |
$out .= drupal_get_form('backup_migrate_ui_manual_quick_backup_form'); |
|
$out .= drupal_get_form('backup_migrate_ui_manual_backup_load_profile_form', $profile); |
|
|
$out .= drupal_get_form('backup_migrate_ui_manual_backup_form', $profile); |
|
| 374 |
} |
} |
| 375 |
else { |
else { |
| 376 |
$out = t('You do not have permission to back up this site.'); |
$out = t('You do not have permission to back up this site.'); |
| 379 |
} |
} |
| 380 |
|
|
| 381 |
/** |
/** |
| 382 |
|
* The menu callback for advanced manual backups. |
| 383 |
|
*/ |
| 384 |
|
function backup_migrate_ui_manual_backup_advanced($profile_id = NULL) { |
| 385 |
|
require_once './'. drupal_get_path('module', 'backup_migrate') .'/includes/profiles.inc'; |
| 386 |
|
$out = ""; |
| 387 |
|
$profile = _backup_migrate_profile_saved_default_profile($profile_id); |
| 388 |
|
$out .= drupal_get_form('backup_migrate_ui_manual_backup_load_profile_form', $profile); |
| 389 |
|
$out .= drupal_get_form('backup_migrate_ui_manual_backup_form', $profile); |
| 390 |
|
return $out; |
| 391 |
|
} |
| 392 |
|
|
| 393 |
|
/** |
| 394 |
* The backup/export load profile form. |
* The backup/export load profile form. |
| 395 |
*/ |
*/ |
| 396 |
function backup_migrate_ui_manual_backup_load_profile_form(&$form_state, $profile = NULL) { |
function backup_migrate_ui_manual_backup_load_profile_form(&$form_state, $profile = NULL) { |
| 397 |
$form = array(); |
$form = array(); |
| 398 |
$profile_options = _backup_migrate_get_profile_form_item_options(); |
$profile_options = _backup_migrate_get_profile_form_item_options(); |
| 399 |
if (count($profile_options) > 0) { |
if (count($profile_options) > 0) { |
| 400 |
$profile_options = array(0 => t('-- Select a Profile --')) + $profile_options; |
$profile_options = array(0 => t('-- Select a Settings Profile --')) + $profile_options; |
| 401 |
$form['profile'] = array( |
$form['profile'] = array( |
| 402 |
"#title" => t("Settings Profile"), |
"#title" => t("Settings Profile"), |
| 403 |
"#collapsible" => TRUE, |
"#collapsible" => TRUE, |
| 432 |
else { |
else { |
| 433 |
variable_set("backup_migrate_profile_id", NULL); |
variable_set("backup_migrate_profile_id", NULL); |
| 434 |
} |
} |
| 435 |
|
} |
| 436 |
|
|
| 437 |
|
/** |
| 438 |
|
* The quick backup form. |
| 439 |
|
*/ |
| 440 |
|
function backup_migrate_ui_manual_quick_backup_form(&$form_state) { |
| 441 |
|
require_once './'. drupal_get_path('module', 'backup_migrate') .'/includes/profiles.inc'; |
| 442 |
|
drupal_add_js(drupal_get_path('module', 'backup_migrate') .'/backup_migrate.js'); |
| 443 |
|
|
| 444 |
|
$form = array(); |
| 445 |
|
|
| 446 |
|
$form['quickbackup'] = array( |
| 447 |
|
'#type' => 'fieldset', |
| 448 |
|
"#title" => t("Quick Backup"), |
| 449 |
|
"#collapsible" => FALSE, |
| 450 |
|
"#collapsed" => FALSE, |
| 451 |
|
"#tree" => FALSE, |
| 452 |
|
); |
| 453 |
|
|
| 454 |
|
$form['quickbackup']['source_id'] = _backup_migrate_get_source_pulldown(variable_get('backup_migrate_source_id', NULL)); |
| 455 |
|
|
| 456 |
|
$form['quickbackup']['destination_id'] = array( |
| 457 |
|
"#type" => "select", |
| 458 |
|
"#title" => t("Destination"), |
| 459 |
|
"#options" => _backup_migrate_get_destination_form_item_options('manual backup'), |
| 460 |
|
"#default_value" => variable_get("backup_migrate_destination_id", "download"), |
| 461 |
|
); |
| 462 |
|
$profile_options = _backup_migrate_get_profile_form_item_options(); |
| 463 |
|
$form['quickbackup']['profile_id'] = array( |
| 464 |
|
"#type" => "select", |
| 465 |
|
"#title" => t("Settings Profile"), |
| 466 |
|
'#default_value' => variable_get('backup_migrate_profile_id', NULL), |
| 467 |
|
"#options" => $profile_options, |
| 468 |
|
); |
| 469 |
|
|
| 470 |
|
$form['quickbackup']['submit'] = array( |
| 471 |
|
'#type' => 'submit', |
| 472 |
|
'#value' => t('Backup now'), |
| 473 |
|
'#weight' => 1, |
| 474 |
|
); |
| 475 |
|
|
| 476 |
|
$form['advanced'] = array( |
| 477 |
|
'#type' => 'markup', |
| 478 |
|
'#value' => t('For more backup options, try the <a href="!advancedurl">advanced backup page</a>.', array('!advancedurl' => url('admin/content/backup_migrate/export/advanced'))), |
| 479 |
|
); |
| 480 |
|
|
| 481 |
|
|
| 482 |
|
return $form; |
| 483 |
|
} |
| 484 |
|
|
| 485 |
|
/** |
| 486 |
|
* Submit the quick backup form. |
| 487 |
|
*/ |
| 488 |
|
function backup_migrate_ui_manual_quick_backup_form_submit($form, &$form_state) { |
| 489 |
|
if (user_access('perform backup')) { |
| 490 |
|
// For a quick backup use the default settings. |
| 491 |
|
$settings = _backup_migrate_profile_saved_default_profile($form_state['values']['profile_id']); |
| 492 |
|
|
| 493 |
|
// Set the destination to the one chosen in the pulldown. |
| 494 |
|
$settings['destination_id'] = $form_state['values']['destination_id']; |
| 495 |
|
$settings['source_id'] = $form_state['values']['source_id']; |
| 496 |
|
|
| 497 |
|
// Save the settings for next time. |
| 498 |
|
variable_set("backup_migrate_source_id", $form_state['values']['source_id']); |
| 499 |
|
variable_set("backup_migrate_destination_id", $form_state['values']['destination_id']); |
| 500 |
|
variable_set("backup_migrate_profile_id", $form_state['values']['profile_id']); |
| 501 |
|
|
| 502 |
|
// Do the backup. |
| 503 |
|
backup_migrate_ui_manual_backup_perform($settings); |
| 504 |
|
} |
| 505 |
$form_state['redirect'] = "admin/content/backup_migrate"; |
$form_state['redirect'] = "admin/content/backup_migrate"; |
| 506 |
} |
} |
| 507 |
|
|
| 508 |
/** |
/** |
| 509 |
|
* Theme the quick backup form. |
| 510 |
|
*/ |
| 511 |
|
function theme_backup_migrate_ui_manual_quick_backup_form($form) { |
| 512 |
|
// Remove the titles so that the pulldowns can be displayed inline. |
| 513 |
|
unset($form['quickbackup']['source_id']['#title']); |
| 514 |
|
unset($form['quickbackup']['destination_id']['#title']); |
| 515 |
|
unset($form['quickbackup']['profile_id']['#title']); |
| 516 |
|
|
| 517 |
|
$replacements = array( |
| 518 |
|
'!from' => drupal_render($form['quickbackup']['source_id']), |
| 519 |
|
'!to' => drupal_render($form['quickbackup']['destination_id']), |
| 520 |
|
'!profile' => drupal_render($form['quickbackup']['profile_id']), |
| 521 |
|
'!submit' => drupal_render($form['quickbackup']['submit']), |
| 522 |
|
); |
| 523 |
|
$form['quickbackup']['markup'] = array( |
| 524 |
|
'#type' => 'markup', |
| 525 |
|
"#prefix" => '<div class="container-inline">', |
| 526 |
|
"#suffix" => '</div>', |
| 527 |
|
'#value' => t('Backup from !from to !to using !profile !submit', $replacements), |
| 528 |
|
); |
| 529 |
|
unset($form['quickbackup']['source_id']); |
| 530 |
|
unset($form['quickbackup']['destination_id']); |
| 531 |
|
unset($form['quickbackup']['profile_id']); |
| 532 |
|
unset($form['quickbackup']['submit']); |
| 533 |
|
return drupal_render($form); |
| 534 |
|
} |
| 535 |
|
|
| 536 |
|
/** |
| 537 |
* The backup/export form. |
* The backup/export form. |
| 538 |
*/ |
*/ |
| 539 |
function backup_migrate_ui_manual_backup_form(&$form_state, $profile = array()) { |
function backup_migrate_ui_manual_backup_form(&$form_state, $profile = array()) { |
| 599 |
$name["#default_value"] = t('Untitled Profile'); |
$name["#default_value"] = t('Untitled Profile'); |
| 600 |
} |
} |
| 601 |
$form['save_options']['name'] = $name; |
$form['save_options']['name'] = $name; |
| 602 |
|
$form['save_options'][] = array( |
| 603 |
|
'#type' => 'submit', |
| 604 |
|
'#value' => t('Save Without Backing Up'), |
| 605 |
|
); |
| 606 |
} |
} |
| 607 |
|
|
| 608 |
$form[] = array( |
$form[] = array( |
| 616 |
* Submit the form. Save the values as defaults if desired and output the backup file. |
* Submit the form. Save the values as defaults if desired and output the backup file. |
| 617 |
*/ |
*/ |
| 618 |
function backup_migrate_ui_manual_backup_form_submit($form, &$form_state) { |
function backup_migrate_ui_manual_backup_form_submit($form, &$form_state) { |
| 619 |
if ($form_state['values']['op'] == t('Load Profile')) { |
// Save the settings profile if the save box is checked. |
| 620 |
if ($profile = backup_migrate_get_profile($form_state['values']['profile_id'])) { |
$form_state['values']['nodata_tables'] = array_filter((array)$form_state['values']['nodata_tables']); |
| 621 |
$form_state['redirect'] = "admin/content/backup_migrate/". $form_state['values']['profile_id']; |
$form_state['values']['exclude_tables'] = array_filter((array)$form_state['values']['exclude_tables']); |
| 622 |
|
if ($form_state['values']['save_settings'] && user_access('administer backup and migrate')) { |
| 623 |
|
if (@$form_state['values']['create_new']) { |
| 624 |
|
$form_state['values']['profile_id'] = NULL; |
| 625 |
} |
} |
| 626 |
|
$profile = backup_migrate_profile_save_profile($form_state['values']); |
| 627 |
|
variable_set("backup_migrate_profile_id", $profile['profile_id']); |
| 628 |
|
variable_set("backup_migrate_destination_id", $form_state['values']['destination_id']); |
| 629 |
} |
} |
|
if ($form_state['values']['op'] == t('Backup Database') && user_access('perform backup')) { |
|
|
$form_state['values']['nodata_tables'] = array_filter((array)$form_state['values']['nodata_tables']); |
|
|
$form_state['values']['exclude_tables'] = array_filter((array)$form_state['values']['exclude_tables']); |
|
|
if ($form_state['values']['save_settings']) { |
|
|
if (@$form_state['values']['create_new']) { |
|
|
$form_state['values']['profile_id'] = NULL; |
|
|
} |
|
|
$profile = backup_migrate_profile_save_profile($form_state['values']); |
|
|
variable_set("backup_migrate_profile_id", $profile['profile_id']); |
|
|
variable_set("backup_migrate_destination_id", $form_state['values']['destination_id']); |
|
|
} |
|
| 630 |
|
|
| 631 |
// Set interactive mode so that messages are sent to the user. |
// Perform the actual backup if that is what was selected. |
| 632 |
_backup_migrate_interactive(TRUE); |
if ($form_state['values']['op'] == t('Backup Database') && user_access('perform backup')) { |
| 633 |
$settings = $form_state['values']; |
$settings = $form_state['values']; |
| 634 |
$file = backup_migrate_perform_backup($settings); |
backup_migrate_ui_manual_backup_perform($settings); |
| 635 |
|
} |
| 636 |
|
$form_state['redirect'] = "admin/content/backup_migrate/export/advanced"; |
| 637 |
|
} |
| 638 |
|
|
| 639 |
if ($file) { |
/** |
| 640 |
$destination = backup_migrate_get_destination($form_state['values']['destination_id']); |
* Perform an actual manual backup and tell the user of the progress. |
| 641 |
require_once './'. drupal_get_path('module', 'backup_migrate') .'/includes/destinations.inc'; |
*/ |
| 642 |
$message = 'Database backup file %file saved to destination %dest. !links'; |
|
| 643 |
$links = ""; |
function backup_migrate_ui_manual_backup_perform($settings) { |
| 644 |
if ($links = $destination->get_file_links($file->file_id())) { |
// Set interactive mode so that messages are sent to the user. |
| 645 |
$links = ' ('. implode(", ", $links) .')'; |
_backup_migrate_interactive(TRUE); |
| 646 |
} |
|
| 647 |
_backup_migrate_message($message, array('%file' => $settings['filename'], '%dest' => $destination->name(), '!links' => $links ? $links : "")); |
// Peform the actual backup. |
| 648 |
|
$file = backup_migrate_perform_backup($settings); |
| 649 |
|
|
| 650 |
|
// If the backup succeeded, tell the user and give options to download, restore etc. |
| 651 |
|
if ($file) { |
| 652 |
|
$destination = backup_migrate_get_destination($settings['destination_id']); |
| 653 |
|
require_once './'. drupal_get_path('module', 'backup_migrate') .'/includes/destinations.inc'; |
| 654 |
|
$message = 'Database backup file %file saved to destination %dest. !links'; |
| 655 |
|
$links = ""; |
| 656 |
|
if ($links = $destination->get_file_links($file->file_id())) { |
| 657 |
|
$links = ' ('. implode(", ", $links) .')'; |
| 658 |
} |
} |
| 659 |
|
_backup_migrate_message($message, array('%file' => $settings['filename'], '%dest' => $destination->name(), '!links' => $links ? $links : "")); |
| 660 |
} |
} |
|
$form_state['redirect'] = "admin/content/backup_migrate"; |
|
| 661 |
} |
} |
| 662 |
|
|
| 663 |
/** |
/** |
| 680 |
if (count($sources) > 1) { |
if (count($sources) > 1) { |
| 681 |
$form['source_id'] = array( |
$form['source_id'] = array( |
| 682 |
"#type" => "select", |
"#type" => "select", |
| 683 |
"#title" => t("Database"), |
"#title" => t("Restore to"), |
| 684 |
"#options" => _backup_migrate_get_destination_form_item_options('source'), |
"#options" => _backup_migrate_get_destination_form_item_options('source'), |
| 685 |
"#description" => t("Choose the database to restore to. Any database destinations you have created and any databases specified in your settings.php can be restored to."), |
"#description" => t("Choose the database to restore to. Any database destinations you have created and any databases specified in your settings.php can be restored to."), |
| 686 |
"#default_value" => 'db_url:default', |
"#default_value" => 'db_url:default', |
| 796 |
|
|
| 797 |
$file = backup_migrate_filters_backup($file, $settings); |
$file = backup_migrate_filters_backup($file, $settings); |
| 798 |
if (!$file) { |
if (!$file) { |
| 799 |
_backup_migrate_temp_files_delete(); |
backup_migrate_cleanup(); |
| 800 |
return FALSE; |
return FALSE; |
| 801 |
} |
} |
| 802 |
|
|
| 808 |
|
|
| 809 |
backup_migrate_backup_succeed("Site backed up successfully.", array(), $settings); |
backup_migrate_backup_succeed("Site backed up successfully.", array(), $settings); |
| 810 |
// Delete any temporary files we've created. |
// Delete any temporary files we've created. |
| 811 |
_backup_migrate_temp_files_delete(); |
backup_migrate_cleanup(); |
| 812 |
return $file; |
return $file; |
| 813 |
} |
} |
| 814 |
|
|
| 831 |
$file = backup_migrate_destination_get_file($destination_id, $file_id); |
$file = backup_migrate_destination_get_file($destination_id, $file_id); |
| 832 |
if (!$file) { |
if (!$file) { |
| 833 |
_backup_migrate_message("Could not restore because the file could not be loaded from the destination.", array(), 'error'); |
_backup_migrate_message("Could not restore because the file could not be loaded from the destination.", array(), 'error'); |
| 834 |
_backup_migrate_temp_files_delete(); |
backup_migrate_cleanup(); |
| 835 |
return FALSE; |
return FALSE; |
| 836 |
} |
} |
| 837 |
|
|
| 839 |
$file = backup_migrate_filters_restore($file); |
$file = backup_migrate_filters_restore($file); |
| 840 |
if (!$file) { |
if (!$file) { |
| 841 |
// No error as filters should take care of that themselves. |
// No error as filters should take care of that themselves. |
| 842 |
_backup_migrate_temp_files_delete(); |
backup_migrate_cleanup(); |
| 843 |
return FALSE; |
return FALSE; |
| 844 |
} |
} |
| 845 |
|
|
| 852 |
else { |
else { |
| 853 |
_backup_migrate_message("Could not restore the database.", array(), 'error'); |
_backup_migrate_message("Could not restore the database.", array(), 'error'); |
| 854 |
} |
} |
| 855 |
_backup_migrate_temp_files_delete(); |
backup_migrate_cleanup(); |
| 856 |
return FALSE; |
return FALSE; |
| 857 |
} |
} |
| 858 |
|
|
| 885 |
} |
} |
| 886 |
|
|
| 887 |
// Delete any temp files we've created. |
// Delete any temp files we've created. |
| 888 |
_backup_migrate_temp_files_delete(); |
backup_migrate_cleanup(); |
| 889 |
return $num; |
return $num; |
| 890 |
} |
} |
| 891 |
|
|