Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
services
t3o sites
typo3.org
typo3.org
Commits
bf420523
Commit
bf420523
authored
Jun 02, 2021
by
Thomas Löffler
Browse files
Add CLI output and flushing caches on start page
parent
3860ed32
Pipeline
#12125
failed with stages
in 1 minute and 46 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
extensions/t3org_layout/Classes/Command/FetchPlatinumMembersCommand.php
View file @
bf420523
...
...
@@ -4,7 +4,9 @@ namespace T3o\T3orgLayout\Command;
use
Symfony\Component\Console\Command\Command
;
use
Symfony\Component\Console\Input\InputInterface
;
use
Symfony\Component\Console\Output\OutputInterface
;
use
Symfony\Component\Console\Style\SymfonyStyle
;
use
T3o\T3orgLayout\Service\FetchMembersService
;
use
TYPO3\CMS\Core\Cache\CacheManager
;
use
TYPO3\CMS\Core\Configuration\ExtensionConfiguration
;
use
TYPO3\CMS\Core\Database\ConnectionPool
;
use
TYPO3\CMS\Core\Database\Query\QueryBuilder
;
...
...
@@ -29,10 +31,28 @@ class FetchPlatinumMembersCommand extends Command
$this
->
fetchMembersService
->
token
=
$this
->
extConfig
[
'BearerToken'
];
}
protected
function
execute
(
InputInterface
$input
,
OutputInterface
$output
)
protected
function
execute
(
InputInterface
$input
,
OutputInterface
$output
)
:
int
{
$io
=
new
SymfonyStyle
(
$input
,
$output
);
$io
->
title
(
'Importing platinum members via API from my.typo3.org'
);
if
(
!
$this
->
extConfig
[
'BearerToken'
])
{
$io
->
error
(
'No token for authentication to API found!'
);
return
1
;
}
$io
->
section
(
'Fetching members...'
);
$members
=
$this
->
fetchMembersService
->
getPlatinumMembers
();
if
(
$members
)
{
$io
->
success
(
'Found '
.
sizeof
(
$members
)
.
' platinum members'
);
}
else
{
$io
->
warning
(
'No members found. Please check the settings and API.'
);
return
1
;
}
$io
->
section
(
'Importing members...'
);
$this
->
queryBuilder
->
update
(
'tx_randombanners_domain_model_banner'
)
->
where
(
...
...
@@ -43,6 +63,7 @@ class FetchPlatinumMembersCommand extends Command
$this
->
queryBuilder
=
$this
->
queryBuilder
->
getConnection
()
->
createQueryBuilder
();
$warnings
=
false
;
foreach
(
$members
as
$member
)
{
$this
->
queryBuilder
=
$this
->
queryBuilder
->
getConnection
()
->
createQueryBuilder
();
$this
->
queryBuilder
...
...
@@ -99,6 +120,28 @@ class FetchPlatinumMembersCommand extends Command
->
set
(
'tstamp'
,
time
())
->
execute
();
}
if
(
!
$member
[
'logo'
]
||
!
$member
[
'backlink'
])
{
$io
->
warning
(
'Logo or backlink missing for member: '
.
$member
[
'name'
]);
$warnings
=
true
;
}
$io
->
success
(
'Imported platinum member: '
.
$member
[
'name'
]);
}
$io
->
section
(
'Flushing caches on page with UID 1'
);
// Flush caches on page ID 1
GeneralUtility
::
makeInstance
(
CacheManager
::
class
)
->
flushCachesInGroupByTags
(
'pages'
,
[
'pageId_1'
]
);
if
(
$warnings
)
{
$io
->
warning
(
'Finished with warnings.'
);
}
else
{
$io
->
success
(
'Finished.'
);
}
return
0
;
}
}
extensions/t3org_layout/Configuration/TypoScript/Cache.typoscript
View file @
bf420523
...
...
@@ -72,4 +72,7 @@ config.cache {
544 := addToList(tx_news_domain_model_news:470)
544 := addToList(tx_news_domain_model_news:474)
544 := addToList(tx_news_domain_model_news:475)
# Platinum members
1 := addToList(tx_randombanners_domain_model_banner:425)
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment