Skip to content

Commit

Permalink
Merge pull request #1117 from crstauf/phpcs/ActionScheduler_Compatibi…
Browse files Browse the repository at this point in the history
…lity.php

PHPCS: `classes/ActionScheduler_Compatibility.php`
  • Loading branch information
barryhughes authored Oct 22, 2024
2 parents 385062e + e208ee8 commit f7b2ece
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions classes/ActionScheduler_Compatibility.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static function raise_memory_limit() {
return wp_raise_memory_limit( 'admin' );
}

$current_limit = @ini_get( 'memory_limit' );
$current_limit = @ini_get( 'memory_limit' ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
$current_limit_int = self::convert_hr_to_bytes( $current_limit );

if ( -1 === $current_limit_int ) {
Expand All @@ -61,6 +61,9 @@ public static function raise_memory_limit() {
$filtered_limit = apply_filters( 'admin_memory_limit', $wp_max_limit );
$filtered_limit_int = self::convert_hr_to_bytes( $filtered_limit );

// phpcs:disable WordPress.PHP.IniSet.memory_limit_Blacklisted
// phpcs:disable WordPress.PHP.NoSilencedErrors.Discouraged

if ( -1 === $filtered_limit_int || ( $filtered_limit_int > $wp_max_limit_int && $filtered_limit_int > $current_limit_int ) ) {
if ( false !== @ini_set( 'memory_limit', $filtered_limit ) ) {
return $filtered_limit;
Expand All @@ -74,6 +77,9 @@ public static function raise_memory_limit() {
return false;
}
}

// phpcs:enable

return false;
}

Expand All @@ -85,7 +91,7 @@ public static function raise_memory_limit() {
* @param int $limit The time limit in seconds.
*/
public static function raise_time_limit( $limit = 0 ) {
$limit = (int) $limit;
$limit = (int) $limit;
$max_execution_time = (int) ini_get( 'max_execution_time' );

// If the max execution time is already set to zero (unlimited), there is no reason to make a further change.
Expand Down

0 comments on commit f7b2ece

Please sign in to comment.