Skip to content

Commit

Permalink
[RELEASE] 1.6.1
Browse files Browse the repository at this point in the history
- Fix usage of no longer working API url
- Fix composer dependencies for TYPO3 9 LTS
  • Loading branch information
pascal20997 committed Nov 22, 2018
1 parent 013a5f0 commit b1f5710
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 103 deletions.
84 changes: 0 additions & 84 deletions Classes/Configuration/ExtConf.php

This file was deleted.

10 changes: 2 additions & 8 deletions Classes/Hooks/DataHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* The TYPO3 project - inspiring people to share!
*/

use JWeiland\Avalex\Configuration\ExtConf;
use JWeiland\Avalex\Utility\ApiUtility;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Messaging\FlashMessageQueue;
use TYPO3\CMS\Core\Messaging\FlashMessageService;
Expand All @@ -31,11 +31,6 @@ class DataHandler
*/
protected $flashMessageQueue;

/**
* @var string
*/
protected $apiBaseUrl = '';

/**
* Check API keys on save
*
Expand All @@ -59,7 +54,6 @@ public function processDatamap_preProcessFieldArray(
/** @var FlashMessageService $flashMessageService */
$flashMessageService = $objectManager->get('TYPO3\\CMS\Core\\Messaging\\FlashMessageService');
$this->flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
$this->apiBaseUrl = ExtConf::getInstance()->getApiBaseUrl();
if (!$this->checkApiKey($incomingFieldArray['api_key'])) {
// prevent save because key is invalid
unset($incomingFieldArray['api_key']);
Expand All @@ -76,7 +70,7 @@ protected function checkApiKey($apiKey)
{
$isValid = true;
$apiKey = (string)$apiKey;
$response = @file_get_contents($this->apiBaseUrl . 'api_keys/is_configured.json?apikey=' . $apiKey);
$response = @file_get_contents(ApiUtility::getApiUrl() . 'api_keys/is_configured.json?apikey=' . $apiKey);
$responseArray = json_decode($response, true);
if ($responseArray && array_key_exists('message', $responseArray) && $responseArray['message'] === 'OK') {
// API key valid
Expand Down
9 changes: 2 additions & 7 deletions Classes/Task/ImporterTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* The TYPO3 project - inspiring people to share!
*/

use JWeiland\Avalex\Configuration\ExtConf;
use JWeiland\Avalex\Domain\Repository\AvalexConfigurationRepository;
use JWeiland\Avalex\Domain\Repository\LegalTextRepository;
use JWeiland\Avalex\Utility\ApiUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Scheduler\Task\AbstractTask;

Expand All @@ -40,11 +40,6 @@ class ImporterTask extends AbstractTask
public function execute()
{
$this->init();
$apiBaseURL = ExtConf::getInstance()->getApiBaseUrl();
if (!$apiBaseURL) {
return false;
}

$configurations = $this->avalexConfigurationRepository->findAll();
foreach ($configurations as $configuration) {
$configurationUid = (int)$configuration['uid'];
Expand All @@ -58,7 +53,7 @@ public function execute()
return false;
}

$legalText = @file_get_contents($apiBaseURL . 'datenschutzerklaerung?apikey=' . $apiKey);
$legalText = @file_get_contents(ApiUtility::getApiUrl() . 'datenschutzerklaerung?apikey=' . $apiKey);
if (!$this->checkResponse($legalText)) {
return false;
}
Expand Down
36 changes: 36 additions & 0 deletions Classes/Utility/ApiUtility.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
namespace JWeiland\Avalex\Utility;

/*
* This file is part of the avalex project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/

/**
* Class ApiUtility
*/
class ApiUtility
{
/**
* @var string
*/
protected static $apiUrl = 'https://avalex.de/';

/**
* Returns the API url with trailing slash
*
* @return string
*/
public static function getApiUrl()
{
return self::$apiUrl;
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"source": "https://github.com/jweiland-net/avalex"
},
"require": {
"typo3/cms-core": ">=6.2,<=9.5"
"typo3/cms-core": "^6.2 || ^7.6 || ^8.7 || ^9.5"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 0 additions & 2 deletions ext_conf_template.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
# cat=API/enable/22; type=string; label=API Base Url
apiBaseUrl = https://beta.avalex.de/
# cat=API/enable/23; type=string; label=API key field (deprecated):Just there for compatibility! Please don´t fill in.
apiKey =
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
'uploadfolder' => false,
'createDirs' => '',
'clearCacheOnLoad' => 0,
'version' => '6.1.0',
'version' => '6.1.1',
'constraints' =>
array(
'depends' =>
Expand Down

0 comments on commit b1f5710

Please sign in to comment.