63 lines
2.0 KiB
PHP
63 lines
2.0 KiB
PHP
<?php
|
||
require_once($_SERVER['DOCUMENT_ROOT'] . "/config.php");
|
||
|
||
ini_set('display_errors', 1);
|
||
error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE);
|
||
|
||
// закрываем доступ на выполнение запросов
|
||
if (!isset($_SESSION['superadmin'])) {
|
||
header("location:/index.php");
|
||
die("Доступ запрещён!");
|
||
}
|
||
|
||
include $_SERVER['DOCUMENT_ROOT'] . '/import/ImporterService.php';
|
||
include $_SERVER['DOCUMENT_ROOT'] . '/import/ImportReport.php';
|
||
|
||
if (isset($_GET['run']) && $_GET['run'] == 1) {
|
||
(new ImporterService())->setForceImport(1);
|
||
header("location:/admin/import.php");
|
||
}
|
||
|
||
$importerService = new ImporterService();
|
||
|
||
$willBeRun = $importerService->isForceStart();
|
||
$isImporterActive = $importerService->isActive();
|
||
|
||
require_once($_SERVER['DOCUMENT_ROOT'] . "/templates/header-admin.php");
|
||
?>
|
||
<div class="main-title">
|
||
<h1>Выгрузка</h1>
|
||
</div>
|
||
<br/>
|
||
<div class="users">
|
||
<?php if ($willBeRun && !$isImporterActive):?>
|
||
<div style="color: red;">Выгрузка будет запущена в ближайшие 5 минут.</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if ($isImporterActive):?>
|
||
<div style="color: red;">В данный момент работает выгрузка.</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if (!$willBeRun && !$isImporterActive) { ?>
|
||
<div>
|
||
<a href="/admin/import.php?run=1" class="medium-button runImport" >Запустить выгрузку</a>
|
||
</div>
|
||
<?php } ?>
|
||
|
||
<br/>
|
||
<br/>
|
||
|
||
<div>Логи за последние 2 недели:</div>
|
||
|
||
<br/>
|
||
|
||
<ul style="list-style: inside; line-height: 2;">
|
||
<?php foreach(ImportReport::getList() as $ts => $file): ?>
|
||
<li><a target="_blank" href="https://joywork.ru/import/reports/<?php echo $file; ?>"><?php echo date('H:i d-m-y', $ts); ?></a></li>
|
||
<?php endforeach; ?>
|
||
</ul>
|
||
</div>
|
||
|
||
<?php
|
||
require_once($_SERVER['DOCUMENT_ROOT'] . "/templates/footer-admin.php");
|
||
?>
|