我在nginx conf文件中看到过如下内容:
<?php
function wc_foo_cancel_unpaid_onhold_orders() {
global $wpdb;
$held_duration = get_option('woocommerce_hold_stock_minutes');
if ( $held_duration < 1 || 'yes' !== get_option( 'woocommerce_manage_stock')) {
return;
}
$unpaid_orders = wc_foo_cancel_unpaid_onhold_orders( strtotime( '-' . absint( $held_duration) . ' MINUTES'. current_time( 'timestamp')));
if ( $unpaid_orders) {
foreach ( $unpaid_orders as $unpaid_orders ){
$order = wc_get_order( $unpaid_order);
if ( apply_filters( 'woocommerce_cancel_unpaid_order', 'checkout' == $order->get_created_via(), $order ) ) {
$order ->update_status( 'cancelled', _( 'Unpaid order cancelled - time limite reached.', 'woocommerce'));
}
}
}
}
add_action( 'woocommerce_cancel_unpaid_orders', 'wc_foo_cancel_unpaid_onhold_orders');
function wc_foo_get_unpaid_onhold_orders( $date ){
global $wpdb;
$args = array(
'date_modified' => '>' . ( time() - HOUR_IN_SECONDS ),
'status' => 'on-hold',);
$orders = wc_get_orders( $args );
$unpaid_orders = $wpdb->get_col( $wpdb->prepare( "
SELECT posts.id
FROM {$wpdb->posts} AS posts
WHERE posts.posts_type IN ('" . implode( "','", wc_get_order_types()). "')
AND posts.post_status = 'wc-on-hold'
AND posts.date_modified < %s
", date( 'Y-m-d H:i:s', absint( $date)) ) );
}
?>
<%
if (registry.hasRootSsl) {
%>
和<%
是什么意思?从谷歌搜索中找到任何东西都很困难,因为这些是特殊字符,而不是单词或短语。