Edit File by line
/home/barbar84/www/wp-inclu...
File: update.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* A simple set of functions to check our version 1.0 update service.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
* @since 2.3.0
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
/**
[8] Fix | Delete
* Check WordPress version against the newest version.
[9] Fix | Delete
*
[10] Fix | Delete
* The WordPress version, PHP version, and locale is sent.
[11] Fix | Delete
*
[12] Fix | Delete
* Checks against the WordPress server at api.wordpress.org. Will only check
[13] Fix | Delete
* if WordPress isn't installing.
[14] Fix | Delete
*
[15] Fix | Delete
* @since 2.3.0
[16] Fix | Delete
*
[17] Fix | Delete
* @global string $wp_version Used to check against the newest WordPress version.
[18] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[19] Fix | Delete
* @global string $wp_local_package Locale code of the package.
[20] Fix | Delete
*
[21] Fix | Delete
* @param array $extra_stats Extra statistics to report to the WordPress.org API.
[22] Fix | Delete
* @param bool $force_check Whether to bypass the transient cache and force a fresh update check. Defaults to false, true if $extra_stats is set.
[23] Fix | Delete
*/
[24] Fix | Delete
function wp_version_check( $extra_stats = array(), $force_check = false ) {
[25] Fix | Delete
global $wpdb, $wp_local_package;
[26] Fix | Delete
[27] Fix | Delete
if ( wp_installing() ) {
[28] Fix | Delete
return;
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
// Include an unmodified $wp_version.
[32] Fix | Delete
require ABSPATH . WPINC . '/version.php';
[33] Fix | Delete
$php_version = phpversion();
[34] Fix | Delete
[35] Fix | Delete
$current = get_site_transient( 'update_core' );
[36] Fix | Delete
$translations = wp_get_installed_translations( 'core' );
[37] Fix | Delete
[38] Fix | Delete
// Invalidate the transient when $wp_version changes.
[39] Fix | Delete
if ( is_object( $current ) && $wp_version !== $current->version_checked ) {
[40] Fix | Delete
$current = false;
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
if ( ! is_object( $current ) ) {
[44] Fix | Delete
$current = new stdClass;
[45] Fix | Delete
$current->updates = array();
[46] Fix | Delete
$current->version_checked = $wp_version;
[47] Fix | Delete
}
[48] Fix | Delete
[49] Fix | Delete
if ( ! empty( $extra_stats ) ) {
[50] Fix | Delete
$force_check = true;
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
// Wait 1 minute between multiple version check requests.
[54] Fix | Delete
$timeout = MINUTE_IN_SECONDS;
[55] Fix | Delete
$time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked );
[56] Fix | Delete
[57] Fix | Delete
if ( ! $force_check && $time_not_changed ) {
[58] Fix | Delete
return;
[59] Fix | Delete
}
[60] Fix | Delete
[61] Fix | Delete
/**
[62] Fix | Delete
* Filters the locale requested for WordPress core translations.
[63] Fix | Delete
*
[64] Fix | Delete
* @since 2.8.0
[65] Fix | Delete
*
[66] Fix | Delete
* @param string $locale Current locale.
[67] Fix | Delete
*/
[68] Fix | Delete
$locale = apply_filters( 'core_version_check_locale', get_locale() );
[69] Fix | Delete
[70] Fix | Delete
// Update last_checked for current to prevent multiple blocking requests if request hangs.
[71] Fix | Delete
$current->last_checked = time();
[72] Fix | Delete
set_site_transient( 'update_core', $current );
[73] Fix | Delete
[74] Fix | Delete
if ( method_exists( $wpdb, 'db_version' ) ) {
[75] Fix | Delete
$mysql_version = preg_replace( '/[^0-9.].*/', '', $wpdb->db_version() );
[76] Fix | Delete
} else {
[77] Fix | Delete
$mysql_version = 'N/A';
[78] Fix | Delete
}
[79] Fix | Delete
[80] Fix | Delete
if ( is_multisite() ) {
[81] Fix | Delete
$user_count = get_user_count();
[82] Fix | Delete
$num_blogs = get_blog_count();
[83] Fix | Delete
$wp_install = network_site_url();
[84] Fix | Delete
$multisite_enabled = 1;
[85] Fix | Delete
} else {
[86] Fix | Delete
$user_count = count_users();
[87] Fix | Delete
$user_count = $user_count['total_users'];
[88] Fix | Delete
$multisite_enabled = 0;
[89] Fix | Delete
$num_blogs = 1;
[90] Fix | Delete
$wp_install = home_url( '/' );
[91] Fix | Delete
}
[92] Fix | Delete
[93] Fix | Delete
$query = array(
[94] Fix | Delete
'version' => $wp_version,
[95] Fix | Delete
'php' => $php_version,
[96] Fix | Delete
'locale' => $locale,
[97] Fix | Delete
'mysql' => $mysql_version,
[98] Fix | Delete
'local_package' => isset( $wp_local_package ) ? $wp_local_package : '',
[99] Fix | Delete
'blogs' => $num_blogs,
[100] Fix | Delete
'users' => $user_count,
[101] Fix | Delete
'multisite_enabled' => $multisite_enabled,
[102] Fix | Delete
'initial_db_version' => get_site_option( 'initial_db_version' ),
[103] Fix | Delete
);
[104] Fix | Delete
[105] Fix | Delete
/**
[106] Fix | Delete
* Filters the query arguments sent as part of the core version check.
[107] Fix | Delete
*
[108] Fix | Delete
* WARNING: Changing this data may result in your site not receiving security updates.
[109] Fix | Delete
* Please exercise extreme caution.
[110] Fix | Delete
*
[111] Fix | Delete
* @since 4.9.0
[112] Fix | Delete
*
[113] Fix | Delete
* @param array $query {
[114] Fix | Delete
* Version check query arguments.
[115] Fix | Delete
*
[116] Fix | Delete
* @type string $version WordPress version number.
[117] Fix | Delete
* @type string $php PHP version number.
[118] Fix | Delete
* @type string $locale The locale to retrieve updates for.
[119] Fix | Delete
* @type string $mysql MySQL version number.
[120] Fix | Delete
* @type string $local_package The value of the $wp_local_package global, when set.
[121] Fix | Delete
* @type int $blogs Number of sites on this WordPress installation.
[122] Fix | Delete
* @type int $users Number of users on this WordPress installation.
[123] Fix | Delete
* @type int $multisite_enabled Whether this WordPress installation uses Multisite.
[124] Fix | Delete
* @type int $initial_db_version Database version of WordPress at time of installation.
[125] Fix | Delete
* }
[126] Fix | Delete
*/
[127] Fix | Delete
$query = apply_filters( 'core_version_check_query_args', $query );
[128] Fix | Delete
[129] Fix | Delete
$post_body = array(
[130] Fix | Delete
'translations' => wp_json_encode( $translations ),
[131] Fix | Delete
);
[132] Fix | Delete
[133] Fix | Delete
if ( is_array( $extra_stats ) ) {
[134] Fix | Delete
$post_body = array_merge( $post_body, $extra_stats );
[135] Fix | Delete
}
[136] Fix | Delete
[137] Fix | Delete
// Allow for WP_AUTO_UPDATE_CORE to specify beta/RC/development releases.
[138] Fix | Delete
if ( defined( 'WP_AUTO_UPDATE_CORE' )
[139] Fix | Delete
&& in_array( WP_AUTO_UPDATE_CORE, array( 'beta', 'rc', 'development', 'branch-development' ), true )
[140] Fix | Delete
) {
[141] Fix | Delete
$query['channel'] = WP_AUTO_UPDATE_CORE;
[142] Fix | Delete
}
[143] Fix | Delete
[144] Fix | Delete
$url = 'http://api.wordpress.org/core/version-check/1.7/?' . http_build_query( $query, null, '&' );
[145] Fix | Delete
$http_url = $url;
[146] Fix | Delete
$ssl = wp_http_supports( array( 'ssl' ) );
[147] Fix | Delete
[148] Fix | Delete
if ( $ssl ) {
[149] Fix | Delete
$url = set_url_scheme( $url, 'https' );
[150] Fix | Delete
}
[151] Fix | Delete
[152] Fix | Delete
$doing_cron = wp_doing_cron();
[153] Fix | Delete
[154] Fix | Delete
$options = array(
[155] Fix | Delete
'timeout' => $doing_cron ? 30 : 3,
[156] Fix | Delete
'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ),
[157] Fix | Delete
'headers' => array(
[158] Fix | Delete
'wp_install' => $wp_install,
[159] Fix | Delete
'wp_blog' => home_url( '/' ),
[160] Fix | Delete
),
[161] Fix | Delete
'body' => $post_body,
[162] Fix | Delete
);
[163] Fix | Delete
[164] Fix | Delete
$response = wp_remote_post( $url, $options );
[165] Fix | Delete
[166] Fix | Delete
if ( $ssl && is_wp_error( $response ) ) {
[167] Fix | Delete
trigger_error(
[168] Fix | Delete
sprintf(
[169] Fix | Delete
/* translators: %s: Support forums URL. */
[170] Fix | Delete
__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
[171] Fix | Delete
__( 'https://wordpress.org/support/forums/' )
[172] Fix | Delete
) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
[173] Fix | Delete
headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
[174] Fix | Delete
);
[175] Fix | Delete
$response = wp_remote_post( $http_url, $options );
[176] Fix | Delete
}
[177] Fix | Delete
[178] Fix | Delete
if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
[179] Fix | Delete
return;
[180] Fix | Delete
}
[181] Fix | Delete
[182] Fix | Delete
$body = trim( wp_remote_retrieve_body( $response ) );
[183] Fix | Delete
$body = json_decode( $body, true );
[184] Fix | Delete
[185] Fix | Delete
if ( ! is_array( $body ) || ! isset( $body['offers'] ) ) {
[186] Fix | Delete
return;
[187] Fix | Delete
}
[188] Fix | Delete
[189] Fix | Delete
$offers = $body['offers'];
[190] Fix | Delete
[191] Fix | Delete
foreach ( $offers as &$offer ) {
[192] Fix | Delete
foreach ( $offer as $offer_key => $value ) {
[193] Fix | Delete
if ( 'packages' === $offer_key ) {
[194] Fix | Delete
$offer['packages'] = (object) array_intersect_key(
[195] Fix | Delete
array_map( 'esc_url', $offer['packages'] ),
[196] Fix | Delete
array_fill_keys( array( 'full', 'no_content', 'new_bundled', 'partial', 'rollback' ), '' )
[197] Fix | Delete
);
[198] Fix | Delete
} elseif ( 'download' === $offer_key ) {
[199] Fix | Delete
$offer['download'] = esc_url( $value );
[200] Fix | Delete
} else {
[201] Fix | Delete
$offer[ $offer_key ] = esc_html( $value );
[202] Fix | Delete
}
[203] Fix | Delete
}
[204] Fix | Delete
$offer = (object) array_intersect_key(
[205] Fix | Delete
$offer,
[206] Fix | Delete
array_fill_keys(
[207] Fix | Delete
array(
[208] Fix | Delete
'response',
[209] Fix | Delete
'download',
[210] Fix | Delete
'locale',
[211] Fix | Delete
'packages',
[212] Fix | Delete
'current',
[213] Fix | Delete
'version',
[214] Fix | Delete
'php_version',
[215] Fix | Delete
'mysql_version',
[216] Fix | Delete
'new_bundled',
[217] Fix | Delete
'partial_version',
[218] Fix | Delete
'notify_email',
[219] Fix | Delete
'support_email',
[220] Fix | Delete
'new_files',
[221] Fix | Delete
),
[222] Fix | Delete
''
[223] Fix | Delete
)
[224] Fix | Delete
);
[225] Fix | Delete
}
[226] Fix | Delete
[227] Fix | Delete
$updates = new stdClass();
[228] Fix | Delete
$updates->updates = $offers;
[229] Fix | Delete
$updates->last_checked = time();
[230] Fix | Delete
$updates->version_checked = $wp_version;
[231] Fix | Delete
[232] Fix | Delete
if ( isset( $body['translations'] ) ) {
[233] Fix | Delete
$updates->translations = $body['translations'];
[234] Fix | Delete
}
[235] Fix | Delete
[236] Fix | Delete
set_site_transient( 'update_core', $updates );
[237] Fix | Delete
[238] Fix | Delete
if ( ! empty( $body['ttl'] ) ) {
[239] Fix | Delete
$ttl = (int) $body['ttl'];
[240] Fix | Delete
[241] Fix | Delete
if ( $ttl && ( time() + $ttl < wp_next_scheduled( 'wp_version_check' ) ) ) {
[242] Fix | Delete
// Queue an event to re-run the update check in $ttl seconds.
[243] Fix | Delete
wp_schedule_single_event( time() + $ttl, 'wp_version_check' );
[244] Fix | Delete
}
[245] Fix | Delete
}
[246] Fix | Delete
[247] Fix | Delete
// Trigger background updates if running non-interactively, and we weren't called from the update handler.
[248] Fix | Delete
if ( $doing_cron && ! doing_action( 'wp_maybe_auto_update' ) ) {
[249] Fix | Delete
/**
[250] Fix | Delete
* Fires during wp_cron, starting the auto-update process.
[251] Fix | Delete
*
[252] Fix | Delete
* @since 3.9.0
[253] Fix | Delete
*/
[254] Fix | Delete
do_action( 'wp_maybe_auto_update' );
[255] Fix | Delete
}
[256] Fix | Delete
}
[257] Fix | Delete
[258] Fix | Delete
/**
[259] Fix | Delete
* Checks for available updates to plugins based on the latest versions hosted on WordPress.org.
[260] Fix | Delete
*
[261] Fix | Delete
* Despite its name this function does not actually perform any updates, it only checks for available updates.
[262] Fix | Delete
*
[263] Fix | Delete
* A list of all plugins installed is sent to WP, along with the site locale.
[264] Fix | Delete
*
[265] Fix | Delete
* Checks against the WordPress server at api.wordpress.org. Will only check
[266] Fix | Delete
* if WordPress isn't installing.
[267] Fix | Delete
*
[268] Fix | Delete
* @since 2.3.0
[269] Fix | Delete
*
[270] Fix | Delete
* @global string $wp_version The WordPress version string.
[271] Fix | Delete
*
[272] Fix | Delete
* @param array $extra_stats Extra statistics to report to the WordPress.org API.
[273] Fix | Delete
*/
[274] Fix | Delete
function wp_update_plugins( $extra_stats = array() ) {
[275] Fix | Delete
if ( wp_installing() ) {
[276] Fix | Delete
return;
[277] Fix | Delete
}
[278] Fix | Delete
[279] Fix | Delete
// Include an unmodified $wp_version.
[280] Fix | Delete
require ABSPATH . WPINC . '/version.php';
[281] Fix | Delete
[282] Fix | Delete
// If running blog-side, bail unless we've not checked in the last 12 hours.
[283] Fix | Delete
if ( ! function_exists( 'get_plugins' ) ) {
[284] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/plugin.php';
[285] Fix | Delete
}
[286] Fix | Delete
[287] Fix | Delete
$plugins = get_plugins();
[288] Fix | Delete
$translations = wp_get_installed_translations( 'plugins' );
[289] Fix | Delete
[290] Fix | Delete
$active = get_option( 'active_plugins', array() );
[291] Fix | Delete
$current = get_site_transient( 'update_plugins' );
[292] Fix | Delete
[293] Fix | Delete
if ( ! is_object( $current ) ) {
[294] Fix | Delete
$current = new stdClass;
[295] Fix | Delete
}
[296] Fix | Delete
[297] Fix | Delete
$new_option = new stdClass;
[298] Fix | Delete
$new_option->last_checked = time();
[299] Fix | Delete
[300] Fix | Delete
$doing_cron = wp_doing_cron();
[301] Fix | Delete
[302] Fix | Delete
// Check for update on a different schedule, depending on the page.
[303] Fix | Delete
switch ( current_filter() ) {
[304] Fix | Delete
case 'upgrader_process_complete':
[305] Fix | Delete
$timeout = 0;
[306] Fix | Delete
break;
[307] Fix | Delete
case 'load-update-core.php':
[308] Fix | Delete
$timeout = MINUTE_IN_SECONDS;
[309] Fix | Delete
break;
[310] Fix | Delete
case 'load-plugins.php':
[311] Fix | Delete
case 'load-update.php':
[312] Fix | Delete
$timeout = HOUR_IN_SECONDS;
[313] Fix | Delete
break;
[314] Fix | Delete
default:
[315] Fix | Delete
if ( $doing_cron ) {
[316] Fix | Delete
$timeout = 2 * HOUR_IN_SECONDS;
[317] Fix | Delete
} else {
[318] Fix | Delete
$timeout = 12 * HOUR_IN_SECONDS;
[319] Fix | Delete
}
[320] Fix | Delete
}
[321] Fix | Delete
[322] Fix | Delete
$time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked );
[323] Fix | Delete
[324] Fix | Delete
if ( $time_not_changed && ! $extra_stats ) {
[325] Fix | Delete
$plugin_changed = false;
[326] Fix | Delete
[327] Fix | Delete
foreach ( $plugins as $file => $p ) {
[328] Fix | Delete
$new_option->checked[ $file ] = $p['Version'];
[329] Fix | Delete
[330] Fix | Delete
if ( ! isset( $current->checked[ $file ] ) || (string) $current->checked[ $file ] !== (string) $p['Version'] ) {
[331] Fix | Delete
$plugin_changed = true;
[332] Fix | Delete
}
[333] Fix | Delete
}
[334] Fix | Delete
[335] Fix | Delete
if ( isset( $current->response ) && is_array( $current->response ) ) {
[336] Fix | Delete
foreach ( $current->response as $plugin_file => $update_details ) {
[337] Fix | Delete
if ( ! isset( $plugins[ $plugin_file ] ) ) {
[338] Fix | Delete
$plugin_changed = true;
[339] Fix | Delete
break;
[340] Fix | Delete
}
[341] Fix | Delete
}
[342] Fix | Delete
}
[343] Fix | Delete
[344] Fix | Delete
// Bail if we've checked recently and if nothing has changed.
[345] Fix | Delete
if ( ! $plugin_changed ) {
[346] Fix | Delete
return;
[347] Fix | Delete
}
[348] Fix | Delete
}
[349] Fix | Delete
[350] Fix | Delete
// Update last_checked for current to prevent multiple blocking requests if request hangs.
[351] Fix | Delete
$current->last_checked = time();
[352] Fix | Delete
set_site_transient( 'update_plugins', $current );
[353] Fix | Delete
[354] Fix | Delete
$to_send = compact( 'plugins', 'active' );
[355] Fix | Delete
[356] Fix | Delete
$locales = array_values( get_available_languages() );
[357] Fix | Delete
[358] Fix | Delete
/**
[359] Fix | Delete
* Filters the locales requested for plugin translations.
[360] Fix | Delete
*
[361] Fix | Delete
* @since 3.7.0
[362] Fix | Delete
* @since 4.5.0 The default value of the `$locales` parameter changed to include all locales.
[363] Fix | Delete
*
[364] Fix | Delete
* @param array $locales Plugin locales. Default is all available locales of the site.
[365] Fix | Delete
*/
[366] Fix | Delete
$locales = apply_filters( 'plugins_update_check_locales', $locales );
[367] Fix | Delete
$locales = array_unique( $locales );
[368] Fix | Delete
[369] Fix | Delete
if ( $doing_cron ) {
[370] Fix | Delete
$timeout = 30;
[371] Fix | Delete
} else {
[372] Fix | Delete
// Three seconds, plus one extra second for every 10 plugins.
[373] Fix | Delete
$timeout = 3 + (int) ( count( $plugins ) / 10 );
[374] Fix | Delete
}
[375] Fix | Delete
[376] Fix | Delete
$options = array(
[377] Fix | Delete
'timeout' => $timeout,
[378] Fix | Delete
'body' => array(
[379] Fix | Delete
'plugins' => wp_json_encode( $to_send ),
[380] Fix | Delete
'translations' => wp_json_encode( $translations ),
[381] Fix | Delete
'locale' => wp_json_encode( $locales ),
[382] Fix | Delete
'all' => wp_json_encode( true ),
[383] Fix | Delete
),
[384] Fix | Delete
'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ),
[385] Fix | Delete
);
[386] Fix | Delete
[387] Fix | Delete
if ( $extra_stats ) {
[388] Fix | Delete
$options['body']['update_stats'] = wp_json_encode( $extra_stats );
[389] Fix | Delete
}
[390] Fix | Delete
[391] Fix | Delete
$url = 'http://api.wordpress.org/plugins/update-check/1.1/';
[392] Fix | Delete
$http_url = $url;
[393] Fix | Delete
$ssl = wp_http_supports( array( 'ssl' ) );
[394] Fix | Delete
[395] Fix | Delete
if ( $ssl ) {
[396] Fix | Delete
$url = set_url_scheme( $url, 'https' );
[397] Fix | Delete
}
[398] Fix | Delete
[399] Fix | Delete
$raw_response = wp_remote_post( $url, $options );
[400] Fix | Delete
[401] Fix | Delete
if ( $ssl && is_wp_error( $raw_response ) ) {
[402] Fix | Delete
trigger_error(
[403] Fix | Delete
sprintf(
[404] Fix | Delete
/* translators: %s: Support forums URL. */
[405] Fix | Delete
__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
[406] Fix | Delete
__( 'https://wordpress.org/support/forums/' )
[407] Fix | Delete
) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
[408] Fix | Delete
headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
[409] Fix | Delete
);
[410] Fix | Delete
$raw_response = wp_remote_post( $http_url, $options );
[411] Fix | Delete
}
[412] Fix | Delete
[413] Fix | Delete
if ( is_wp_error( $raw_response ) || 200 !== wp_remote_retrieve_response_code( $raw_response ) ) {
[414] Fix | Delete
return;
[415] Fix | Delete
}
[416] Fix | Delete
[417] Fix | Delete
$response = json_decode( wp_remote_retrieve_body( $raw_response ), true );
[418] Fix | Delete
[419] Fix | Delete
foreach ( $response['plugins'] as &$plugin ) {
[420] Fix | Delete
$plugin = (object) $plugin;
[421] Fix | Delete
[422] Fix | Delete
if ( isset( $plugin->compatibility ) ) {
[423] Fix | Delete
$plugin->compatibility = (object) $plugin->compatibility;
[424] Fix | Delete
[425] Fix | Delete
foreach ( $plugin->compatibility as &$data ) {
[426] Fix | Delete
$data = (object) $data;
[427] Fix | Delete
}
[428] Fix | Delete
}
[429] Fix | Delete
}
[430] Fix | Delete
[431] Fix | Delete
unset( $plugin, $data );
[432] Fix | Delete
[433] Fix | Delete
foreach ( $response['no_update'] as &$plugin ) {
[434] Fix | Delete
$plugin = (object) $plugin;
[435] Fix | Delete
}
[436] Fix | Delete
[437] Fix | Delete
unset( $plugin );
[438] Fix | Delete
[439] Fix | Delete
if ( is_array( $response ) ) {
[440] Fix | Delete
$new_option->response = $response['plugins'];
[441] Fix | Delete
$new_option->translations = $response['translations'];
[442] Fix | Delete
// TODO: Perhaps better to store no_update in a separate transient with an expiry?
[443] Fix | Delete
$new_option->no_update = $response['no_update'];
[444] Fix | Delete
} else {
[445] Fix | Delete
$new_option->response = array();
[446] Fix | Delete
$new_option->translations = array();
[447] Fix | Delete
$new_option->no_update = array();
[448] Fix | Delete
}
[449] Fix | Delete
[450] Fix | Delete
set_site_transient( 'update_plugins', $new_option );
[451] Fix | Delete
}
[452] Fix | Delete
[453] Fix | Delete
/**
[454] Fix | Delete
* Checks for available updates to themes based on the latest versions hosted on WordPress.org.
[455] Fix | Delete
*
[456] Fix | Delete
* Despite its name this function does not actually perform any updates, it only checks for available updates.
[457] Fix | Delete
*
[458] Fix | Delete
* A list of all themes installed is sent to WP, along with the site locale.
[459] Fix | Delete
*
[460] Fix | Delete
* Checks against the WordPress server at api.wordpress.org. Will only check
[461] Fix | Delete
* if WordPress isn't installing.
[462] Fix | Delete
*
[463] Fix | Delete
* @since 2.7.0
[464] Fix | Delete
*
[465] Fix | Delete
* @global string $wp_version The WordPress version string.
[466] Fix | Delete
*
[467] Fix | Delete
* @param array $extra_stats Extra statistics to report to the WordPress.org API.
[468] Fix | Delete
*/
[469] Fix | Delete
function wp_update_themes( $extra_stats = array() ) {
[470] Fix | Delete
if ( wp_installing() ) {
[471] Fix | Delete
return;
[472] Fix | Delete
}
[473] Fix | Delete
[474] Fix | Delete
// Include an unmodified $wp_version.
[475] Fix | Delete
require ABSPATH . WPINC . '/version.php';
[476] Fix | Delete
[477] Fix | Delete
$installed_themes = wp_get_themes();
[478] Fix | Delete
$translations = wp_get_installed_translations( 'themes' );
[479] Fix | Delete
[480] Fix | Delete
$last_update = get_site_transient( 'update_themes' );
[481] Fix | Delete
[482] Fix | Delete
if ( ! is_object( $last_update ) ) {
[483] Fix | Delete
$last_update = new stdClass;
[484] Fix | Delete
}
[485] Fix | Delete
[486] Fix | Delete
$themes = array();
[487] Fix | Delete
$checked = array();
[488] Fix | Delete
$request = array();
[489] Fix | Delete
[490] Fix | Delete
// Put slug of current theme into request.
[491] Fix | Delete
$request['active'] = get_option( 'stylesheet' );
[492] Fix | Delete
[493] Fix | Delete
foreach ( $installed_themes as $theme ) {
[494] Fix | Delete
$checked[ $theme->get_stylesheet() ] = $theme->get( 'Version' );
[495] Fix | Delete
[496] Fix | Delete
$themes[ $theme->get_stylesheet() ] = array(
[497] Fix | Delete
'Name' => $theme->get( 'Name' ),
[498] Fix | Delete
'Title' => $theme->get( 'Name' ),
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function