Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce version checks on Theme bulk_update #5583

Conversation

salcode
Copy link

@salcode salcode commented Oct 27, 2023

Add PHP version and WordPress version checks on bulk theme update.

Trac ticket: #59758

Apply check_package() to upgrader_source_selection in theme bulk_upgrade

While this prevents updating a theme if the new version does NOT meet
the theme requirements, it is an expensive check.

In https://core.trac.wordpress.org/ticket/59198, which addressed this
same issue for Plugins rather than themes, additional less expensive
checks were added before this check runs.

Resolves https://core.trac.wordpress.org/ticket/59758
These changes mirror those that we applied in
https://core.trac.wordpress.org/ticket/59758. In that ticket
we were checking that the WordPress and PHP requirements were met for a
plugin, while here we are applying those checks for a theme.

See https://core.trac.wordpress.org/ticket/59758
Originally, this code assumed the response $r was an object, however
upon further investigation, it appears the response $r is an associative
array, not an object.

This change accommadotes for this.

See https://core.trac.wordpress.org/ticket/59758
@laxmariappan
Copy link

I have tested the patch on PHP 7.4

It works as expected; thanks @salcode

Here are the screenshots of my CLI log.

This is my first time to test a patch, so correct me if I'm wrong.

Without patch

image

With path

image

CLI info:

OS:     Linux 5.10.47-linuxkit #1 SMP PREEMPT Sat Jul 3 21:50:16 UTC 2021 x86_64
Shell:  /bin/bash
PHP binary:     /usr/local/bin/php
PHP version:    7.4.30
php.ini used:
MySQL binary:   /usr/bin/mysql
MySQL version:  /usr/bin/mysql  Ver 15.1 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) using  EditLine wrapper
SQL modes:
WP-CLI root dir:        phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:      phar://wp-cli.phar/vendor
WP_CLI phar path:       /var/www
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:  /var/www/wp-cli.yml
WP-CLI version: 2.6.0
@aaronjorbin
Copy link
Member

@aaronjorbin aaronjorbin closed this Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants