/** * Hook into the actions fired in HM Backup and set the status * * @param $action */ protected function do_action($action) { // Pass the actions to all the services foreach (HMBKP_Services::get_services($this) as $service) { $service->action($action); } // Fire the parent function as well parent::do_action($action); switch ($action) { case 'hmbkp_mysqldump_started': $this->set_status(sprintf(__('Dumping Database %s', 'backupwordpress'), '(<code>' . $this->get_mysqldump_method() . '</code>)')); break; case 'hmbkp_mysqldump_verify_started': $this->set_status(sprintf(__('Verifying Database Dump %s', 'backupwordpress'), '(<code>' . $this->get_mysqldump_method() . '</code>)')); break; case 'hmbkp_archive_started': $this->set_status(sprintf(__('Creating zip archive %s', 'backupwordpress'), '(<code>' . $this->get_archive_method() . '</code>)')); break; case 'hmbkp_archive_verify_started': $this->set_status(sprintf(__('Verifying Zip Archive %s', 'backupwordpress'), '(<code>' . $this->get_archive_method() . '</code>)')); break; case 'hmbkp_backup_complete': $this->set_status(__('Finishing Backup', 'backupwordpress')); $this->update_average_schedule_run_time($this->get_schedule_running_start_time(), time()); break; case 'hmbkp_error': if ($this->get_errors()) { $file = $this->get_path() . '/.backup_errors'; if (file_exists($file)) { @unlink($file); } if (!($handle = @fopen($file, 'w'))) { return; } fwrite($handle, json_encode($this->get_errors())); fclose($handle); } break; case 'hmbkp_warning': if ($this->get_warnings()) { $file = $this->get_path() . '/.backup_warnings'; if (file_exists($file)) { @unlink($file); } if (!($handle = @fopen($file, 'w'))) { return; } fwrite($handle, json_encode($this->get_warnings())); fclose($handle); } break; } do_action('hmbkp_action_complete', $action, $this); }