Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sg_youtube
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TYPO3
sg_youtube
Commits
e624ca46
Commit
e624ca46
authored
2 years ago
by
Kevin von Spiczak
Browse files
Options
Downloads
Patches
Plain Diff
[WIP] switch to caching framework
parent
64234d7d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!8
Feature cw 428 caching framework
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Classes/Service/YoutubeService.php
+14
-1
14 additions, 1 deletion
Classes/Service/YoutubeService.php
Configuration/Services.yaml
+7
-0
7 additions, 0 deletions
Configuration/Services.yaml
ext_localconf.php
+2
-0
2 additions, 0 deletions
ext_localconf.php
with
23 additions
and
1 deletion
Classes/Service/YoutubeService.php
+
14
−
1
View file @
e624ca46
...
...
@@ -29,6 +29,7 @@ namespace SGalinski\SgYoutube\Service;
use
Exception
;
use
GuzzleHttp\Exception\ClientException
;
use
InvalidArgumentException
;
use
TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
;
use
TYPO3\CMS\Core\Context\Context
;
use
TYPO3\CMS\Core\Context\Exception\AspectNotFoundException
;
use
TYPO3\CMS\Core\Context\LanguageAspect
;
...
...
@@ -50,6 +51,18 @@ class YoutubeService {
public
const
API_PART_LOCALIZATIONS
=
'localizations'
;
public
const
API_ORDER_BY
=
'date'
;
/**
* @var FrontendInterface
*/
protected
$cache
;
/**
* @param FrontendInterface $cache
*/
public
function
__construct
(
FrontendInterface
$cache
)
{
$this
->
cache
=
$cache
;
}
/**
* Maps the json array from the YouTube call to return some unified value. The output from YouTube is pretty
* unsteady. Also we calculate the correct thumbnail sized and so on.
...
...
@@ -317,7 +330,7 @@ class YoutubeService {
}
catch
(
ClientException
$exception
)
{
$jsonString
=
(
string
)
$exception
->
getResponse
()
->
getBody
();
}
$jsonArray
=
(
$jsonString
!==
''
?
json_decode
(
$jsonString
,
TRUE
)
:
[]);
if
(
$jsonArray
===
NULL
)
{
throw
new
InvalidArgumentException
(
...
...
This diff is collapsed.
Click to expand it.
Configuration/Services.yaml
+
7
−
0
View file @
e624ca46
...
...
@@ -13,3 +13,10 @@ services:
SGalinski\SgYoutube\Service\YoutubeService
:
public
:
true
autowire
:
false
arguments
:
$cache
:
'
@cache.sgyoutube_cache'
cache.sgyoutube_cache
:
class
:
TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
factory
:
[
'
@TYPO3\CMS\Core\Cache\CacheManager'
,
'
getCache'
]
arguments
:
[
'
sgyoutube_cache'
]
This diff is collapsed.
Click to expand it.
ext_localconf.php
+
2
−
0
View file @
e624ca46
...
...
@@ -48,6 +48,8 @@ $iconRegistry->registerIcon(
[
'source'
=>
'EXT:sg_youtube/Resources/Public/Icons/youtube.svg'
]
);
// Caching
$GLOBALS
[
'TYPO3_CONF_VARS'
][
'SYS'
][
'caching'
][
'cacheConfigurations'
][
'sgyoutube_cache'
]
??=
[];
// Hooks
$GLOBALS
[
'TYPO3_CONF_VARS'
][
'SC_OPTIONS'
][
'cms/layout/class.tx_cms_layout.php'
][
'tt_content_drawItem'
][
'sg_youtube'
]
=
\SGalinski\SgYoutube\Hooks\PageLayoutView\PluginRenderer
::
class
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment