function run($args, $options) { require_once dirname(__FILE__) . '/../../../main.inc.php'; require_once INCLUDE_DIR . 'class.export.php'; global $ost; $stream = $options['stream']; if ($options['compress']) { $stream = "compress.zlib://{$stream}"; } $stream = fopen($stream, 'w'); $x = new DatabaseExporter($stream); $x->dump($this->stderr); }
/** * @param void * * @return null * calls the file delivery in Class DatabaseExporter */ public function deliver_backup_file() { if (isset($_POST['action']) && 'download_file' === $_POST['action']) { $sql_file = ''; if (isset($_POST['sql_file'])) { $sql_file = $_POST['sql_file']; } $compress = FALSE; if (isset($_POST['compress'])) { $compress = $_POST['compress']; } // If file name contains path or does not end with '.sql' exit. $ext = strrchr($sql_file, '.'); if (FALSE !== strpos($sql_file, '/') || '.sql' !== $ext) { die; } $this->dbe->deliver_backup($sql_file, $compress); } }
/** * exportToFile * * @param string $file * * @return void */ public static function export($file) { $export = DatabaseExporter::exportAll(); file_put_contents($file, $export); }