Last active
June 28, 2018 12:24
-
-
Save tomaszklim/6084bf2bd8434ef0b769f125d616e322 to your computer and use it in GitHub Desktop.
Wordpress remote update checker
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 | |
/** | |
* Wordpress remote update checker | |
* Written by Tomasz Klim, based on wp-admin code | |
** | |
<Files wp-fetch-updates-info.php> | |
Order Deny,Allow | |
Deny from all | |
Allow from 1.2.3.4 | |
Allow from 5.6.7.8 | |
</Files> | |
*/ | |
define('WP_ADMIN', true); | |
require_once(dirname(__FILE__) . '/wp-load.php'); | |
require_once(ABSPATH . 'wp-admin/includes/update-core.php'); | |
require_once(ABSPATH . 'wp-admin/includes/update.php'); | |
require_once(ABSPATH . 'wp-admin/includes/plugin.php'); | |
require_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); | |
$current = get_site_transient('update_core'); | |
$last_update_check = false; | |
if ($current && isset($current->last_checked)) { | |
$last_update_check = $current->last_checked + get_option('gmt_offset') * HOUR_IN_SECONDS; | |
} | |
$result = array(); | |
$result["last_update_check"] = $last_update_check; | |
$query = wp_version_check(array(), true); | |
$result["wp_version_check"] = $query; | |
$updates = get_core_updates(); | |
$result["core_updates"] = $updates; | |
$plugins = get_plugin_updates(); | |
$result["plugin_updates"] = $plugins; | |
$themes = get_theme_updates(); | |
$result["theme_updates"] = $themes; | |
$updates = wp_get_translation_updates(); | |
$result["translation_updates"] = $updates; | |
$json = json_encode($result); | |
echo $json; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment