PluginProbe ʕ •ᴥ•ʔ
Hostinger Reach – AI-Powered Email Marketing for WordPress / 1.7.0
Hostinger Reach – AI-Powered Email Marketing for WordPress v1.7.0
1.7.2 1.7.1 1.7.0 1.6.0 1.5.9 1.5.8 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 trunk 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6
hostinger-reach / vendor / woocommerce / action-scheduler / classes / ActionScheduler_Compatibility.php
hostinger-reach / vendor / woocommerce / action-scheduler / classes Last commit date
WP_CLI 9 months ago abstracts 9 months ago actions 9 months ago data-stores 9 months ago migration 9 months ago schedules 9 months ago schema 9 months ago ActionScheduler_ActionClaim.php 9 months ago ActionScheduler_ActionFactory.php 9 months ago ActionScheduler_AdminView.php 9 months ago ActionScheduler_AsyncRequest_QueueRunner.php 9 months ago ActionScheduler_Compatibility.php 9 months ago ActionScheduler_DataController.php 9 months ago ActionScheduler_DateTime.php 9 months ago ActionScheduler_Exception.php 9 months ago ActionScheduler_FatalErrorMonitor.php 9 months ago ActionScheduler_InvalidActionException.php 9 months ago ActionScheduler_ListTable.php 9 months ago ActionScheduler_LogEntry.php 9 months ago ActionScheduler_NullLogEntry.php 9 months ago ActionScheduler_OptionLock.php 9 months ago ActionScheduler_QueueCleaner.php 9 months ago ActionScheduler_QueueRunner.php 9 months ago ActionScheduler_RecurringActionScheduler.php 9 months ago ActionScheduler_SystemInformation.php 9 months ago ActionScheduler_Versions.php 9 months ago ActionScheduler_WPCommentCleaner.php 9 months ago ActionScheduler_wcSystemStatus.php 9 months ago
ActionScheduler_Compatibility.php
112 lines
1 <?php
2
3 /**
4 * Class ActionScheduler_Compatibility
5 */
6 class ActionScheduler_Compatibility {
7 /**
8 * Converts a shorthand byte value to an integer byte value.
9 *
10 * Wrapper for wp_convert_hr_to_bytes(), moved to load.php in WordPress 4.6 from media.php
11 *
12 * @link https://secure.php.net/manual/en/function.ini-get.php
13 * @link https://secure.php.net/manual/en/faq.using.php#faq.using.shorthandbytes
14 *
15 * @param string $value A (PHP ini) byte value, either shorthand or ordinary.
16 * @return int An integer byte value.
17 */
18 public static function convert_hr_to_bytes( $value ) {
19 if ( function_exists( 'wp_convert_hr_to_bytes' ) ) {
20 return wp_convert_hr_to_bytes( $value );
21 }
22
23 $value = strtolower( trim( $value ) );
24 $bytes = (int) $value;
25
26 if ( false !== strpos( $value, 'g' ) ) {
27 $bytes *= GB_IN_BYTES;
28 } elseif ( false !== strpos( $value, 'm' ) ) {
29 $bytes *= MB_IN_BYTES;
30 } elseif ( false !== strpos( $value, 'k' ) ) {
31 $bytes *= KB_IN_BYTES;
32 }
33
34 // Deal with large (float) values which run into the maximum integer size.
35 return min( $bytes, PHP_INT_MAX );
36 }
37
38 /**
39 * Attempts to raise the PHP memory limit for memory intensive processes.
40 *
41 * Only allows raising the existing limit and prevents lowering it.
42 *
43 * Wrapper for wp_raise_memory_limit(), added in WordPress v4.6.0
44 *
45 * @return bool|int|string The limit that was set or false on failure.
46 */
47 public static function raise_memory_limit() {
48 if ( function_exists( 'wp_raise_memory_limit' ) ) {
49 return wp_raise_memory_limit( 'admin' );
50 }
51
52 $current_limit = @ini_get( 'memory_limit' ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
53 $current_limit_int = self::convert_hr_to_bytes( $current_limit );
54
55 if ( -1 === $current_limit_int ) {
56 return false;
57 }
58
59 $wp_max_limit = WP_MAX_MEMORY_LIMIT;
60 $wp_max_limit_int = self::convert_hr_to_bytes( $wp_max_limit );
61 $filtered_limit = apply_filters( 'admin_memory_limit', $wp_max_limit );
62 $filtered_limit_int = self::convert_hr_to_bytes( $filtered_limit );
63
64 // phpcs:disable WordPress.PHP.IniSet.memory_limit_Blacklisted
65 // phpcs:disable WordPress.PHP.NoSilencedErrors.Discouraged
66
67 if ( -1 === $filtered_limit_int || ( $filtered_limit_int > $wp_max_limit_int && $filtered_limit_int > $current_limit_int ) ) {
68 if ( false !== @ini_set( 'memory_limit', $filtered_limit ) ) {
69 return $filtered_limit;
70 } else {
71 return false;
72 }
73 } elseif ( -1 === $wp_max_limit_int || $wp_max_limit_int > $current_limit_int ) {
74 if ( false !== @ini_set( 'memory_limit', $wp_max_limit ) ) {
75 return $wp_max_limit;
76 } else {
77 return false;
78 }
79 }
80
81 // phpcs:enable
82
83 return false;
84 }
85
86 /**
87 * Attempts to raise the PHP timeout for time intensive processes.
88 *
89 * Only allows raising the existing limit and prevents lowering it. Wrapper for wc_set_time_limit(), when available.
90 *
91 * @param int $limit The time limit in seconds.
92 */
93 public static function raise_time_limit( $limit = 0 ) {
94 $limit = (int) $limit;
95 $max_execution_time = (int) ini_get( 'max_execution_time' );
96
97 // If the max execution time is already set to zero (unlimited), there is no reason to make a further change.
98 if ( 0 === $max_execution_time ) {
99 return;
100 }
101
102 // Whichever of $max_execution_time or $limit is higher is the amount by which we raise the time limit.
103 $raise_by = 0 === $limit || $limit > $max_execution_time ? $limit : $max_execution_time;
104
105 if ( function_exists( 'wc_set_time_limit' ) ) {
106 wc_set_time_limit( $raise_by );
107 } 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
108 @set_time_limit( $raise_by ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
109 }
110 }
111 }
112