<?php
/**
 * Akeeba Backup Restoration Script
 *
 * @package   brs
 * @copyright Copyright (c)2024-2026 Nicholas K. Dionysopoulos / Akeeba Ltd
 * @license   GNU General Public License version 3, or later
 */

namespace Akeeba\BRS\Platform\View\Database;

defined('_AKEEBA') or die();

use Akeeba\BRS\View\Database\Html as CoreDatabaseHtml;

/**
 * View controller for the Database view for WordPress sites.
 *
 * @since  10.0
 */
class Html extends CoreDatabaseHtml
{
	/**
	 * The database technology of the current database dump.
	 *
	 * @var   string|null
	 * @since 10.0
	 */
	public $dbtech = null;

	public function onBeforeMain(): bool
	{
		/** @var \Akeeba\BRS\Model\Database $model */
		$model    = $this->getModel();
		$this->db = $model->getDatabaseInfo($this->key);

		// WordPress does not support PostgreSQL databases
		if ($this->db->dbtech === 'postgresql')
		{
			$this->dbtech = $this->db->dbtech;
			$this->setLayout('postgresql_unsupported');

			$this->addButtonPreviousStep();

			return true;
		}

		// Fall through to the core Database View behaviour
		return parent::onBeforeMain();
	}
}
