The module enables fine and no complains, but when I try and upload a *mysql.gz file using the restore feature Drupals file verification code seems to kick in and tells me it is not an allowed file extension.

This happens with Drupal 7 dev from July 4 and the current dev snapshot of Backup and Migrate.

Comments

tsvenson’s picture

Priority: Normal » Critical

Now tried with alpha 6 with the same error:

The specified file [archive name].mysql_.gz  could not be uploaded. Only files with the following extensions are allowed: jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp.

Also got this log message:

Location  http://nut/sites/all/modules/backup_migrate/backup_migrate.js?l5cu9j
Referrer  http://nut/admin/structure/backup_migrate
Message  sites/all/modules/backup_migrate/backup_migrate.js
Severity  warning
VladRM’s picture

StatusFileSize
new955 bytes

I confirm the issue.

We have backup_migrate.module @line 618:

function backup_migrate_ui_manual_restore_form_submit($form, &$form_state) {
  if ($file = file_save_upload('backup_migrate_restore_upload')) {
    backup_migrate_include('destinations');
    backup_migrate_perform_restore('upload', $file->uri, $form_state['values']);
  }
  $form_state['redirect'] = BACKUP_MIGRATE_MENU_PATH . '/restore';
}

I added a validator for file_save_upload:

function backup_migrate_ui_manual_restore_form_submit($form, &$form_state) {
  $validators = array(
    'file_validate_extensions' => array('gz zip sql'),
  );
  if ($file = file_save_upload('backup_migrate_restore_upload', $validators)) {
    backup_migrate_include('destinations');
    backup_migrate_perform_restore('upload', $file->uri, $form_state['values']);
  }
  $form_state['redirect'] = BACKUP_MIGRATE_MENU_PATH . '/restore';
}

The file extensions passed to the validator may be insufficient, please review.

VladRM’s picture

Status: Active » Needs review

Changed status to 'needs review'.

tim.plunkett’s picture

Title: Can't upload restore file with D7 deve from July 4 » Add .gz, .zip, and .sql as valid file extensions
StatusFileSize
new912 bytes

Multi-line arrays aren't necessary in this case (under 80 chars, only one element). See system_theme_settings_validate() for a core example.

Otherwise, looks great! Someone else please RTBC.

JeremyFrench’s picture

StatusFileSize
new917 bytes

I think you need mysql as well.

ronan’s picture

Status: Needs review » Fixed

Applied, Thanks all.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.