-
-
Save ironprogrammer/1aaff6f60b263c1842e3584365729ffc to your computer and use it in GitHub Desktop.
Trac 57662 test plugin -- enables custom WordPress package update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Fake WordPress Update | |
* Description: Filters the value of <code>site_transient_update_core</code> to allow a custom install package. | |
* Author: WordPress Core Contributors | |
* Author URI: https://make.wordpress.org/core | |
* License: GPLv2 or later | |
* Version: 1.0.0 | |
* | |
* Adapted from https://gist.githubusercontent.com/hellofromtonya/bb0aa2d4b2311c8b40fa5ae8ada4dc19 | |
*/ | |
add_filter( | |
'site_transient_update_core', | |
function ( $value ) { | |
if ( ! isset( $value->updates ) ) { | |
return $value; | |
} | |
$fake_update_location = trailingslashit( get_bloginfo( 'url' ) ) . 'wordpress-custom.zip'; | |
$fake_update = (object) array( | |
'response' => 'upgrade', | |
'download' => $fake_update_location, | |
'locale' => 'en_US', | |
'packages' => | |
(object) array( | |
'full' => $fake_update_location, | |
'no_content' => $fake_update_location, | |
'new_bundled' => $fake_update_location, | |
'partial' => '', | |
'rollback' => '', | |
), | |
'current' => '6.3.0-custom', | |
'version' => '6.3.0-custom', | |
'php_version' => '5.6.20', | |
'mysql_version' => '5.0', | |
'new_bundled' => '6.3', | |
'partial_version' => '', | |
'version_checked' => '', | |
); | |
array_unshift( $value->updates, $fake_update ); | |
return $value; | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To test the patch for Trac 57662 using this plugin:
Once testing is complete, deactivate the plugin to prevent the fake update nag.