Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
services
t3o sites
extensions.typo3.org
extensions.typo3.org
Commits
08f641b0
Commit
08f641b0
authored
Nov 03, 2020
by
Oliver Bartsch
Browse files
Serialize dependencies on xml generation
parent
c08ae665
Pipeline
#9882
passed with stages
in 5 minutes and 15 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
extensions/ter_fe2/Classes/Command/MigrateDependenciesToJson.php
View file @
08f641b0
...
...
@@ -38,24 +38,27 @@ class MigrateDependenciesToJson extends Command
{
$io
=
new
SymfonyStyle
(
$input
,
$output
);
$io
->
section
(
'Updating field \'dependencies\' of all \'tx_terfe2_domain_model_version\' rows now'
);
$connectionPool
=
GeneralUtility
::
makeInstance
(
ConnectionPool
::
class
);
$queryBuilderForDetails
=
$connectionPool
->
getQueryBuilderForTable
(
'tx_terfe2_domain_model_version'
);
$queryBuilderForDetails
->
getRestrictions
()
->
removeAll
();
$statement
=
$queryBuilderForDetails
$queryBuilder
=
$connectionPool
->
getQueryBuilderForTable
(
'tx_terfe2_domain_model_version'
);
$queryBuilder
->
getRestrictions
()
->
removeAll
();
$queryBuilder
->
select
(
'uid'
,
'dependencies'
)
->
from
(
'tx_terfe2_domain_model_version'
)
->
execute
();
->
from
(
'tx_terfe2_domain_model_version'
);
$result
=
$queryBuilder
->
execute
();
$itemsProcessed
=
0
;
while
(
$row
=
$statement
->
fetchAssociative
())
{
while
(
$row
=
$result
->
fetchAssociative
())
{
$dependencies
=
(
string
)(
$row
[
'dependencies'
]
??
''
);
if
(
$dependencies
===
''
||
strpos
(
$dependencies
,
'a:'
)
===
false
)
{
// skip already migrated or not serialized row
continue
;
}
try
{
GeneralUtility
::
makeInstance
(
C
onnectionPool
::
class
)
$c
onnectionPool
->
getConnectionForTable
(
'tx_terfe2_domain_model_version'
)
->
update
(
'tx_terfe2_domain_model_version'
,
...
...
extensions/ter_fe2/Classes/Service/ExtensionIndexService.php
View file @
08f641b0
...
...
@@ -161,7 +161,7 @@ class ExtensionIndexService implements LoggerAwareInterface
$this
->
xmlentities
((
string
)
$extensionVersionArr
[
'upload_comment'
])
)
);
$versionObj
->
appendChild
(
new
\
DOMElement
(
'dependencies'
,
(
string
)
$extensionVersionArr
[
'dependencies'
]));
$versionObj
->
appendChild
(
new
\
DOMElement
(
'dependencies'
,
$this
->
serializeDependencies
(
$extensionVersionArr
[
'dependencies'
]))
)
;
$versionObj
->
appendChild
(
new
\
DOMElement
(
'composerinfo'
,
(
string
)
$extensionVersionArr
[
'composer_info'
]));
$versionObj
->
appendChild
(
new
\
DOMElement
(
'authorname'
,
$this
->
xmlentities
((
string
)
$extensionVersionArr
[
'authorname'
])));
$versionObj
->
appendChild
(
new
\
DOMElement
(
'authoremail'
,
$this
->
xmlentities
((
string
)
$extensionVersionArr
[
'authoremail'
])));
...
...
@@ -230,4 +230,11 @@ class ExtensionIndexService implements LoggerAwareInterface
{
return
GeneralUtility
::
makeInstance
(
Configuration
::
class
)
->
getRepositoryBasePath
();
}
protected
function
serializeDependencies
(
?string
$dependencies
=
null
):
string
{
return
$dependencies
!==
null
?
(
string
)
serialize
(
json_decode
(
$dependencies
,
true
))
:
''
;
}
}
extensions/ter_fe2/Tests/Unit/Service/ExtensionIndexServiceTest.php
View file @
08f641b0
...
...
@@ -38,7 +38,7 @@ class ExtensionIndexServiceTest extends UnitTestCase
<downloadcounter/>
<lastuploaddate/>
<uploadcomment/>
<dependencies
/
>
<dependencies
>a:1:{i:0;a:3:{s:4:"kind";s:7:"depends";s:12:"extensionKey";s:5:"typo3";s:12:"versionRange";s:13:"8.7.0-10.4.99";}}</dependencies
>
<composerinfo/>
<authorname/>
<authoremail/>
...
...
@@ -59,7 +59,7 @@ class ExtensionIndexServiceTest extends UnitTestCase
<downloadcounter/>
<lastuploaddate/>
<uploadcomment/>
<dependencies
/
>
<dependencies
>a:0:{}</dependencies
>
<composerinfo/>
<authorname/>
<authoremail/>
...
...
@@ -68,6 +68,27 @@ class ExtensionIndexServiceTest extends UnitTestCase
<t3xfilemd5/>
<documentation_link/>
</version>
</extension>
<extension extensionkey="inc">
<downloadcounter>131313</downloadcounter>
<version version="2.0.0">
<title/>
<description/>
<state/>
<reviewstate/>
<category/>
<downloadcounter/>
<lastuploaddate/>
<uploadcomment/>
<dependencies/>
<composerinfo/>
<authorname/>
<authoremail/>
<authorcompany>INC</authorcompany>
<ownerusername>oli</ownerusername>
<t3xfilemd5/>
<documentation_link/>
</version>
</extension>
</extensions>
'
;
...
...
@@ -79,6 +100,7 @@ class ExtensionIndexServiceTest extends UnitTestCase
'versions'
=>
[
'1.0.0'
=>
[
'authorcompany'
=>
'ACME'
,
'dependencies'
=>
'[{"kind":"depends","extensionKey":"typo3","versionRange":"8.7.0-10.4.99"}]'
]
]
],
...
...
@@ -87,7 +109,18 @@ class ExtensionIndexServiceTest extends UnitTestCase
'frontend_user'
=>
'david'
,
'versions'
=>
[
'1.5.0'
=>
[
'authorcompany'
=>
't3o'
'authorcompany'
=>
't3o'
,
'dependencies'
=>
'[]'
]
]
],
'inc'
=>
[
'downloads'
=>
131313
,
'frontend_user'
=>
'oli'
,
'versions'
=>
[
'2.0.0'
=>
[
'authorcompany'
=>
'INC'
,
'dependencies'
=>
null
]
]
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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