Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setCapabilitySecureUninstall example
try
{
$plugins
=
$this
->
get
(
PluginStoreService::
class
)
->
getPlugins
(
$context
)
;
foreach
(
$plugins
as
$plugin
)
{
if
(
isset
(
$installDates
[
$plugin
->
getTechnicalName
(
)
]
)
)
{
$date
=
$installDates
[
$plugin
->
getTechnicalName
(
)
]
[
'installation_date'
]
;
if
(
$date
)
{
$plugin
->
setInstallationDate
(
new
DateTime
(
$date
)
)
;
}
$plugin
->
setCapabilitySecureUninstall
(
$installDates
[
$plugin
->
getTechnicalName
(
)
]
[
'capability_secure_uninstall'
]
)
;
}
}
$this
->
View
(
)
->
assign
(
[
'success' => true, 'data' =>
array_values
(
$plugins
)
]
)
;
}
catch
(
Exception
$e
)
{
$this
->
View
(
)
->
assign
(
[
'success' => false, 'message' =>
$e
->
getMessage
(
)
]
)
;
}
}
/** * @return void */
public
function
assignLocalPluginStruct
(
PluginStruct
$storePlugin
, PluginStruct
$localPlugin
)
{
$storePlugin
->
setId
(
$localPlugin
->
getId
(
)
)
;
$storePlugin
->
setInstallationDate
(
$localPlugin
->
getInstallationDate
(
)
)
;
$storePlugin
->
setActive
(
$localPlugin
->
isActive
(
)
)
;
$storePlugin
->
setSource
(
$localPlugin
->
getSource
(
)
)
;
$storePlugin
->
setLicence
(
$localPlugin
->
getLicence
(
)
)
;
$storePlugin
->
setCapabilityActivate
(
$localPlugin
->
hasCapabilityActivate
(
)
)
;
$storePlugin
->
setCapabilityInstall
(
$localPlugin
->
hasCapabilityInstall
(
)
)
;
$storePlugin
->
setCapabilitySecureUninstall
(
$localPlugin
->
hasCapabilitySecureUninstall
(
)
)
;
$storePlugin
->
setLocalDescription
(
$localPlugin
->
getLocalDescription
(
)
)
;
$storePlugin
->
setLink
(
$localPlugin
->
getLink
(
)
)
;
$storePlugin
->
setRedirectToStore
(
$localPlugin
->
isRedirectToStore
(
)
)
;
$storePlugin
->
setLowestPrice
(
$localPlugin
->
getLowestPrice
(
)
)
;
$storePlugin
->
setCapabilityUpdate
(
$localPlugin
->
hasCapabilityUpdate
(
)
)
;
$updateAvailable
=
version_compare
(
$storePlugin
->
getVersion
(
)
,
$localPlugin
->
getVersion
(
)
)
;