Skip to content

Commit d77e1c6

Browse files
committedApr 15, 2021
Merge branch 'next-14498/remove-plugin-manager-in-first-run-wizard' into 'trunk'
NEXT-14498 - Remove plugin manager services and refactor extension service See merge request shopware/6/product/platform!4916
2 parents 7edead7 + e948ce0 commit d77e1c6

File tree

23 files changed

+126
-548
lines changed

23 files changed

+126
-548
lines changed
 

‎CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ This is the official changelog index of Shopware 6. Here you find a registry of
274274
* [NEXT-13821 - Remove the plugin manager from the administration](/changelog/release-6-4-0-0/2021-03-16-remove-the-plugin-manager-from-the-administration.md)
275275
* [NEXT-14418 - Component overrides now consider mixins](/changelog/release-6-4-0-0/2021-03-23-component-overrides-now-consider-mixins.md)
276276
* [NEXT-13838 - Use sql null safe equals operator](/changelog/release-6-4-0-0/2021-03-24-use-sql-null-safe-equals-operator.md)
277+
* [NEXT-14498 - Remove plugin manager dependencies](/changelog/release-6-4-0-0/2021-04-01-remove-plugin-manager-dependencies.md)
277278

278279
## 6.3.5.2
279280
* [NEXT-13710 - Added api aware flag for category tree](/changelog/release-6-3-5-2/2021-02-22-added-api-aware-flag-for-category-tree.md)

‎UPGRADE-6.4.md

+1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ Use `bin/console dal:validate` to see if you have to adjust your plugins anywher
113113

114114
## Removed plugin manager
115115
The plugin manager in the administration is removed with all of its components and replaced by the `sw-extension` module.
116+
The controller for the plugin manager with all of its routes is removed and replaced by the `ExtensionStoreActionsController`.
116117

117118
---
118119

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: Remove plugin manager dependencies
3+
issue: NEXT-14498
4+
author: Timo Altholtmann
5+
6+
---
7+
# Core
8+
* Removed class `PluginController`
9+
* Removed controller for route `/api/_action/plugin/upload`
10+
* Removed controller for route `/api/_action/plugin/delete`
11+
* Removed controller for route `/api/_action/plugin/refresh`
12+
* Removed controller for route `/api/_action/plugin/install`
13+
* Removed controller for route `/api/_action/plugin/uninstall`
14+
* Removed controller for route `/api/_action/plugin/activate`
15+
* Removed controller for route `/api/_action/plugin/deactivate`
16+
* Removed controller for route `/api/_action/plugin/update`
17+
___
18+
# Administration
19+
* Removed service `pluginService`
20+
* Removed service `extensionService`
21+
___
22+
# Upgrade Information
23+
## Removed plugin manager code
24+
The controller for the plugin manager with all of its routes is removed and replaced by the `ExtensionStoreActionsController`.

‎phpstan-baseline.neon

-5
Original file line numberDiff line numberDiff line change
@@ -3245,11 +3245,6 @@ parameters:
32453245
count: 1
32463246
path: src/Core/Framework/Migration/MigrationCollection.php
32473247

3248-
-
3249-
message: "#^Parameter \\#1 \\$mimeType of class Shopware\\\\Core\\\\Framework\\\\Plugin\\\\Exception\\\\PluginNotAZipFileException constructor expects string, string\\|null given\\.$#"
3250-
count: 1
3251-
path: src/Core/Framework/Plugin/Api/PluginController.php
3252-
32533248
-
32543249
message: "#^Method Shopware\\\\Core\\\\Framework\\\\Plugin\\\\Changelog\\\\ChangelogParser\\:\\:parseTitle\\(\\) has parameter \\$line with no typehint specified\\.$#"
32553250
count: 1

