1bfd5083cSGreg Roach<?php 2bfd5083cSGreg Roach 3bfd5083cSGreg Roach/** 4bfd5083cSGreg Roach * webtrees: online genealogy 5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team 6bfd5083cSGreg Roach * This program is free software: you can redistribute it and/or modify 7bfd5083cSGreg Roach * it under the terms of the GNU General Public License as published by 8bfd5083cSGreg Roach * the Free Software Foundation, either version 3 of the License, or 9bfd5083cSGreg Roach * (at your option) any later version. 10bfd5083cSGreg Roach * This program is distributed in the hope that it will be useful, 11bfd5083cSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 12bfd5083cSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13bfd5083cSGreg Roach * GNU General Public License for more details. 14bfd5083cSGreg Roach * You should have received a copy of the GNU General Public License 15bfd5083cSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>. 16bfd5083cSGreg Roach */ 17bfd5083cSGreg Roach 18bfd5083cSGreg Roachdeclare(strict_types=1); 19bfd5083cSGreg Roach 20bfd5083cSGreg Roachnamespace Fisharebest\Webtrees\Http\RequestHandlers; 21bfd5083cSGreg Roach 22bfd5083cSGreg Roachuse Fisharebest\Webtrees\Registry; 23bfd5083cSGreg Roachuse Fisharebest\Webtrees\Services\UpgradeService; 24bfd5083cSGreg Roachuse Psr\Http\Message\ResponseInterface; 25bfd5083cSGreg Roachuse Psr\Http\Message\ServerRequestInterface; 26bfd5083cSGreg Roachuse Psr\Http\Server\RequestHandlerInterface; 27bfd5083cSGreg Roach 28bfd5083cSGreg Roach/** 29bfd5083cSGreg Roach * Check for a new version of webtrees. 30bfd5083cSGreg Roach */ 31bfd5083cSGreg Roachclass CheckForNewVersionNow implements RequestHandlerInterface 32bfd5083cSGreg Roach{ 33bfd5083cSGreg Roach private UpgradeService $upgrade_service; 34bfd5083cSGreg Roach 35bfd5083cSGreg Roach /** 36bfd5083cSGreg Roach * @param UpgradeService $upgrade_service 37bfd5083cSGreg Roach */ 38bfd5083cSGreg Roach public function __construct(UpgradeService $upgrade_service) 39bfd5083cSGreg Roach { 40bfd5083cSGreg Roach $this->upgrade_service = $upgrade_service; 41bfd5083cSGreg Roach } 42bfd5083cSGreg Roach 43bfd5083cSGreg Roach /** 44bfd5083cSGreg Roach * @param ServerRequestInterface $request 45bfd5083cSGreg Roach * 46bfd5083cSGreg Roach * @return ResponseInterface 47bfd5083cSGreg Roach */ 48bfd5083cSGreg Roach public function handle(ServerRequestInterface $request): ResponseInterface 49bfd5083cSGreg Roach { 50bfd5083cSGreg Roach $this->upgrade_service->isUpgradeAvailable(true); 51bfd5083cSGreg Roach 52bfd5083cSGreg Roach return Registry::responseFactory()->response(); 53bfd5083cSGreg Roach } 54bfd5083cSGreg Roach} 55