WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru WPmentor - Ищем топовых специалистов по WordPress, чтобы помочь вам заработать
функция не описана

WP_Upgrader::create_lock() WP 4.5.0

Creates a lock using WordPress options.

Это метод класса: WP_Upgrader

Хуков нет.

Возвращает

true/false. False if a lock couldn't be created or if the lock is still valid. True otherwise.

Использование

$var = WP_Upgrader::create_lock( $lock_name, $release_timeout );
$lock_name(строка) (обязательный)
The name of this unique lock.
$release_timeout(число)
The duration in seconds to respect an existing lock. Default: 1 hour.
По умолчанию: null

Список изменений

С версии 4.5.0 Введена.

Код WP Upgrader::create lock: wp-admin/includes/class-wp-upgrader.php WP 5.4

<?php
public static function create_lock( $lock_name, $release_timeout = null ) {
	global $wpdb;
	if ( ! $release_timeout ) {
		$release_timeout = HOUR_IN_SECONDS;
	}
	$lock_option = $lock_name . '.lock';

	// Try to lock.
	$lock_result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'no') /* LOCK */", $lock_option, time() ) );

	if ( ! $lock_result ) {
		$lock_result = get_option( $lock_option );

		// If a lock couldn't be created, and there isn't a lock, bail.
		if ( ! $lock_result ) {
			return false;
		}

		// Check to see if the lock is still valid. If it is, bail.
		if ( $lock_result > ( time() - $release_timeout ) ) {
			return false;
		}

		// There must exist an expired lock, clear it and re-gain it.
		WP_Upgrader::release_lock( $lock_name );

		return WP_Upgrader::create_lock( $lock_name, $release_timeout );
	}

	// Update the lock, as by this point we've definitely got a lock, just need to fire the actions.
	update_option( $lock_option, time() );

	return true;
}