Making WordPress.org

#6394 closed defect (bug) (worksforme)

Fix GitHub edit link on WP-CLI handbook

Reported by: danielbachhuber's profile danielbachhuber Owned by: dd32's profile dd32
Milestone: Priority: normal
Component: Make (Get Involved) / P2 Keywords: has-patch
Cc:

Description

The WP-CLI handbook currently points to the master branch, when it should point to the main branch (https://share.cleanshot.com/4VjE91)

Here's the corresponding code needing to be updated: https://meta.trac.wordpress.org/browser/sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-cli/inc/class-handbook.php#L113

Attachments (1)

meta-6394.diff (851 bytes) - added by Ipstenu 17 months ago.
Patch per Daniel's description

Download all attachments as: .zip

Change History (10)

This ticket was mentioned in Slack in #meta by danielbachhuber. View the logs.


17 months ago

@Ipstenu
17 months ago

Patch per Daniel's description

#2 @Ipstenu
17 months ago

  • Keywords has-patch added

Added a patch per what Daniel described.

#3 @dd32
17 months ago

  • Owner set to dd32
  • Resolution set to fixed
  • Status changed from new to closed

In 11951:

Make: CLI Handbook: Switch from the master branch to the main branch.

Props Ipstenu, danielbachhuber, dd32.
Fixes #6394.

#4 @dd32
17 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Well that doesn't seem to have worked..

For reference, this is about https://make.wordpress.org/cli/handbook/

#6 @iandunn
15 months ago

I think the cause is that action_wporg_cli_manifest_import() cron callback never updates the wporg_cli_markdown_source meta key when it changes. So the original URL is always used. To fix that, we could write a script to update them all, or some code to automatically update them when the cron runs.

Is there a tangible problem here, though? It seems like GitHub automatically redirects any links. If that's the case, then IMO it'd be better to focus our time on things with a bigger impact.

#7 @danielbachhuber
15 months ago

Is there a tangible problem here, though? It seems like GitHub automatically redirects any links.

There was some context where the link was broken and didn't redirect.

However, clicking the Edit link on the top of the Handbook page seems to redirect as expected.

To fix that, we could write a script to update them all, or some code to automatically update them when the cron runs.

Could we simply filter the output value for make.wordpress.org/cli?

It seems like GitHub automatically redirects any links. If that's the case, then IMO it'd be better to focus our time on things with a bigger impact.

I think this is one of those paper cut issues where, until it gets fixed, it will be reported again and again.

#8 @dd32
15 months ago

I think the cause is that action_wporg_cli_manifest_import() cron callback never updates the wporg_cli_markdown_source meta key when it changes.

I've fixed this as a once-off wp shell job, I don't think this kind of thing happens enough to warrant fixing this specific handbook importer.

$ wp shell --url=https://make.wordpress.org/cli/handbook
wp> global $wpdb;
wp> $ids = $wpdb->get_results( "SELECT `post_id`, REPLACE( `meta_value`, '/blob/master/', '/blob/main/' ) as value FROM `$wpdb->postmeta` WHERE `meta_key` = 'wporg_cli_markdown_source' AND `meta_value` LIKE '%/blob/master/%'" );
array(70) {
....
wp> foreach ( $ids as $row ) { update_post_meta( $row->post_id, 'wporg_cli_markdown_source', $row->value ); }

#9 @danielbachhuber
15 months ago

  • Resolution set to worksforme
  • Status changed from reopened to closed

Thanks for the fix, @dd32 ! The links now work as expected for me.

Note: See TracTickets for help on using tickets.