Skip to content

Commit

Permalink
Merge branch 'tdgroot-feature/enable_caches'
Browse files Browse the repository at this point in the history
  • Loading branch information
osrecio committed Apr 16, 2020
2 parents a128352 + 66b6d33 commit cdc2887
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 0 deletions.
2 changes: 2 additions & 0 deletions deploy.php.sample_2_1
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ set('magento_dir', 'magento');
set('repository', '');
// Space separated list of languages for static-content:deploy
set('languages', 'en_US');
// Enable all caches after deployment
set('cache_enabled_caches', 'all');

// OPcache configuration
task('cache:clear:opcache', 'sudo systemctl reload php-fpm');
Expand Down
2 changes: 2 additions & 0 deletions deploy.php.sample_2_2
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ set('magento_dir', 'magento');
set('repository', '');
// Space separated list of languages for static-content:deploy
set('languages', 'en_US');
// Enable all caches after deployment
set('cache_enabled_caches', 'all');

// OPcache configuration
task('cache:clear:opcache', 'sudo systemctl reload php-fpm');
Expand Down
2 changes: 2 additions & 0 deletions deploy.php.sample_2_2_5
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ set('magento_dir', 'magento');
set('repository', '');
// Space separated list of languages for static-content:deploy
set('languages', 'en_US');
// Enable all caches after deployment
set('cache_enabled_caches', 'all');

// OPcache configuration
task('cache:clear:opcache', 'sudo systemctl reload php-fpm');
Expand Down
52 changes: 52 additions & 0 deletions recipe/magento_2_1/cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,55 @@
invoke('cache:clear:magento') :
writeln('Skipped -> maintenance is not set');
});

/*
* By default, cache enabling is disabled.
*/
set('cache_enabled_caches', '');

/*
* To enable all caches after deployment, configure the following:
*
set('cache_enabled_caches', 'all');
*/

/*
* One can provide specific caches as well.
*
set('cache_enabled_caches',
[
'config',
'layout',
'block_html',
'collections',
'reflection',
'db_ddl',
'eav',
'customer_notification',
'full_page',
'config_integration',
'config_integration_api',
'translate',
'config_webservice',
'compiled_config',
]
);
*/

task('cache:enable', function () {
$enabledCaches = get('cache_enabled_caches');

if (empty($enabledCaches)) {
return;
}

$command = '{{bin/php}} {{release_path}}/{{magento_bin}} cache:enable';

if ($enabledCaches === 'all') {
run($command);
}

if (is_array($enabledCaches)) {
run($command . ' ' . implode(' ', $enabledCaches));
}
});
2 changes: 2 additions & 0 deletions recipe/magento_2_2.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
'deploy:symlink',
'maintenance:unset',
'cache:clear',
'cache:enable',
'deploy:unlock',
'cleanup',
'success',
Expand Down Expand Up @@ -84,6 +85,7 @@
'deploy:symlink',
'maintenance:unset',
'cache:clear',
'cache:enable',
'deploy:unlock',
'cleanup',
'success',
Expand Down

0 comments on commit cdc2887

Please sign in to comment.