public function dump($file = '') { $file_suffix = ''; $table_selection = $this->get_expanded_table_selection(); $file = $this->dumpFile($file); $cmd = $this->dumpCmd($table_selection); // Gzip the output from dump command(s) if requested. if (drush_get_option('gzip')) { $cmd .= ' | gzip -f'; $file_suffix .= '.gz'; } if ($file) { $file .= $file_suffix; $cmd .= ' > ' . drush_escapeshellarg($file); } // Avoid the php memory of the $output array in drush_shell_exec(). if (!($return = drush_op_system($cmd))) { if ($file) { drush_log(dt('Database dump saved to !path', array('!path' => $file)), LogLevel::SUCCESS); drush_backend_set_result($file); } } else { return drush_set_error('DRUSH_SQL_DUMP_FAIL', 'Database dump failed'); } }
public function dump($file = '') { $table_selection = $this->get_expanded_table_selection(); $file = $this->dumpFile($file); list($cmd, $file) = $this->dumpCmd($table_selection, $file); list($cmd, $file) = $this->dumpGzip($cmd, $file); // Avoid the php memory of the $output array in drush_shell_exec(). if (!($return = drush_op_system($cmd))) { if ($file) { drush_log(dt('Database dump saved to !path', array('!path' => $file)), 'success'); drush_backend_set_result($file); } } else { return drush_set_error('DRUSH_SQL_DUMP_FAIL', 'Database dump failed'); } }