You are here

function _backup_migrate_clean_filename in Backup and Migrate 6

Same name and namespace in other branches
  1. 8.3 includes/files.inc \_backup_migrate_clean_filename()
  2. 5.2 includes/files.inc \_backup_migrate_clean_filename()
  3. 5 backup_migrate.module \_backup_migrate_clean_filename()
  4. 6.3 includes/files.inc \_backup_migrate_clean_filename()
  5. 7.3 includes/files.inc \_backup_migrate_clean_filename()

Construct a default filename using token and some cleaning.

2 calls to _backup_migrate_clean_filename()
_backup_migrate_default_file_name in ./backup_migrate.module
Construct a default filename using the site's name.
_backup_migrate_dump_tables in ./backup_migrate.module
Build the database dump file. Takes a list of tables to exclude and some formatting options.

File

./backup_migrate.module, line 1195
Create (manually or scheduled) and restore backups of your Drupal MySQL database with an option to exclude table data (f.e. cache_*)

Code

function _backup_migrate_clean_filename($filename) {
  if (module_exists('token') && function_exists('token_replace')) {
    $filename = token_replace($filename, 'global');
  }
  $filename = preg_replace("/[^a-zA-Z0-9\\.\\-_]/", "", $filename);
  if (strlen($filename) > 50) {
    $filename = drupal_substr($filename, 0, 50);
  }
  if (strlen($filename) == 0) {
    $filename = 'untitled';
  }
  return $filename;
}