HEX
Server: Apache/2
System: Linux host.jethost.pl 4.19.0-26-amd64 #1 SMP Debian 4.19.304-1 (2024-01-09) x86_64
User: frigodor (1049)
PHP: 7.4.33
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname,mail
Upload Files
File: /home/frigodor/public_html/wp-content/plugins/search-and-replace/inc/Page/BackupDatabase.php
<?php
namespace Inpsyde\SearchReplace\Page;

use Inpsyde\SearchReplace\Database;
use Inpsyde\SearchReplace\FileDownloader;

/**
 * Class BackupDatabase
 *
 * @package Inpsyde\SearchReplace\Page
 */
class BackupDatabase extends AbstractPage implements PageInterface {

	/**
	 * @var Database\Exporter
	 */
	private $dbe;

	/**
	 * @var FileDownloader
	 */
	private $downloader;

	/**
	 * BackupDatabase constructor.
	 *
	 * @param Database\Exporter $dbe
	 * @param FileDownloader    $downloader
	 */
	public function __construct( Database\Exporter $dbe, FileDownloader $downloader ) {

		$this->dbe        = $dbe;
		$this->downloader = $downloader;
	}

	/**
	 * @return string
	 */
	public function get_page_title() {

		return esc_html__( 'Backup Database', 'search-and-replace' );
	}

	/**
	 * Return the static slug string.
	 *
	 * @return string
	 */
	public function get_slug() {

		return 'backup-database';
	}

	/**
	 * Shows the page template
	 */
	public function render() {

		require_once( __DIR__ . '/../templates/db-backup.php' );
	}

	/**
	 * @return string
	 */
	protected function get_submit_button_title() {

		return esc_html__( 'Create SQL File', 'search-and-replace' );
	}

	/**
	 * Event handler for click on export sql button
	 */
	public function save() {

		$report = $this->dbe->db_backup();
		$this->downloader->show_modal( $report );

		return TRUE;
	}

}