WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 9 months ago

#30497 reopened defect (bug)

Impossible to change upgrader skin when Language_Pack_Upgrader is instanciated via Language_Pack_Upgrader::async_upgrade()

Reported by: rodrigosprimo Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.0
Component: Upgrade/Install Keywords: needs-patch
Focuses: Cc:
PR Number:

Description

WP-CLI uses its own upgrader skin class (WP_CLI\UpgraderSkin) to remove HTML from the strings that are displayed to the users.

But it is not possible to change the upgrader skin when Language_Pack_Upgrader is instanciated via Language_Pack_Upgrader::async_upgrade() resulting in the problem described in the issue below:

https://github.com/wp-cli/wp-cli/issues/1501

The attached patch implements a possible solution for this adding a filter to change the upgrader skin class name. I'm not sure if this is the best way to fix this or if we should refactor this method and the way it is called to add the upgrader skin class as a parameter.

Attachments (1)

30497.diff (819 bytes) - added by rodrigosprimo 5 years ago.

Download all attachments as: .zip

Change History (7)

@rodrigosprimo
5 years ago

#1 @johnbillion
5 years ago

  • Keywords 2nd-opinion added
  • Milestone changed from Awaiting Review to Future Release

I'd prefer to use dependency injection here and add a method to Language_Pack_Upgrader which sets the language pack upgrader skin class. Thoughts?

#2 @rodrigosprimo
3 years ago

  • Resolution set to invalid
  • Status changed from new to closed

@danielbachhuber and I can't reproduce anymore the WP-CLI issue that led me to open this ticket (https://github.com/wp-cli/wp-cli/issues/1501#issuecomment-240537508). It seems that this was fixed somehow on WP core so I'm closing this ticket.

#3 @DrewAPicture
3 years ago

  • Keywords 2nd-opinion removed
  • Milestone Future Release deleted

#4 @ottok
9 months ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

I can still reproduce this:

wordpress$ wp core update --minor
Updating to version 5.1.1 (fi)...
Using cached file '/home/tessanekakontti/.wp-cli/cache/core/wordpress-5.1.1-fi.zip'...
Puretaan päivitystä...
<p>Joihinkin käännöksiin on saatavilla päivityksiä. Malta vielä muutama hetki, niin päivitämme nekin.</p>
<div class="update-messages lp-show-latest"><h2>Päivitetään käännöksiä: WordPress (sv_SE)&#8230;</h2><p>Ladataan käännöstä osoitteesta <span class="code">https://downloads.wordpress.org/translation/core/5.1.1/sv_SE.zip</span>&#8230;</p>
<p>Puretaan päivitystä&#8230;</p>
<p>Asennetaan viimeisintä versiota&#8230;</p>
<p>Poistetaan käännöksen vanhaa versiota.</p>
<p>Käännöksen päivitys onnistui.</p>
</div><script type="text/javascript">
					(function( wp ) {
						if ( wp && wp.updates && wp.updates.decrementCount )
							wp.updates.decrementCount( "translation" );
						}
					})( window.wp );
				</script>
Success: WordPress updated successfully.



wordpress$ wp core update --minor
Success: WordPress is at the latest minor release.



wordpress$ cp -ra /data/backups/data/wordpress/htdocs .
wordpress$ wp core update --minor
Updating to version 5.1.1 (fi)...
Using cached file '/home/tessanekakontti/.wp-cli/cache/core/wordpress-5.1.1-fi.zip'...
Puretaan päivitystä...
<p>Joihinkin käännöksiin on saatavilla päivityksiä. Malta vielä muutama hetki, niin päivitämme nekin.</p>
<div class="update-messages lp-show-latest"><h2>Päivitetään käännöksiä: WordPress (sv_SE)&#8230;</h2><p>Ladataan käännöstä osoitteesta <span class="code">https://downloads.wordpress.org/translation/core/5.1.1/sv_SE.zip</span>&#8230;</p>
<p>Puretaan päivitystä&#8230;</p>
<p>Asennetaan viimeisintä versiota&#8230;</p>
<p>Poistetaan käännöksen vanhaa versiota.</p>
<p>Käännöksen päivitys onnistui.</p>
</div><script type="text/javascript">
					(function( wp ) {
						if ( wp && wp.updates && wp.updates.decrementCount )
							wp.updates.decrementCount( "translation" );
						}
					})( window.wp );
				</script>Success: WordPress updated successfully.

#5 @SergeyBiryukov
9 months ago

  • Milestone set to Awaiting Review

#6 @swissspidy
9 months ago

  • Keywords needs-patch added
Note: See TracTickets for help on using tickets.