Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sw:plugin:activate:all and sw:plugin:migrate:all to Shopware 6 recipe #2159

Merged
merged 2 commits into from
Sep 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 39 additions & 8 deletions recipe/shopware6.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,19 @@
task('sw:database:migrate', static function () {
run('cd {{release_path}} && bin/console database:migrate --all');
});
task('sw:plugins:installActivateUpgrade', static function () {
task('sw:plugin:refresh', function (){
run('cd {{release_path}} && bin/console plugin:refresh');
});
task('sw:plugin:activate:all', static function () {
task('sw:plugin:refresh');
$plugins = explode("\n", run('cd {{release_path}} && bin/console plugin:list'));

// take line over headlines and count "-" to get the size of the cells
// take line over headlines and count "-" to get the size of the cells
$lengths = array_filter(array_map('strlen', explode(' ', $plugins[4])));

// ignore first seven lines (headline, title, table, ...)
// ignore first seven lines (headline, title, table, ...)
$plugins = array_slice($plugins, 7, -3);
foreach ($plugins as $plugin) {
// PayonePayment PAYONE Payment 2.0.0 PAYONE GmbH, Kellerkinder Pluginwerk GmbH No No No

$pluginParts = [];
foreach ($lengths as $length) {
$pluginParts[] = trim(substr($plugin, 0, $length));
Expand All @@ -88,9 +90,37 @@
if ($installed === 'No' || $active === 'No') {
run("cd {{release_path}} && bin/console plugin:install --activate $plugin");
}
}
});
task('sw:plugin:migrate:all', static function(){
$plugins = explode("\n", run('cd {{release_path}} && bin/console plugin:list'));
Schrank marked this conversation as resolved.
Show resolved Hide resolved

// take line over headlines and count "-" to get the size of the cells
$lengths = array_filter(array_map('strlen', explode(' ', $plugins[4])));

// ignore first seven lines (headline, title, table, ...)
$plugins = array_slice($plugins, 7, -3);
foreach ($plugins as $plugin) {
$pluginParts = [];
foreach ($lengths as $length) {
$pluginParts[] = trim(substr($plugin, 0, $length));
$plugin = substr($plugin, $length + 1);
}

[
$plugin,
$label,
$version,
$upgrade,
$version,
$author,
$installed,
$active,
$upgradeable,
] = $pluginParts;

if ($upgradeable === 'Yes') {
run("cd {{release_path}} && bin/console plugin:update -c $plugin");
if ($installed === 'Yes' || $active === 'Yes') {
run("cd {{release_path}} && bin/console database:migrate --all $plugin || true");
}
}
});
Expand All @@ -99,9 +129,10 @@
* Grouped SW deploy tasks
*/
task('sw:deploy', [
// 'sw:plugins:installActivateUpgrade',
'sw:build',
'sw:plugin:activate:all',
'sw:database:migrate',
'sw:plugin:migrate:all',
'sw:theme:compile',
'sw:cache:clear',
]);
Expand Down