Filter uncanny-automator

uncanny_automator_pro_auto_install_time_limit

Filters the maximum allowed time in seconds for recipe auto-installation, allowing customization of the time limit.

add_filter( 'uncanny_automator_pro_auto_install_time_limit', $callback, 10, 1 );

Description

Allows developers to filter the maximum execution time limit for automated plugin installations. You can increase this limit to accommodate larger plugin downloads, ensuring the installation process completes without timing out. The value is clamped between 1 and 300 seconds.


Usage

add_filter( 'uncanny_automator_pro_auto_install_time_limit', 'your_function_name', 10, 1 );

Return Value

The filtered value.


Examples

/**
 * Example of using the uncanny_automator_pro_auto_install_time_limit filter.
 *
 * This example increases the time limit for plugin installation to 480 seconds
 * if the default time limit is less than that, ensuring larger plugins can be
 * downloaded and installed without timing out.
 */
add_filter(
	'uncanny_automator_pro_auto_install_time_limit',
	function( $current_time_limit ) {
		// Define our desired extended time limit.
		$extended_time_limit = 480; // 8 minutes

		// If the current time limit is less than our extended limit, use the extended limit.
		// Otherwise, respect the already set higher limit.
		if ( $current_time_limit < $extended_time_limit ) {
			return $extended_time_limit;
		}

		// Return the current time limit if it's already higher than our desired extension.
		return $current_time_limit;
	},
	10, // Priority
	1  // Accepted arguments
);

Placement

This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.


Source Code

src/core/services/admin-post/routes/pro-auto-install.php:294

private function configure_environment() {
		$time_limit = apply_filters( 'uncanny_automator_pro_auto_install_time_limit', absint( self::ALLOWED_TIME_LIMIT ) );
		$time_limit = max( 1, min( 300, $time_limit ) ); // Ensure the time limit is between 1 and 300 seconds.
		set_time_limit( $time_limit );
	}

Scroll to Top