-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from WapplerSystems/release/v12-dev
Release/v12 dev
- Loading branch information
Showing
3 changed files
with
66 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
namespace WapplerSystems\ZabbixClient\Operation; | ||
|
||
/** | ||
* This file is part of the "zabbix_client" Extension for TYPO3 CMS. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
*/ | ||
|
||
use TYPO3\CMS\Core\SingletonInterface; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
use TYPO3\CMS\Install\Service\Exception\RemoteFetchException; | ||
use WapplerSystems\ZabbixClient\Attribute\MonitoringOperation; | ||
use WapplerSystems\ZabbixClient\OperationResult; | ||
use WapplerSystems\ZabbixClient\Service\CoreVersionService; | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
#[MonitoringOperation('GetSupportState')] | ||
class GetSupportState implements IOperation, SingletonInterface | ||
{ | ||
|
||
/** | ||
* | ||
* @param array $parameter None | ||
* @return OperationResult | ||
*/ | ||
public function execute($parameter = []): OperationResult | ||
{ | ||
|
||
/** @var CoreVersionService $coreVersionService */ | ||
$coreVersionService = GeneralUtility::makeInstance(CoreVersionService::class); | ||
|
||
// No updates for development versions | ||
if (!$coreVersionService->isInstalledVersionAReleasedVersion()) { | ||
return new OperationResult(true, ''); | ||
} | ||
|
||
try { | ||
$versionMaintenanceWindow = $coreVersionService->getMaintenanceWindow(); | ||
} catch (RemoteFetchException $remoteFetchException) { | ||
return new OperationResult(false, false); | ||
} | ||
|
||
if ($versionMaintenanceWindow->isSupportedByCommunity()) { | ||
return new OperationResult(true, 'community'); | ||
} | ||
|
||
if ($versionMaintenanceWindow->isSupportedByElts()) { | ||
return new OperationResult(true, 'elts'); | ||
} | ||
return new OperationResult(true, 'outdated'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters