ClassicPress icon indicating copy to clipboard operation
ClassicPress copied to clipboard

Update uses of WP version string

Open nylen opened this issue 6 years ago • 15 comments

Let's look through each use of $wp_version and get_bloginfo( 'version' ) (are there any others?) and decide whether it should refer to the WordPress version (minimum version checks, compatibility checks, etc) or the ClassicPress version (core update checks, version displays, etc).

Follow-up to:

  • ClassicPress/ClassicPress#32
  • https://github.com/ClassicPress/ClassicPress/pull/34#discussion_r215801196

nylen avatar Sep 08 '18 03:09 nylen

I think that $wp_version should refer to the last version that ClassicPress is running (i.e. 4.9.8) so that plugins etc can make compatibility checks.

I think we should have a separate $cp_version for referencing ClassicPress versions and any plugins or themes that get developed in mind will be able to reference this variable.

I'm not familiar enough with the mechanisms to comment on the execution of this in code.

scottybo avatar Sep 08 '18 14:09 scottybo

Yes, this is what I did in ClassicPress/ClassicPress#32. This issue is for changing over specific uses of the version string to ClassicPress or not, as appropriate

nylen avatar Sep 08 '18 16:09 nylen

Add to the list of usages to check for: $GLOBALS['wp_version'].

nylen avatar Sep 13 '18 04:09 nylen

If the PR was already merged this should be closed, right?

There is anything else to do here?

Tmeister avatar Oct 06 '18 00:10 Tmeister

We had more than 1 PR to update versions, references to WordPress / ClassicPress, etc. Here is the specific task for this issue, which is not done yet:

Let's look through each use of $wp_version and get_bloginfo( 'version' ) (and any other usages including $GLOBALS['wp_version']) and decide whether it should refer to the WordPress version (minimum version checks, compatibility checks, etc) or the ClassicPress version (core update checks, version displays, etc).

nylen avatar Oct 06 '18 04:10 nylen

Here is an example of a screen that needs a couple of updates:

2018-10-09t21 44 14-05 00

See also: ClassicPress/ClassicPress-v1#227

nylen avatar Oct 10 '18 02:10 nylen

After ClassicPress/ClassicPress#120 this screen looks a little better, but still needs work:

2018-10-09t22 45 32-05 00

nylen avatar Oct 10 '18 03:10 nylen

shouldnt it read "you have the latest version of ClassicPress installed"? Or even better: "This website is running the latest version of ClassicPress. Future security updates will be applied automatically."

ginsterbusch avatar Oct 10 '18 07:10 ginsterbusch

A couple of specific tasks here have been split out into separate issues: ClassicPress/ClassicPress-v1#208, ClassicPress/ClassicPress-v1#207. I think the remaining task in this issue is to wait until those are done, and then take a look back through the code and UI for instances of version strings that still need to be updated.

I'm not quite sure what to do about this type of issue: general issues that require multiple specific changes to address, when we don't quite know what all the specific changes will be yet. @patrice108 thoughts?

nylen avatar Oct 17 '18 22:10 nylen

@nylen This sounds like an epic maybe? Where other things must be completed for the overall task to be completed. Does that sound accurate?

If not, then I would suggest updating the ticket itself (not just commenting) to note what has been done and what is still waiting.

patrice108 avatar Oct 18 '18 21:10 patrice108

This sounds like an epic maybe? Where other things must be completed for the overall task to be completed. Does that sound accurate?

Yes, this is accurate.

nylen avatar Oct 20 '18 05:10 nylen

@nylen Then I think close this issue and open a new one for that last item -

wait until those are done, and then take a look back through the code and UI for instances of version strings that still need to be updated.

And for epics in the future, create one item as a user story to cover the entire overall task, and then link the rest to it. The epic is closed when all tasks are closed.

patrice108 avatar Oct 22 '18 15:10 patrice108

A couple of specific tasks here have been split out into separate issues: ClassicPress/ClassicPress-v1#208, ClassicPress/ClassicPress-v1#207. I think the remaining task in this issue is to wait until those are done, and then take a look back through the code and UI for instances of version strings that still need to be updated.

I'm not quite sure what to do about this type of issue: general issues that require multiple specific changes to address, when we don't quite know what all the specific changes will be yet. @patrice108 thoughts?

Both tagged references are fixed/closed/merged.

bahiirwa avatar Dec 12 '18 08:12 bahiirwa

OK. Rather than a new issue, let's just keep this one open until the following is done:

take a look back through the code and UI for instances of version strings that still need to be updated

nylen avatar Dec 14 '18 03:12 nylen

Here's a list of lines using bloginfo that reference version. My assessment assumes that bloginfo('version') gives the WP version.

