Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
afragen committed Oct 23, 2019
1 parent 4a7da18 commit 97bd5ad
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/WPBT/WPBT_Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function save_settings( $post_data ) {

// set an option when picking 'point' release stream.
// used to ensure correct mangled version is returned.
'point' === $options ? isset( self::$options['revert'] ) && self::$options['revert'] = true : self::$options['revert'] = false;
self::$options['revert'] = 'point' === $options;
update_site_option( 'wp_beta_tester', (array) self::$options );
add_filter( 'wp_beta_tester_save_redirect', array( $this, 'save_redirect_page' ) );
}
Expand Down
11 changes: 4 additions & 7 deletions src/WPBT/WP_Beta_Tester.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,13 @@ protected function mangle_wp_version() {

// ensure that a downgrade correctly gets mangled version.
if ( isset( $options['revert'] ) && $options['revert'] ) {
$versions = $this->correct_versions_for_downgrade( $versions, $preferred );
$versions = $this->correct_versions_for_downgrade( $versions );
}

switch ( $options['stream'] ) {
case 'point':
case 'beta-rc-point':
$versions[2] = isset( $versions[2] ) ? $versions[2] + 1 : 1;
$versions[2] = isset( $current[2] ) && 1 === $versions[2] ? $current[2] : $versions[2];
break;
case 'unstable':
case 'beta-rc-unstable':
Expand All @@ -217,14 +216,12 @@ protected function mangle_wp_version() {
* Ensure that a downgrade to a point release returns a version array that
* will properly get the correct offer.
*
* @param array $versions Array containing the semver arguments of the currently
* installed version.
* @param string $wp_version Installed WordPress version.
* @param \stdClass $preferred Object containing preferred update offer from core.
* @param array $versions Array containing the semver arguments of the currently
* installed version.
*
* @return array
*/
private function correct_versions_for_downgrade( $versions, $preferred ) {
private function correct_versions_for_downgrade( $versions ) {
$wp_version = get_bloginfo( 'version' );
$current = array_map( 'intval', explode( '.', $wp_version ) );

Expand Down
2 changes: 1 addition & 1 deletion wp-beta-tester.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Plugin URI: https://wordpress.org/plugins/wordpress-beta-tester/
* Description: Allows you to easily upgrade to Beta releases.
* Author: Peter Westwood, Andy Fragen
* Version: 2.1.0.3
* Version: 2.1.0.4
* Network: true
* Author URI: https://blog.ftwr.co.uk/
* Text Domain: wordpress-beta-tester
Expand Down

0 comments on commit 97bd5ad

Please sign in to comment.