You are here

function backup_migrate_exec in Backup and Migrate 8.2

Same name and namespace in other branches
  1. 8.3 backup_migrate.module \backup_migrate_exec()
  2. 6.3 backup_migrate.module \backup_migrate_exec()
  3. 7.3 backup_migrate.module \backup_migrate_exec()
  4. 7.2 backup_migrate.module \backup_migrate_exec()

Execute a command line command. Returns false if the function failed.

1 call to backup_migrate_exec()
backup_migrate_destination_db_mysql::_backup_db_to_file_mysqldump in includes/destinations.db.mysql.inc
Backup the databases to a file using the mysqldump command.

File

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

Code

function backup_migrate_exec($command, $args = array()) {
  if (!function_exists('exec') || ini_get('safe_mode')) {
    return FALSE;
  }

  // Escape the arguments
  foreach ($args as $key => $arg) {
    $args[$key] = escapeshellarg($arg);
  }
  $command = strtr($command, $args);
  $output = $result = NULL;

  // Run the command.
  exec($command . ' 2>&1', $output, $result);
  return $result == 0;
}