Skip to content

Commit

Permalink
[TASK] remove usage of deprecated classes and functions. Log error if…
Browse files Browse the repository at this point in the history
… not possible to write to realurl config, instead of throwing exception
  • Loading branch information
anjeylink authored and dmh committed Dec 4, 2018
1 parent f4c9e02 commit 217d628
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 44 deletions.
3 changes: 2 additions & 1 deletion Classes/DataProcessing/FlexFormProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* The TYPO3 project - inspiring people to share!
*/

use TYPO3\CMS\Core\Service\FlexFormService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
use TYPO3\CMS\Frontend\ContentObject\DataProcessorInterface;
Expand Down Expand Up @@ -56,7 +57,7 @@ public function process(ContentObjectRenderer $cObj, array $contentObjectConfigu
$fieldName = $cObj->stdWrapValue('fieldName', $processorConfiguration, 'pi_flexform');

// parse flexform
$flexformService = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Service\\FlexFormService');
$flexformService = GeneralUtility::makeInstance(FlexFormService::class);
$processedData[$targetVariableName] = $flexformService->convertFlexFormContentToArray($cObj->data[$fieldName]);

// if targetvariable is settings, try to merge it with contentObjectConfiguration['settings.']
Expand Down
51 changes: 20 additions & 31 deletions Classes/Utility/FixedPostVarsConfigurationUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace T3kit\themeT3kit\Utility;

use Doctrine\DBAL\Query\QueryBuilder;
use Psr\Log\LoggerAwareTrait;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\DatabaseConnection;
Expand All @@ -16,6 +17,7 @@
*/
class FixedPostVarsConfigurationUtility
{
use LoggerAwareTrait;

/**
* Update configuration file of fixed post vars
Expand All @@ -27,9 +29,8 @@ public function updateConfiguration()
$filePath = $this->getSaveFilePath();

if (!$this->canWriteConfiguration($filePath)) {
throw new \RuntimeException(
$filePath . ' is not writable.',
1485349703
$this->logger->error(
'Could not write realurl configuration to file "' . $filePath . '"'
);
}

Expand Down Expand Up @@ -146,35 +147,23 @@ protected function getFixedPagesUids()
{
$field = 'tx_themet3kit_fixed_post_var_conf';

if (version_compare(TYPO3_version, '8.0', '<')) {
/** @var DatabaseConnection $dbConnection */
$dbConnection = $GLOBALS['TYPO3_DB'];

$pages = $dbConnection->exec_SELECTgetRows(
'uid, ' . $field,
'pages',
$field . ' != \'0\' AND ' . $field . ' != \'\''
. BackendUtility::deleteClause('pages')
);
} else {
/** @var QueryBuilder $queryBuilder */
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
$pages = $queryBuilder
->select('uid', 'tx_themet3kit_fixed_post_var_conf')
->from('pages')
->where(
$queryBuilder->expr()->neq(
$field,
$queryBuilder->createNamedParameter('')
),
$queryBuilder->expr()->neq(
$field,
$queryBuilder->createNamedParameter('0')
)
/** @var QueryBuilder $queryBuilder */
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
$pages = $queryBuilder
->select('uid', 'tx_themet3kit_fixed_post_var_conf')
->from('pages')
->where(
$queryBuilder->expr()->neq(
$field,
$queryBuilder->createNamedParameter('')
),
$queryBuilder->expr()->neq(
$field,
$queryBuilder->createNamedParameter('0')
)
->execute()
->fetchAll();
}
)
->execute()
->fetchAll();

return $pages;
}
Expand Down
9 changes: 3 additions & 6 deletions Classes/Utility/HelperUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

namespace T3kit\themeT3kit\Utility;

use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Messaging\FlashMessageQueue;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Lang\LanguageService;
use TYPO3\CMS\Core\Localization\LanguageService;

/**
* Class MainUtility
Expand All @@ -29,11 +30,7 @@ class HelperUtility
public static function getExtConf()
{
if (self::$extConf === null) {
if (isset($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['theme_t3kit'])) {
self::$extConf = unserialize((string)$GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['theme_t3kit']);
} else {
self::$extConf = [];
}
self::$extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('theme_t3kit') ?: [];
}

return self::$extConf;
Expand Down
2 changes: 1 addition & 1 deletion Classes/ViewHelpers/ContentEditableViewHelper.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 TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;

Expand Down
4 changes: 3 additions & 1 deletion Classes/ViewHelpers/Link/TelViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* The TYPO3 project - inspiring people to share!
*/

use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper;

/**
* Tel link view helper.
* Generates an tel link
Expand All @@ -28,7 +30,7 @@
* <a href="tel:+464001234567">+46 (0) 40-01 ma 23 45 67</a>
* </output>
*/
class TelViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper
class TelViewHelper extends AbstractTagBasedViewHelper
{
/**
* @var string
Expand Down
5 changes: 2 additions & 3 deletions Classes/ViewHelpers/RegisterViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
* The TYPO3 project - inspiring people to share!
*/

use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3\CMS\Fluid\Core\ViewHelper\Facets\CompilableInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;

Expand All @@ -26,7 +25,7 @@
* @subpackage
* @author Markus Goldbach <markus.goldbach@dkd.de>
*/
class RegisterViewHelper extends AbstractViewHelper implements CompilableInterface
class RegisterViewHelper extends AbstractViewHelper
{
use CompileWithRenderStatic;

Expand Down
4 changes: 3 additions & 1 deletion Classes/ViewHelpers/Render/SvgViewHelper.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
namespace T3kit\themeT3kit\ViewHelpers\Render;

use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;

/***************************************************************
*
* Copyright notice
Expand All @@ -25,7 +27,7 @@
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
class SvgViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper
class SvgViewHelper extends AbstractViewHelper
{

/**
Expand Down

0 comments on commit 217d628

Please sign in to comment.