ActionScheduler_wpPostStore::migration_dependencies_met()publicWC 1.0

Determine whether the post store can be migrated.

{} Это метод класса: ActionScheduler_wpPostStore{}

Хуки из метода

Возвращает

true|false.

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

$ActionScheduler_wpPostStore = new ActionScheduler_wpPostStore();
$ActionScheduler_wpPostStore->migration_dependencies_met( $setting );
$setting([type]) (обязательный)
- Setting value.

Код ActionScheduler_wpPostStore::migration_dependencies_met() WC 6.9.4

public function migration_dependencies_met( $setting ) {
	global $wpdb;

	$dependencies_met = get_transient( self::DEPENDENCIES_MET );
	if ( empty( $dependencies_met ) ) {
		$maximum_args_length = apply_filters( 'action_scheduler_maximum_args_length', 191 );
		$found_action        = $wpdb->get_var( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
			$wpdb->prepare(
				"SELECT ID FROM {$wpdb->posts} WHERE post_type = %s AND CHAR_LENGTH(post_content) > %d LIMIT 1",
				$maximum_args_length,
				self::POST_TYPE
			)
		);
		$dependencies_met    = $found_action ? 'no' : 'yes';
		set_transient( self::DEPENDENCIES_MET, $dependencies_met, DAY_IN_SECONDS );
	}

	return 'yes' === $dependencies_met ? $setting : false;
}