44 lines
958 B
PHP
44 lines
958 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace MageSail\Magesail\Block\Adminhtml\Nginx;
|
|
|
|
use Magento\Backend\Block\Template;
|
|
use Magento\Backend\Block\Template\Context;
|
|
use MageSail\Magesail\Model\NginxGlobalMapManager;
|
|
|
|
class Map extends Template
|
|
{
|
|
public function __construct(
|
|
Context $context,
|
|
private readonly NginxGlobalMapManager $nginxMapManager,
|
|
array $data = []
|
|
) {
|
|
parent::__construct($context, $data);
|
|
}
|
|
|
|
public function getMapFilePath(): ?string
|
|
{
|
|
return $this->nginxMapManager->getMapFilePath();
|
|
}
|
|
|
|
public function getMapContent(): string
|
|
{
|
|
try {
|
|
return $this->nginxMapManager->readMapFile();
|
|
} catch (\Exception) {
|
|
return '';
|
|
}
|
|
}
|
|
|
|
public function getMapUrl(): string
|
|
{
|
|
return $this->getUrl('*/*/map');
|
|
}
|
|
|
|
public function getFormKey(): string
|
|
{
|
|
return $this->formKey->getFormKey();
|
|
}
|
|
}
|