Skip to content

Commit

Permalink
Breaking change: Drop TYPO3 7LTS Support
Browse files Browse the repository at this point in the history
  • Loading branch information
cundd committed Feb 21, 2019
1 parent 81f2d43 commit 82c4fa2
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 343 deletions.
7 changes: 0 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ matrix:
- php: hhvm
- env: TYPO3=master DB=mysql

include:
# TYPO3 7.6
- php: 7.1
env: TYPO3=TYPO3_7-6 DB=mysql
- php: 7.2
env: TYPO3=TYPO3_7-6 DB=mysql

exclude:
# TYPO3 9 LTS with PHP 7.1
- php: 7.1
Expand Down
27 changes: 11 additions & 16 deletions Classes/Log/AbstractLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Cundd\Rest\Log;

use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Utility\GeneralUtility;

abstract class AbstractLogger extends \Psr\Log\AbstractLogger implements LoggerInterface
{
public function logRequest($message, array $data = [])
Expand All @@ -13,27 +16,19 @@ public function logRequest($message, array $data = [])
}
}

protected function getExtensionConfiguration($key)
public function logResponse($message, array $data = [])
{
// Read the configuration from the globals
static $configuration;
if (!$configuration) {
if (isset($GLOBALS['TYPO3_CONF_VARS'])
&& isset($GLOBALS['TYPO3_CONF_VARS']['EXT'])
&& isset($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'])
&& isset($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['rest'])
) {
$configuration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['rest']);
}
if ($this->getExtensionConfiguration('logResponse')) {
$this->debug($message, $data);
}

return isset($configuration[$key]) ? $configuration[$key] : null;
}

public function logResponse($message, array $data = [])
protected function getExtensionConfiguration($key)
{
if ($this->getExtensionConfiguration('logResponse')) {
$this->debug($message, $data);
try {
return GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('rest', $key);
} catch (\Exception $e) {
return null;
}
}

Expand Down
277 changes: 0 additions & 277 deletions Classes/VirtualObject/Persistence/Backend/V7Backend.php

This file was deleted.

25 changes: 3 additions & 22 deletions Classes/VirtualObject/Persistence/BackendFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
namespace Cundd\Rest\VirtualObject\Persistence;

use Cundd\Rest\VirtualObject\Persistence\Backend\DoctrineBackend;
use Cundd\Rest\VirtualObject\Persistence\Backend\V7Backend;
use Cundd\Rest\VirtualObject\Persistence\Backend\WhereClauseBuilder;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
Expand All @@ -18,27 +17,9 @@ abstract class BackendFactory
*/
public static function getBackend(): BackendInterface
{
if (false === static::getUseV7Backend()) {
/** @var ConnectionPool $connection */
$connection = GeneralUtility::makeInstance(ConnectionPool::class);
/** @var ConnectionPool $connection */
$connection = GeneralUtility::makeInstance(ConnectionPool::class);

return new DoctrineBackend($connection, new WhereClauseBuilder());
} else {
return new V7Backend($GLOBALS['TYPO3_DB']);
}
}

/**
* @return bool
*/
private static function getUseV7Backend()
{
if (!isset($GLOBALS['TYPO3_DB'])) {
return false;
}

$database = $GLOBALS['TYPO3_DB'];

return is_object($database) && $database instanceof \TYPO3\CMS\Core\Database\DatabaseConnection;
return new DoctrineBackend($connection, new WhereClauseBuilder());
}
}
20 changes: 0 additions & 20 deletions Tests/Functional/VirtualObject/Backend/V7BackendTest.php

This file was deleted.

Loading

0 comments on commit 82c4fa2

Please sign in to comment.