https://github.com/ClassicPress/ClassicPress/blob/889a0c0532f06fdc3f1f364f7a306c6bddabcc7d/src/wp-admin/admin-header.php#L162-L163 :grey_question: The branch and version are made into classes to put on the admin page <body> tag. I suppose this could be used by scripts or styles to target a particular version, but I don't know if it's actually used anywhere.

 

https://github.com/ClassicPress/ClassicPress/blob/889a0c0532f06fdc3f1f364f7a306c6bddabcc7d/src/wp-admin/plugin-editor.php#L261 https://github.com/ClassicPress/ClassicPress/blob/889a0c0532f06fdc3f1f364f7a306c6bddabcc7d/src/wp-admin/theme-editor.php#L270 :grey_question: From inside the plugin or theme editor, the WP function is retrieved from the WP API, so it passes the WP version. As is, this looks correct, but it should be using a CP API instead or removed.

 

https://github.com/ClassicPress/ClassicPress/blob/889a0c0532f06fdc3f1f364f7a306c6bddabcc7d/src/wp-admin/update-core.php#L38 https://github.com/ClassicPress/ClassicPress/blob/889a0c0532f06fdc3f1f364f7a306c6bddabcc7d/src/wp-admin/update-core.php#L159 https://github.com/ClassicPress/ClassicPress/blob/889a0c0532f06fdc3f1f364f7a306c6bddabcc7d/src/wp-admin/update-core.php#L246 :grey_question: The first two are for updating core, which looks like a problem (but it's working?). :heavy_check_mark: The third one is for plugin updates, so it looks okay while we only have WP plugins.

 

https://github.com/ClassicPress/ClassicPress/blob/889a0c0532f06fdc3f1f364f7a306c6bddabcc7d/src/wp-admin/includes/class-wp-automatic-updater.php#L452 :question: This is checking for a dash. It seems like it should use CP version. https://github.com/ClassicPress/ClassicPress/blob/889a0c0532f06fdc3f1f364f7a306c6bddabcc7d/src/wp-admin/includes/class-wp-automatic-updater.php#L491 :question: The version is used in the update email sent to user. It seems like it should use CP version. https://github.com/ClassicPress/ClassicPress/blob/889a0c0532f06fdc3f1f364f7a306c6bddabcc7d/src/wp-admin/includes/class-wp-automatic-updater.php#L711 :question: The version is used in the error email sent to user. It seems like it should use CP version.

 

https://github.com/ClassicPress/ClassicPress/blob/889a0c0532f06fdc3f1f364f7a306c6bddabcc7d/src/wp-admin/includes/class-wp-plugin-install-list-table.php#L594 https://github.com/ClassicPress/ClassicPress/blob/889a0c0532f06fdc3f1f364f7a306c6bddabcc7d/src/wp-admin/includes/plugin-install.php#L722-L723 :grey_question: The version is used for plugin compatibility check, so if it's just for WP plugins, it's okay.

 

https://github.com/ClassicPress/ClassicPress/blob/889a0c0532f06fdc3f1f364f7a306c6bddabcc7d/src/wp-includes/class-http.php#L116 :question: This comment should match whatever is actually done in classicpress_user_agent() but it looks like it does not match: https://github.com/ClassicPress/ClassicPress/blob/889a0c0532f06fdc3f1f364f7a306c6bddabcc7d/src/wp-includes/http.php#L760

 

https://github.com/ClassicPress/ClassicPress/blob/889a0c0532f06fdc3f1f364f7a306c6bddabcc7d/src/wp-includes/class-wp-editor.php#L989 :x: This is used for the editor scripts, so it should use classicpress_asset_version().

 

https://github.com/ClassicPress/ClassicPress/blob/889a0c0532f06fdc3f1f364f7a306c6bddabcc7d/src/wp-includes/class-wp-xmlrpc-server.php#L478-L480 :question: XML-RPC gives the name 'ClassicPress', but the version is WP version.

 

https://github.com/ClassicPress/ClassicPress/blob/889a0c0532f06fdc3f1f364f7a306c6bddabcc7d/src/wp-includes/general-template.php#L3994 https://github.com/ClassicPress/ClassicPress/blob/889a0c0532f06fdc3f1f364f7a306c6bddabcc7d/src/wp-includes/media.php#L3957-L3959 :x: These both are adding a version to the URL of an admin file, so it should be using classicpress_asset_version().

 

https://github.com/ClassicPress/ClassicPress/blob/889a0c0532f06fdc3f1f364f7a306c6bddabcc7d/tests/phpunit/tests/general/resourceHints.php#L20 :white_check_mark: The default version is set with WP version, but none of the tests have a version in the expected result, so it doesn't matter.

joyously avatar Dec 17 '21 20:12 joyously