Skip to content

Commit 8553bc9

Browse files
authored
Add task to run the WordPress database update procedure (#12)
* Add task to run the WordPress database update procedure * Update changelog
1 parent b52e4dc commit 8553bc9

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
### Added
10+
- Add task to run the WordPress database update procedure on deployment.
11+
912
### Changed
1013
- Set `keep_releases` option `3` by default.
1114

res/deploy.tpl.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,20 @@ function () {
7979
}
8080
);
8181

82+
desc( 'Runs the WordPress database update procedure' );
83+
task(
84+
'wp:upgrade_db',
85+
function () {
86+
within(
87+
'{{release_path}}',
88+
function () {
89+
$is_multisite = test( 'wp core is-installed --network' );
90+
run( 'wp core update-db' . ( $is_multisite ? ' --network' : '' ) );
91+
}
92+
);
93+
}
94+
);
95+
8296
desc( 'Deploy your project' );
8397
task(
8498
'deploy',
@@ -95,6 +109,7 @@ function () {
95109
'deploy:clear_paths',
96110
'deploy:symlink',
97111
'wp:opcache_clear',
112+
'wp:upgrade_db',
98113
'deploy:unlock',
99114
'cleanup',
100115
'success',

0 commit comments

Comments
 (0)