‎src/Administration/Resources/app/administration/src/app/component/utils/sw-license-violation/index.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Shopware.Component.register('sw-license-violation', {
1111

1212
inject: [
1313
'licenseViolationService',
14-
'pluginService',
1514
'cacheApiService',
1615
'loginService'
1716

@@ -127,9 +126,9 @@ Shopware.Component.register('sw-license-violation', {
127126
this.addLoading('fetchPlugins');
128127

129128
if (Shopware.Feature.isActive('FEATURE_NEXT_12608')) {
130-
const extensionApiService = Shopware.Service('extensionApiService');
129+
const extensionStoreActionService = Shopware.Service('extensionStoreActionService');
131130

132-
extensionApiService.getMyExtensions()
131+
extensionStoreActionService.getMyExtensions()
133132
.then((response) => {
134133
this.plugins = response;
135134
})
@@ -166,7 +165,7 @@ Shopware.Component.register('sw-license-violation', {
166165

167166
const matchingPlugin = this.plugins.find((plugin) => plugin.name === violation.name);
168167

169-
return this.licenseViolationService.forceDeletePlugin(this.pluginService, matchingPlugin)
168+
return this.licenseViolationService.forceDeletePlugin(matchingPlugin)
170169
.then(() => {
171170
this.createNotificationSuccess({
172171
message: this.$tc('sw-license-violation.successfullyDeleted')

‎src/Administration/Resources/app/administration/src/app/main.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ Application
103103
.addServiceProvider('extensionHelperService', () => {
104104
return new ExtensionHelperService({
105105
storeService: Shopware.Service('storeService'),
106-
pluginService: Shopware.Service('pluginService'),
107-
extensionApiService: Shopware.Service('extensionApiService')
106+
extensionStoreActionService: Shopware.Service('extensionStoreActionService')
108107
});
109108
})
110109
.addServiceProvider('languageAutoFetchingService', () => {

‎src/Administration/Resources/app/administration/src/app/service/extension-helper.service.js

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,39 @@
11
export default class ExtensionHelperService {
2-
constructor({ storeService, pluginService, extensionApiService }) {
2+
constructor({ storeService, extensionStoreActionService }) {
33
this.storeService = storeService;
4-
this.pluginService = pluginService;
5-
this.extensionApiService = extensionApiService;
4+
this.extensionStoreActionService = extensionStoreActionService;
65
}
76

8-
async downloadAndActivateExtension(extensionName) {
7+
async downloadAndActivateExtension(extensionName, type = 'plugin') {
98
const extensionStatus = await this.getStatusOfExtension(extensionName);
109

1110
if (!extensionStatus.downloaded) {
1211
await this.downloadStoreExtension(extensionName);
1312
}
1413

1514
if (!extensionStatus.installedAt) {
16-
await this.installStoreExtension(extensionName);
15+
await this.installStoreExtension(extensionName, type);
1716
}
1817

1918
if (!extensionStatus.active) {
20-
await this.activateStoreExtension(extensionName);
19+
await this.activateStoreExtension(extensionName, type);
2120
}
2221
}
2322

2423
downloadStoreExtension(extensionName) {
2524
return this.storeService.downloadPlugin(extensionName, true, true);
2625
}
2726

28-
installStoreExtension(extensionName) {
29-
return this.pluginService.install(extensionName);
27+
installStoreExtension(extensionName, type) {
28+
return this.extensionStoreActionService.installExtension(extensionName, type);
3029
}
3130

32-
activateStoreExtension(extensionName) {
33-
return this.pluginService.activate(extensionName);
31+
activateStoreExtension(extensionName, type) {
32+
return this.extensionStoreActionService.activateExtension(extensionName, type);
3433
}
3534

3635
async getStatusOfExtension(extensionName) {
37-
const extensions = await this.extensionApiService.getMyExtensions();
36+
const extensions = await this.extensionStoreActionService.getMyExtensions();
3837
const extension = extensions.find(e => e && e.name === extensionName);
3938

4039
if (!extension) {

‎src/Administration/Resources/app/administration/src/app/service/license-violations.service.js

+16-37
Original file line numberDiff line numberDiff line change
@@ -151,49 +151,28 @@ export default function createLicenseViolationsService(storeService) {
151151
localStorage.removeItem(responseCacheKey);
152152
}
153153

154-
async function forceDeletePlugin(pluginService, extension) {
155-
if (Shopware.Feature.isActive('FEATURE_NEXT_12608')) {
156-
const extensionApiService = Shopware.Service('shopwareExtensionService');
157-
const cacheService = Shopware.Service('cacheApiService');
158-
159-
try {
160-
const isActive = extension.active;
161-
const isInstalled = extension.installedAt !== null;
162-
163-
if (isActive) {
164-
await extensionApiService.deactivateExtension(extension.name, extension.type);
165-
await cacheService.clear();
166-
}
167-
168-
if (isInstalled) {
169-
await extensionApiService.uninstallExtension(extension.name, extension.type);
170-
}
154+
async function forceDeletePlugin(extension) {
155+
const shopwareExtensionService = Shopware.Service('shopwareExtensionService');
156+
const cacheService = Shopware.Service('cacheApiService');
171157

172-
await extensionApiService.removeExtension(extension.name, extension.type);
158+
try {
159+
const isActive = extension.active;
160+
const isInstalled = extension.installedAt !== null;
173161

174-
return true;
175-
} catch (error) {
176-
throw new Error(error);
162+
if (isActive) {
163+
await shopwareExtensionService.deactivateExtension(extension.name, extension.type);
164+
await cacheService.clear();
177165
}
178-
} else {
179-
try {
180-
const isActive = extension.active;
181-
const isInstalled = extension.installedAt !== null;
182-
183-
if (isActive) {
184-
await pluginService.deactivate(extension.name);
185-
}
186166

187-
if (isInstalled) {
188-
await pluginService.uninstall(extension.name);
189-
}
167+
if (isInstalled) {
168+
await shopwareExtensionService.uninstallExtension(extension.name, extension.type);
169+
}
190170

191-
await pluginService.delete(extension.name);
171+
await shopwareExtensionService.removeExtension(extension.name, extension.type);
192172

193-
return true;
194-
} catch (error) {
195-
throw new Error(error);
196-
}
173+
return true;
174+
} catch (error) {
175+
throw new Error(error);
197176
}
198177
}
199178

‎src/Administration/Resources/app/administration/src/core/service/api/plugin.api.service.js

-109
This file was deleted.

‎src/Administration/Resources/app/administration/src/module/sw-extension/component/sw-extension-file-upload/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const { Component, Mixin } = Shopware;
77
Component.register('sw-extension-file-upload', {
88
template,
99

10-
inject: ['extensionApiService', 'repositoryFactory'],
10+
inject: ['extensionStoreActionService', 'repositoryFactory'],
1111

1212
mixins: [
1313
Mixin.getByName('notification')
@@ -35,7 +35,7 @@ Component.register('sw-extension-file-upload', {
3535
const formData = new FormData();
3636
formData.append('file', files[0]);
3737

38-
return this.extensionApiService.upload(formData).then(() => {
38+
return this.extensionStoreActionService.upload(formData).then(() => {
3939
Shopware.Service('shopwareExtensionService').updateExtensionData().then(() => {
4040
return this.createNotificationSuccess({
4141
message: this.$tc('sw-extension.my-extensions.fileUpload.messageUploadSuccess')

0 commit comments

Comments
 (0)