php auto update,wordpress函数find_core_auto_update()用法示例

find_core_auto_update()

Gets the best available (and enabled) Auto-Update for WordPress Core.

描述

If there’s 1.2.3 and 1.3 on offer, it’ll choose 1.3 if the install allows it, else, 1.2.3

返回值

(array|false) False on failure, otherwise the core update offering.

源代码

File: wp-admin/includes/update.php

function find_core_auto_update() {

$updates = get_site_transient( 'update_core' );

if ( ! $updates || empty( $updates->updates ) )

return false;

include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );

$auto_update = false;

$upgrader = new WP_Automatic_Updater;

foreach ( $updates->updates as $update ) {

if ( 'autoupdate' != $update->response )

continue;

if ( ! $upgrader->should_update( 'core', $update, ABSPATH ) )

continue;

if ( ! $auto_update || version_compare( $update->current, $auto_update->current, '>' ) )

$auto_update = $update;

}

return $auto_update;

}

更新日志

Version

描述

3.7.0

Introduced.

相关函数

Uses

wp-includes/option.php:

get_site_transient()

Used By

wp-admin/includes/class-wp-automatic-updater.php:

WP_Automatic_Updater::run()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值