Skip to content
Merged
Show file tree
Hide file tree
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
16 changes: 16 additions & 0 deletions features/core-update-db.feature
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,19 @@ Feature: Update core's database
"""
Success: WordPress database upgraded on 3/3 sites.
"""

Scenario: Ensure update-db sets WP_INSTALLING constant
Given a WP install
And a before.php file:
"""
<?php
WP_CLI::add_hook( 'before_invoke:core update-db', function(){
WP_CLI::log( 'WP_INSTALLING: ' . var_export( WP_INSTALLING, true ) );
});
"""

When I run `wp --require=before.php core update-db`
Then STDOUT should contain:
"""
WP_INSTALLING: true
"""
3 changes: 2 additions & 1 deletion php/WP_CLI/Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,8 @@ public function start() {
exit;
}

if ( $this->cmd_starts_with( array( 'core', 'is-installed' ) ) ) {
if ( $this->cmd_starts_with( array( 'core', 'is-installed' ) )
|| $this->cmd_starts_with( array( 'core', 'update-db' ) ) ) {
define( 'WP_INSTALLING', true );
}

Expand Down