Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
services
T
t3o sites
extensions.typo3.org
extensions.typo3.org
Commits
5025247c
Commit
5025247c
authored
Oct 14, 2017
by
Tomas Norre Mikkelsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set the last_version only if version_number is higher than the previous one
parent
8328b257
Pipeline
#2545
passed with stages
in 2 minutes and 4 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
1 deletion
+69
-1
html/typo3conf/ext/ter_fe2/Classes/Task/ImportExtensionsFromQueueTask.php
...xt/ter_fe2/Classes/Task/ImportExtensionsFromQueueTask.php
+69
-1
No files found.
html/typo3conf/ext/ter_fe2/Classes/Task/ImportExtensionsFromQueueTask.php
View file @
5025247c
...
...
@@ -275,10 +275,12 @@ class ImportExtensionsFromQueueTask extends Task
*/
public
function
updateExtension
(
$versionUid
,
$extUid
)
{
$highestVersionUid
=
$this
->
calculatedHighestVersion
(
$versionUid
,
$extUid
);
$updateExtension
=
[
'tstamp'
=>
time
(),
'versions'
=>
$this
->
getNumberOfVersions
(
$extUid
),
'last_version'
=>
$
v
ersionUid
'last_version'
=>
$
highestV
ersionUid
];
$this
->
getDatabaseConnection
()
->
exec_UPDATEquery
(
'tx_terfe2_domain_model_extension'
,
...
...
@@ -449,4 +451,70 @@ class ImportExtensionsFromQueueTask extends Task
{
return
$GLOBALS
[
'TYPO3_DB'
];
}
/**
* Check which version is higher, so that we can se the right version in latest_version
*
* @param $versionUid
* @param $extUid
* @return mixed
*/
private
function
calculatedHighestVersion
(
$versionUid
,
$extUid
):
mixed
{
$currentHighestVersion
=
$this
->
getHighestVersion
(
$extUid
);
if
(
empty
(
$currentHighestVersion
))
{
return
$versionUid
;
}
$newVersionNumber
=
$this
->
getVersionNumber
(
$versionUid
);
if
(
!
$newVersionNumber
>
$currentHighestVersion
[
'version_number'
])
{
$versionUid
=
$currentHighestVersion
[
'uid'
];
}
return
$versionUid
;
}
/**
* Get the version number of the current version
*
* @param $versionUid
* @return int
*/
private
function
getVersionNumber
(
$versionUid
)
{
$res
=
$this
->
getDatabaseConnection
()
->
exec_SELECTgetSingleRow
(
'version_number'
,
'tx_terfe2_domain_model_version'
,
'uid = '
.
$versionUid
.
' AND NOT deleted'
);
if
(
$res
[
'version_number'
])
{
return
$res
[
'version_number'
];
}
return
0
;
}
/**
* Gets the highest version number
*
* @param $extUid
*
* @return array|FALSE|NULL
*/
private
function
getHighestVersion
(
$extUid
)
{
$res
=
$this
->
getDatabaseConnection
()
->
exec_SELECTgetSingleRow
(
'uid,version_number'
,
'tx_terfe2_domain_model_version'
,
'extension = '
.
$extUid
.
' AND NOT deleted'
,
''
,
'ORDER BY version_number DESC'
);
if
(
!
empty
(
$res
))
{
return
$res
;
}
return
[];
}
}
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