function set_up_auto_updater()
{
$forceUpdate = get_option('force-jetpack-update');
if ($forceUpdate != get_current_jetpack_version()) {
update_option('force-jetpack-update', 'just-updated');
}
$beta_type = get_option('jp_beta_type');
if ($beta_type == 'rc_only') {
$json_url = 'http://betadownload.jetpack.me/rc/rc.json';
} else {
$json_url = 'http://betadownload.jetpack.me/jetpack-bleeding-edge.json';
}
do_action('add_debug_info', $json_url, 'json_url');
require 'plugin-updates/plugin-update-checker.php';
$JetpackBeta = PucFactory::buildUpdateChecker($json_url, WP_PLUGIN_DIR . '/jetpack/jetpack.php', 'jetpack', '0.01');
// Allows us to update the Jetpack Beta tool by updating GitHub
$className = PucFactory::getLatestClassVersion('PucGitHubChecker');
$myUpdateChecker = new $className('https://github.com/Automattic/jetpack-beta/', __FILE__, 'master');
$jp_beta_autoupdate = get_option('jp_beta_autoupdate');
if ($jp_beta_autoupdate != 'no') {
function auto_update_jetpack_beta($update, $item)
{
// Array of plugin slugs to always auto-update
$plugins = array('jetpack');
if (in_array($item->slug, $plugins)) {
return true;
// Always update plugins in this array
} else {
return $update;
// Else, use the normal API response to decide whether to update or not
}
}
add_filter('auto_update_plugin', 'auto_update_jetpack_beta', 10, 2);
}
}