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
18 changes: 12 additions & 6 deletions features/core-check-update-db.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ Feature: Check if WordPress database update is needed
And a disable_sidebar_check.php file:
"""
<?php
WP_CLI::add_wp_hook( 'init', static function () {
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
} );
WP_CLI::add_wp_hook(
'init',
static function () {
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
}
);
"""
And I try `wp theme install twentytwenty --activate`
And I run `wp core download --version=5.4 --force`
Expand Down Expand Up @@ -49,9 +52,12 @@ Feature: Check if WordPress database update is needed
And a disable_sidebar_check.php file:
"""
<?php
WP_CLI::add_wp_hook( 'init', static function () {
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
} );
WP_CLI::add_wp_hook(
'init',
static function () {
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
}
);
"""
And I try `wp theme install twentytwenty --activate`
And I run `wp core download --version=6.6 --force`
Expand Down
2 changes: 1 addition & 1 deletion features/core-check-update.feature
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Feature: Check for more recent versions
<?php
global $wp_version;

$obj = new stdClass;
$obj = new stdClass();
$obj->updates = [];
$obj->last_checked = strtotime( '1 January 2099' );
$obj->version_checked = $wp_version;
Expand Down
54 changes: 36 additions & 18 deletions features/core-update-db.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ Feature: Update core's database
And a disable_sidebar_check.php file:
"""
<?php
WP_CLI::add_wp_hook( 'init', static function () {
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
} );
WP_CLI::add_wp_hook(
'init',
static function () {
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
}
);
"""
And I try `wp theme install twentytwenty --activate`
And I run `wp core download --version=5.4 --force`
Expand All @@ -34,9 +37,12 @@ Feature: Update core's database
And a disable_sidebar_check.php file:
"""
<?php
WP_CLI::add_wp_hook( 'init', static function () {
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
} );
WP_CLI::add_wp_hook(
'init',
static function () {
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
}
);
"""
And I try `wp theme install twentytwenty --activate`
And I run `wp core download --version=5.4 --force`
Expand All @@ -62,9 +68,12 @@ Feature: Update core's database
And a disable_sidebar_check.php file:
"""
<?php
WP_CLI::add_wp_hook( 'init', static function () {
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
} );
WP_CLI::add_wp_hook(
'init',
static function () {
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
}
);
"""
And I try `wp theme install twentytwenty --activate`
And I run `wp core download --version=5.4 --force`
Expand Down Expand Up @@ -104,9 +113,12 @@ Feature: Update core's database
And a disable_sidebar_check.php file:
"""
<?php
WP_CLI::add_wp_hook( 'init', static function () {
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
} );
WP_CLI::add_wp_hook(
'init',
static function () {
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
}
);
"""
And I try `wp theme install twentytwenty --activate`
And I run `wp core download --version=5.4 --force`
Expand Down Expand Up @@ -158,9 +170,12 @@ Feature: Update core's database
And a disable_sidebar_check.php file:
"""
<?php
WP_CLI::add_wp_hook( 'init', static function () {
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
} );
WP_CLI::add_wp_hook(
'init',
static function () {
remove_action( 'after_switch_theme', '_wp_sidebars_changed' );
}
);
"""
And I try `wp theme install twentytwenty --activate`
And I run `wp core download --version=5.4 --force`
Expand Down Expand Up @@ -204,9 +219,12 @@ Feature: Update core's database
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 ) );
});
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`
Expand Down
57 changes: 30 additions & 27 deletions features/core-update.feature
Original file line number Diff line number Diff line change
Expand Up @@ -189,33 +189,36 @@ Feature: Update WordPress core
And a wp-content/mu-plugins/upgrade-override.php file:
"""
<?php
add_filter( 'pre_site_transient_update_core', function(){
return (object) array(
'updates' => array(
(object) array(
'response' => 'autoupdate',
'download' => 'https://downloads.wordpress.org/release/wordpress-6.5.5.zip',
'locale' => 'en_US',
'packages' => (object) array(
'full' => 'https://downloads.wordpress.org/release/wordpress-6.5.5.zip',
'no_content' => 'https://downloads.wordpress.org/release/wordpress-6.5.5-no-content.zip',
'new_bundled' => 'https://downloads.wordpress.org/release/wordpress-6.5.5-new-bundled.zip',
'partial' => 'https://downloads.wordpress.org/release/wordpress-6.5.5-partial-1.zip',
'rollback' => 'https://downloads.wordpress.org/release/wordpress-6.5.5-rollback-1.zip',
),
'current' => '6.5.5',
'version' => '6.5.5',
'php_version' => '8.2.1',
'mysql_version' => '5.0',
'new_bundled' => '6.4',
'partial_version' => '6.5.2',
'support_email' => 'updatehelp42@wordpress.org',
'new_files' => '',
),
),
'version_checked' => '6.5.5', // Needed to avoid PHP notice in `wp_version_check()`.
);
});
add_filter(
'pre_site_transient_update_core',
function () {
return (object) array(
'updates' => array(
(object) array(
'response' => 'autoupdate',
'download' => 'https://downloads.wordpress.org/release/wordpress-6.5.5.zip',
'locale' => 'en_US',
'packages' => (object) array(
'full' => 'https://downloads.wordpress.org/release/wordpress-6.5.5.zip',
'no_content' => 'https://downloads.wordpress.org/release/wordpress-6.5.5-no-content.zip',
'new_bundled' => 'https://downloads.wordpress.org/release/wordpress-6.5.5-new-bundled.zip',
'partial' => 'https://downloads.wordpress.org/release/wordpress-6.5.5-partial-1.zip',
'rollback' => 'https://downloads.wordpress.org/release/wordpress-6.5.5-rollback-1.zip',
),
'current' => '6.5.5',
'version' => '6.5.5',
'php_version' => '8.2.1',
'mysql_version' => '5.0',
'new_bundled' => '6.4',
'partial_version' => '6.5.2',
'support_email' => 'updatehelp42@wordpress.org',
'new_files' => '',
),
),
'version_checked' => '6.5.5', // Needed to avoid PHP notice in `wp_version_check()`.
);
}
);
"""

When I run `wp core download --version=6.5.2 --force`
Expand Down
19 changes: 10 additions & 9 deletions features/core.feature
Original file line number Diff line number Diff line change
Expand Up @@ -341,33 +341,34 @@ Feature: Manage WordPress installation
<?php
// ** MySQL settings ** //
/** The name of the database for WordPress */
define('DB_NAME', '{DB_NAME}');
define( 'DB_NAME', '{DB_NAME}' );

/** MySQL database username */
define('DB_USER', '{DB_USER}');
define( 'DB_USER', '{DB_USER}' );

/** MySQL database password */
define('DB_PASSWORD', '{DB_PASSWORD}');
define( 'DB_PASSWORD', '{DB_PASSWORD}' );

/** MySQL hostname */
define('DB_HOST', '{DB_HOST}');
define( 'DB_HOST', '{DB_HOST}' );

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
define( 'DB_CHARSET', 'utf8' );

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
define( 'DB_COLLATE', '' );

$table_prefix = 'wp_';

/* That's all, stop editing! Happy publishing. */

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');
require_once ABSPATH . 'wp-settings.php';
"""
And a wp-cli.yml file:
"""
Expand Down