name = __('Database export'); $this->task = __('Download database of current blog'); $this->export_name = html::escapeHTML($this->core->blog->id.'-backup.txt'); $this->export_type = 'export_blog'; } public function execute() { // Create zip file if (!empty($_POST['file_name'])) { // This process make an http redirect $ie = new maintenanceDcExportFlat($this->core); $ie->setURL($this->id); $ie->process($this->export_type); } // Go to step and show form else { return 1; } } public function step() { // Download zip file if (isset($_SESSION['export_file']) && file_exists($_SESSION['export_file'])) { // Log task execution here as we sent file and stop script $this->log(); // This process send file by http and stop script $ie = new maintenanceDcExportFlat($this->core); $ie->setURL($this->id); $ie->process('ok'); } else { return '
'. form::field('file_name', 50, 255, date('Y-m-d-H-i-').$this->export_name). '
'. ''. '
'; } } } class ieMaintenanceExportfull extends dcMaintenanceTask { protected $tab = 'backup'; protected $group = 'zipfull'; protected $export_name; protected $export_type; protected function init() { $this->name = __('Database export'); $this->task = __('Download database of all blogs'); $this->export_name = 'dotclear-backup.txt'; $this->export_type = 'export_all'; } public function execute() { // Create zip file if (!empty($_POST['file_name'])) { // This process make an http redirect $ie = new maintenanceDcExportFlat($this->core); $ie->setURL($this->id); $ie->process($this->export_type); } // Go to step and show form else { return 1; } } public function step() { // Download zip file if (isset($_SESSION['export_file']) && file_exists($_SESSION['export_file'])) { // Log task execution here as we sent file and stop script $this->log(); // This process send file by http and stop script $ie = new maintenanceDcExportFlat($this->core); $ie->setURL($this->id); $ie->process('ok'); } else { return ''. form::field('file_name', 50, 255, date('Y-m-d-H-i-').$this->export_name). '
'. ''. '
'; } } } class maintenanceDcExportFlat extends dcExportFlat { /** * Set redirection URL of bakcup process. * * Bad hack to change redirection of dcExportFlat::process() * * @param id string Task id */ public function setURL($id) { $this->url = sprintf('plugin.php?p=maintenance&task=%s', $id); } }