PluginProbe ʕ •ᴥ•ʔ
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin / 2.1.1
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin v2.1.1
4.9.0 0.9.6 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.6.0 1.6.2 1.7.0 1.7.1 1.8.0 1.8.1 1.9.0 2.0.0 2.0.1 2.1.1 2.2.1 2.3.1 2.4.0 2.5.0 2.5.1 2.6.0 2.7.0 2.8.0 2.9.0 3.0.1 3.0.2 3.0.3 3.1.0 3.10.0 3.11.0 3.11.1 3.2.0 3.2.1 3.3.0 3.4.0 3.5.0 3.5.1 3.5.2 3.6.1 3.7.0 3.8.0 3.8.2 3.9.0 4.0.1 4.1.0 4.1.1 4.2.0 4.3.0 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.8.0 trunk 0.10.0 0.10.1 0.11.1 0.11.2 0.3.1 0.3.2 0.4 0.4.1 0.4.2 0.5.0 0.5.1 0.5.2 0.6 0.7 0.8 0.8.2 0.8.3 0.8.4 0.8.5 0.8.6 0.8.7 0.9.0 0.9.1 0.9.2 0.9.3 0.9.4 0.9.5
wp-mail-smtp / vendor / woocommerce / action-scheduler / classes / ActionScheduler_OptionLock.php
wp-mail-smtp / vendor / woocommerce / action-scheduler / classes Last commit date
WP_CLI 6 years ago abstracts 6 years ago actions 6 years ago data-stores 6 years ago migration 6 years ago schedules 6 years ago schema 6 years ago ActionScheduler_ActionClaim.php 6 years ago ActionScheduler_ActionFactory.php 6 years ago ActionScheduler_AdminView.php 6 years ago ActionScheduler_AsyncRequest_QueueRunner.php 6 years ago ActionScheduler_Compatibility.php 6 years ago ActionScheduler_DataController.php 6 years ago ActionScheduler_DateTime.php 6 years ago ActionScheduler_Exception.php 6 years ago ActionScheduler_FatalErrorMonitor.php 6 years ago ActionScheduler_InvalidActionException.php 6 years ago ActionScheduler_ListTable.php 6 years ago ActionScheduler_LogEntry.php 6 years ago ActionScheduler_NullLogEntry.php 6 years ago ActionScheduler_OptionLock.php 6 years ago ActionScheduler_QueueCleaner.php 6 years ago ActionScheduler_QueueRunner.php 6 years ago ActionScheduler_Versions.php 6 years ago ActionScheduler_WPCommentCleaner.php 6 years ago ActionScheduler_wcSystemStatus.php 6 years ago
ActionScheduler_OptionLock.php
50 lines
1 <?php
2
3 /**
4 * Provide a way to set simple transient locks to block behaviour
5 * for up-to a given duration.
6 *
7 * Class ActionScheduler_OptionLock
8 * @since 3.0.0
9 */
10 class ActionScheduler_OptionLock extends ActionScheduler_Lock {
11
12 /**
13 * Set a lock using options for a given amount of time (60 seconds by default).
14 *
15 * Using an autoloaded option avoids running database queries or other resource intensive tasks
16 * on frequently triggered hooks, like 'init' or 'shutdown'.
17 *
18 * For example, ActionScheduler_QueueRunner->maybe_dispatch_async_request() uses a lock to avoid
19 * calling ActionScheduler_QueueRunner->has_maximum_concurrent_batches() every time the 'shutdown',
20 * hook is triggered, because that method calls ActionScheduler_QueueRunner->store->get_claim_count()
21 * to find the current number of claims in the database.
22 *
23 * @param string $lock_type A string to identify different lock types.
24 * @bool True if lock value has changed, false if not or if set failed.
25 */
26 public function set( $lock_type ) {
27 return update_option( $this->get_key( $lock_type ), time() + $this->get_duration( $lock_type ) );
28 }
29
30 /**
31 * If a lock is set, return the timestamp it was set to expiry.
32 *
33 * @param string $lock_type A string to identify different lock types.
34 * @return bool|int False if no lock is set, otherwise the timestamp for when the lock is set to expire.
35 */
36 public function get_expiration( $lock_type ) {
37 return get_option( $this->get_key( $lock_type ) );
38 }
39
40 /**
41 * Get the key to use for storing the lock in the transient
42 *
43 * @param string $lock_type A string to identify different lock types.
44 * @return string
45 */
46 protected function get_key( $lock_type ) {
47 return sprintf( 'action_scheduler_lock_%s', $lock_type );
48 }
49 }
50