Make WordPress Core

Opened 6 years ago

Last modified 5 years ago

#47428 new defect (bug)

Site Health: Remove duplicate code in VCS test

Reported by: desrosj's profile desrosj Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 5.2
Component: Site Health Keywords: site-health
Focuses: Cc:

Description

In WP_Site_Health_Auto_Updates::test_vcs_abspath(), almost the entire WP_Upgrader::is_vcs_checkout() function is duplicated. This test should be updated to use WP_Upgrader::is_vcs_checkout() instead. There are a few issues with this that would need to be solved, though.

In the message to the user, the directory under version control and the type of version control used are specified. This currently can't be determined without duplicating the logic. Also, in order to determine if the automatic_updates_is_vcs_checkout filter is overriding the function's result to allow updates, the filter would need to be run twice.

Props @johnbillion for the suggestion in #47388.

Change History (4)

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


6 years ago

#2 @SergeyBiryukov
6 years ago

  • Keywords site-health added

#3 @desrosj
5 years ago

  • Component changed from Administration to Site Health

Moving Site Health tickets into their lovely new home, the Site Health component.

#4 @Clorith
5 years ago

Avoiding duplication here would definitely be ideal, I'm not sure how we should approach the file/folder declarations though, as I view them as quite vital in the Site Health Check context, while it doesn't matter what is under VCS for WP_Upgrader.

Any thoughts on the best approach here?

Perhaps if WP_Upgrader::is_vcs_checkout() detects it being under version control, we can do a scan for .svn, .git, .hg and .bzr and pick up on their locations, RecursiveDirectoryIterator should be fast enough when given a rigid pattern like that to work with?

Note: See TracTickets for help on using tickets.