This repository has been archived by the owner on Feb 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
wp-autoupdates.php
executable file
·69 lines (57 loc) · 2.38 KB
/
wp-autoupdates.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
/*
* Plugin initialization file.
*
* Plugin Name: WordPress Auto-updates
* Plugin URI: https://wordpress.org/plugins/wp-autoupdates
* Description: A feature plugin to integrate Plugins & Themes automatic updates in WordPress Core. This plugin has been merged into WordPress 5.5 so you may want to uninstall it if you are up-to-date.
* Version: 0.8.1
* Requires at least: 5.3
* Requires PHP: 5.6
* Tested up to: 5.4
* Author: The WordPress Team
* Author URI: https://wordpress.org
* Contributors: wordpressdotorg, audrasjb, pbiron, whyisjake, azaozz, xkon, mapk, jeffpaul, bookdude13, ronalfy, whodunitagency
* License: GPLv2
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: wp-autoupdates
*/
if ( ! defined( 'ABSPATH' ) ) {
die( 'Invalid request.' );
}
define( 'WP_AUTO_UPDATES_VERSION', '0.8.1' );
// Needs to run after the admin APIs have been loaded from wp-admin/includes/.
function wp_autoupdates_self_deactivate() {
if (
function_exists( 'wp_get_auto_update_message' ) ||
function_exists( 'wp_is_auto_update_enabled_for_type' )
) {
// Deactivate the plugin. This functionality has already been merged to core.
deactivate_plugins( plugin_basename( __FILE__ ), false, is_network_admin() );
// The names of the site options changed in the core merge,
// so copy the plugin's site options to core's.
$auto_updates = (array) get_site_option( 'auto_update_plugins', array() );
if ( ! empty( $auto_updates ) ) {
$auto_updates = array_merge( $auto_updates, (array) get_site_option( 'wp_auto_update_plugins', array() ) );
update_site_option( 'auto_update_plugins', $auto_updates );
}
$auto_updates = (array) get_site_option( 'auto_update_themes', array() );
if ( ! empty( $auto_updates ) ) {
$auto_updates = array_merge( $auto_updates, (array) get_site_option( 'wp_auto_update_themes', array() ) );
update_site_option( 'auto_update_themes', $auto_updates );
}
}
}
add_action( 'admin_init', 'wp_autoupdates_self_deactivate', 1 );
include_once plugin_dir_path( __FILE__ ) . 'functions.php';
/**
* Remove auto-updates data on uninstall.
*/
function wp_autoupdates_activate() {
register_uninstall_hook( __FILE__, 'wp_auto_update_uninstall' );
}
register_activation_hook( __FILE__, 'wp_autoupdates_activate' );
function wp_auto_update_uninstall() {
delete_site_option( 'wp_auto_update_plugins' );
delete_site_option( 'wp_auto_update_themes' );
}