function _backup_migrate_clean_filename in Backup and Migrate 5
Same name and namespace in other branches
- 8.3 includes/files.inc \_backup_migrate_clean_filename()
- 5.2 includes/files.inc \_backup_migrate_clean_filename()
- 6.3 includes/files.inc \_backup_migrate_clean_filename()
- 6 backup_migrate.module \_backup_migrate_clean_filename()
- 7.3 includes/files.inc \_backup_migrate_clean_filename()
Construct a default filename using token and some cleaning.
3 calls to _backup_migrate_clean_filename()
- BackupMigrateUnitTest::testCleanFileName in tests/
BackupMigrateUnitTest.test - _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 1212 - 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;
}