Skip to content

Commit cdc2887

Browse files
committed
Merge branch 'tdgroot-feature/enable_caches'
2 parents a128352 + 66b6d33 commit cdc2887

File tree

5 files changed

+60
-0
lines changed

5 files changed

+60
-0
lines changed

deploy.php.sample_2_1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ set('magento_dir', 'magento');
1515
set('repository', '');
1616
// Space separated list of languages for static-content:deploy
1717
set('languages', 'en_US');
18+
// Enable all caches after deployment
19+
set('cache_enabled_caches', 'all');
1820

1921
// OPcache configuration
2022
task('cache:clear:opcache', 'sudo systemctl reload php-fpm');

deploy.php.sample_2_2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ set('magento_dir', 'magento');
1515
set('repository', '');
1616
// Space separated list of languages for static-content:deploy
1717
set('languages', 'en_US');
18+
// Enable all caches after deployment
19+
set('cache_enabled_caches', 'all');
1820

1921
// OPcache configuration
2022
task('cache:clear:opcache', 'sudo systemctl reload php-fpm');

deploy.php.sample_2_2_5

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ set('magento_dir', 'magento');
1515
set('repository', '');
1616
// Space separated list of languages for static-content:deploy
1717
set('languages', 'en_US');
18+
// Enable all caches after deployment
19+
set('cache_enabled_caches', 'all');
1820

1921
// OPcache configuration
2022
task('cache:clear:opcache', 'sudo systemctl reload php-fpm');

recipe/magento_2_1/cache.php

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,55 @@
2121
invoke('cache:clear:magento') :
2222
writeln('Skipped -> maintenance is not set');
2323
});
24+
25+
/*
26+
* By default, cache enabling is disabled.
27+
*/
28+
set('cache_enabled_caches', '');
29+
30+
/*
31+
* To enable all caches after deployment, configure the following:
32+
*
33+
set('cache_enabled_caches', 'all');
34+
*/
35+
36+
/*
37+
* One can provide specific caches as well.
38+
*
39+
set('cache_enabled_caches',
40+
[
41+
'config',
42+
'layout',
43+
'block_html',
44+
'collections',
45+
'reflection',
46+
'db_ddl',
47+
'eav',
48+
'customer_notification',
49+
'full_page',
50+
'config_integration',
51+
'config_integration_api',
52+
'translate',
53+
'config_webservice',
54+
'compiled_config',
55+
]
56+
);
57+
*/
58+
59+
task('cache:enable', function () {
60+
$enabledCaches = get('cache_enabled_caches');
61+
62+
if (empty($enabledCaches)) {
63+
return;
64+
}
65+
66+
$command = '{{bin/php}} {{release_path}}/{{magento_bin}} cache:enable';
67+
68+
if ($enabledCaches === 'all') {
69+
run($command);
70+
}
71+
72+
if (is_array($enabledCaches)) {
73+
run($command . ' ' . implode(' ', $enabledCaches));
74+
}
75+
});

recipe/magento_2_2.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
'deploy:symlink',
5656
'maintenance:unset',
5757
'cache:clear',
58+
'cache:enable',
5859
'deploy:unlock',
5960
'cleanup',
6061
'success',
@@ -84,6 +85,7 @@
8485
'deploy:symlink',
8586
'maintenance:unset',
8687
'cache:clear',
88+
'cache:enable',
8789
'deploy:unlock',
8890
'cleanup',
8991
'success',

0 commit comments

Comments
 (0)