ActionScheduler_Compatibility::raise_time_limit()public staticWC 1.0

Attempts to raise the PHP timeout for time intensive processes.

Only allows raising the existing limit and prevents lowering it. Wrapper for wc_set_time_limit(), when available.

Метод класса: ActionScheduler_Compatibility{}

Хуков нет.

Возвращает

null. Ничего.

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

$result = ActionScheduler_Compatibility::raise_time_limit( $limit );
$limit(int)
The time limit in seconds.

Код ActionScheduler_Compatibility::raise_time_limit() WC 7.7.0

public static function raise_time_limit( $limit = 0 ) {
	$limit = (int) $limit;
	$max_execution_time = (int) ini_get( 'max_execution_time' );

	/*
	 * If the max execution time is already unlimited (zero), or if it exceeds or is equal to the proposed
	 * limit, there is no reason for us to make further changes (we never want to lower it).
	 */
	if (
		0 === $max_execution_time
		|| ( $max_execution_time >= $limit && $limit !== 0 )
	) {
		return;
	}

	if ( function_exists( 'wc_set_time_limit' ) ) {
		wc_set_time_limit( $limit );
	} elseif ( function_exists( 'set_time_limit' ) && false === strpos( ini_get( 'disable_functions' ), 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { // phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.safe_modeDeprecatedRemoved
		@set_time_limit( $limit ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
	}
}