Skip to content

Commit

Permalink
Merge pull request TYPO3GmbH#9 from TYPO3GmbH/10lts
Browse files Browse the repository at this point in the history
[FEATURE] Create core v10 LTS compatibility
  • Loading branch information
helsner authored Jun 8, 2020
2 parents 6b1e0fb + 973c763 commit dd712b7
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ jobs:
typo3DatabaseHost: 127.0.0.1
typo3DatabaseName: t3func
typo3DatabasePassword: root
typo3DatabaseUsername: root
typo3DatabaseUsername: root
14 changes: 10 additions & 4 deletions Classes/Controller/QuerybuilderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Context\UserAspect;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Core\Http\JsonResponse;
use TYPO3\CMS\Core\Utility\GeneralUtility;

Expand All @@ -23,7 +24,6 @@
*/
class QuerybuilderController
{

/**
* @param ServerRequestInterface $request
* @param ResponseInterface $response
Expand All @@ -33,12 +33,13 @@ class QuerybuilderController
* @throws \TYPO3\CMS\Core\Context\Exception\AspectNotFoundException
* @throws \TYPO3\CMS\Core\Context\Exception\AspectPropertyNotFoundException
*/
public function ajaxSaveQuery(ServerRequestInterface $request, ResponseInterface $response) : ResponseInterface
public function ajaxSaveQuery(ServerRequestInterface $request): ResponseInterface
{
$result = new \stdClass();
$result->status = 'ok';

$requestParams = $request->getQueryParams();
/** @var \TYPO3\CMS\Core\Database\Query\QueryBuilder $queryBuilder */
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('sys_querybuilder');
$uid = (int)$requestParams['uid'];
Expand All @@ -65,6 +66,7 @@ public function ajaxSaveQuery(ServerRequestInterface $request, ResponseInterface
$result->uid = $uid;
}

$response = new JsonResponse();
$response->getBody()->write(json_encode($result));
return $response;
}
Expand All @@ -77,17 +79,21 @@ public function ajaxSaveQuery(ServerRequestInterface $request, ResponseInterface
* @throws \TYPO3\CMS\Core\Context\Exception\AspectNotFoundException
* @throws \TYPO3\CMS\Core\Context\Exception\AspectPropertyNotFoundException
*/
public function ajaxGetRecentQueries(ServerRequestInterface $request) : ResponseInterface
public function ajaxGetRecentQueries(ServerRequestInterface $request): ResponseInterface
{
$requestParams = $request->getQueryParams();
/** @var QueryBuilder $queryBuilder */
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
->getQueryBuilderForTable('sys_querybuilder');

$results = $queryBuilder
->select('uid', 'queryname', 'where_parts')
->from('sys_querybuilder')
->where(
$queryBuilder->expr()->eq('affected_table', $queryBuilder->createNamedParameter($requestParams['table'])),
$queryBuilder->expr()->eq(
'affected_table',
$queryBuilder->createNamedParameter($requestParams['table'])
),
$queryBuilder->expr()->eq('user', (int)$this->getBackendUserAspect()->get('id'))
)
->execute()
Expand Down
1 change: 1 addition & 0 deletions Classes/Factory/FilterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class FilterFactory
{
public function create(array $properties): Filter
{
/** @var Filter $entity */
$entity = GeneralUtility::makeInstance(Filter::class);
foreach ($properties as $property => $value) {
$method = 'set' . GeneralUtility::underscoredToUpperCamelCase($property);
Expand Down
1 change: 1 addition & 0 deletions Classes/Factory/PluginFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class PluginFactory
{
public function create(array $properties): Plugin
{
/** @var Plugin $entity */
$entity = GeneralUtility::makeInstance(Plugin::class);
foreach ($properties as $property => $value) {
$method = 'set' . GeneralUtility::underscoredToUpperCamelCase($property);
Expand Down
1 change: 1 addition & 0 deletions Classes/Factory/ValidationFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class ValidationFactory
{
public function create(array $properties): Validation
{
/** @var Validation $entity */
$entity = GeneralUtility::makeInstance(Validation::class);
foreach ($properties as $property => $value) {
$method = 'set' . GeneralUtility::underscoredToUpperCamelCase($property);
Expand Down
2 changes: 1 addition & 1 deletion Classes/Hooks/DatabaseRecordList.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function modifyQuery(
$request = $GLOBALS['TYPO3_REQUEST'];
$queryParams = $request->getQueryParams();
$route = $queryParams['route'] ?? '';
if (!empty($table) && $route === '/web/list/') {
if (!empty($table) && $route === '/module/web/list') {
$query = $queryParams['query'] ?? '';
if ($query !== null) {
$filter = json_decode($query);
Expand Down
2 changes: 1 addition & 1 deletion Classes/Hooks/PageRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function renderPreProcess(array $params): void
$queryParams = $request->getQueryParams();
$table = $queryParams['table'] ?? '';
$route = $queryParams['route'] ?? '';
if (!empty($table) && $route === '/web/list/') {
if (!empty($table) && $route === '/module/web/list') {
$pageRenderer = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Page\PageRenderer::class);

$pageRenderer->addInlineLanguageLabelFile('EXT:querybuilder/Resources/Private/Language/querybuilder-js.xlf');
Expand Down
1 change: 0 additions & 1 deletion Classes/Parser/QueryParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class QueryParser
/**
* @param stdClass $filterObject
* @param QueryBuilder $queryBuilderObject
*
* @param int $iteration
*
* @return QueryBuilder
Expand Down
13 changes: 4 additions & 9 deletions Configuration/TCA/sys_querybuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,17 @@
'showitem' => 'queryname, affected_table, where_parts, user'
],
],
'palettes' => [
'1' => [
'showitem' => 'queryname, affected_table, where_parts, user'
],
],
'columns' => [
'where_parts' => [
'exclude' => true,
'label' => 'where_parts',
'label' => 'Conditions (saved ad JSON)',
'config' => [
'type' => 'text',
],
],
'affected_table' => [
'exclude' => true,
'label' => 'affected_table',
'label' => 'Affected Table',
'config' => [
'type' => 'input',
'size' => 50,
Expand All @@ -47,7 +42,7 @@
],
'queryname' => [
'exclude' => true,
'label' => 'queryname',
'label' => 'Queryname',
'config' => [
'type' => 'input',
'size' => 50,
Expand All @@ -57,7 +52,7 @@
],
'user' => [
'exclude' => true,
'label' => 'userid',
'label' => 'User',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
Expand Down
4 changes: 2 additions & 2 deletions Documentation/Settings.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
; you can use in 'conf.py'

project = TYPO3 Querybuilder Extension
version = 10.0.x-dev
release = 10.0.x-dev
version = 10.4.0
release = 10.4.0
t3author = TYPO3 GmbH
copyright = since 2017 by TYPO3 GmbH

Expand Down
4 changes: 2 additions & 2 deletions Resources/Private/Language/querybuilder-js.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
<source>Override saved query?</source>
</trans-unit>
<trans-unit id="modal.cancel">
<source>cancel</source>
<source>Cancel</source>
</trans-unit>
<trans-unit id="modal.save">
<source>save</source>
<source>Save</source>
</trans-unit>
<trans-unit id="modal.success.headline">
<source>Query saved</source>
Expand Down
28 changes: 14 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@
"T3G\\Querybuilder\\Tests\\": "Tests/"
}
},
"config": {
"preferred-install": {
"t3g/*": "source",
"*": "dist"
},
"sort-packages": true,
"discard-changes": true,
"vendor-dir": ".build/vendor",
"bin-dir": ".build/bin"
},
"extra": {
"typo3/cms": {
"extension-key": "querybuilder",
Expand Down Expand Up @@ -54,23 +64,13 @@
]
},
"require": {
"php": "^7.2",
"php": ">=7.2.0",
"ext-json": "*",
"ext-pdo": "*",
"psr/http-message": "^1.0.0",
"typo3/cms-backend": "dev-master",
"typo3/cms-core": "dev-master",
"typo3/cms-recordlist": "dev-master"
},
"config": {
"preferred-install": {
"t3g/*": "source",
"*": "dist"
},
"sort-packages": true,
"discard-changes": true,
"vendor-dir": ".build/vendor",
"bin-dir": ".build/bin"
"typo3/cms-backend": "^10.1",
"typo3/cms-core": "^10.1",
"typo3/cms-recordlist": "^10.1"
},
"require-dev": {
"overtrue/phplint": "^1.1",
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
'clearCacheOnLoad' => 0,
'author' => 'TYPO3 GmbH',
'author_email' => 'info@typo3.com',
'version' => '10.1.x-dev',
'version' => '10.4.0',
'constraints' => [
'depends' => [
'typo3' => '10.0.0 - 10.5.99',
Expand Down
3 changes: 1 addition & 2 deletions ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@

// DatabaseRecordList hook to process the query
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList::class]['modifyQuery'][] =
\T3G\Querybuilder\Hooks\DatabaseRecordList::class;

\T3G\Querybuilder\Hooks\DatabaseRecordList::class;

0 comments on commit dd712b7

Please sign in to comment.