??????????????
??????????????
??????????????
??????????????
Warning : Undefined variable $auth in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
Warning : Trying to access array offset on value of type null in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
??????????????
??????????????
??????????????
??????????????
File Manager
✏️ Edit File: /home/mklsvubc/koilplta.co.uk/wp-content/plugins/wordpress-seo/src/helpers/lock-helper.php
⬅ Kembali
<?php
namespace Yoast\WP\SEO\Helpers;
use Yoast\WP\SEO\Exceptions\Locking\Lock_Timeout_Exception;
use Yoast\WP\SEO\Expiring_Store\Application\Expiring_Store;
/**
* Distributed exclusive lock backed by the expiring store.
*
* Acquires a network-scoped lock in the expiring store table, executes the
* callback, and releases the lock in a finally block.
*
* The lock has a TTL so that it self-expires if the owning process crashes without
* releasing it. Other processes retry with a configurable delay between attempts.
*/
class Lock_Helper {
/**
* The expiring store.
*
* @var Expiring_Store
*/
private $store;
/**
* The constructor.
*
* @param Expiring_Store $store The expiring store.
*/
public function __construct( Expiring_Store $store ) {
$this->store = $store;
}
/**
* Acquires a lock, executes the callback, and releases the lock.
*
* @template T
*
* @param string $lock_key The lock key.
* @param callable(): T $callback The callback to execute while holding the lock.
* @param int $ttl_in_seconds The lock TTL in seconds. Defaults to 30.
* @param int $max_attempts The maximum number of acquisition attempts. Defaults to 5.
* @param int $retry_delay_microseconds The delay between attempts in microseconds. Defaults to 20000 (20ms).
*
* @return T The callback's return value.
* @throws Lock_Timeout_Exception When the lock cannot be acquired within the allowed attempts.
*/
public function execute( string $lock_key, callable $callback, int $ttl_in_seconds = 30, int $max_attempts = 5, int $retry_delay_microseconds = 20_000 ) {
$this->acquire( $lock_key, $ttl_in_seconds, $max_attempts, $retry_delay_microseconds );
try {
return $callback();
}
finally {
$this->store->delete_for_multisite( $lock_key );
}
}
/**
* Attempts to acquire the lock with retries.
*
* @param string $lock_key The lock key.
* @param int $ttl_in_seconds The lock TTL in seconds.
* @param int $max_attempts The maximum number of attempts.
* @param int $retry_delay_microseconds The delay between attempts in microseconds.
*
* @return void
* @throws Lock_Timeout_Exception When all attempts are exhausted.
*/
private function acquire( string $lock_key, int $ttl_in_seconds, int $max_attempts, int $retry_delay_microseconds ): void {
for ( $attempt = 1; $attempt <= $max_attempts; $attempt++ ) {
if ( $this->store->persist_if_absent_for_multisite( $lock_key, true, $ttl_in_seconds ) ) {
return;
}
if ( $attempt < $max_attempts ) {
\usleep( $retry_delay_microseconds );
}
}
// phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- This is an exception message, not output.
throw new Lock_Timeout_Exception( $lock_key, $max_attempts );
}
}
Nama
Tipe
Ukuran
Diubah
Aksi
📁 open-graph
dir
—
2026-06-24 10:05
📁 schema
dir
—
2026-06-24 10:05
📁 twitter
dir
—
2026-06-24 10:05
🐘 aioseo-helper.php
php
1.2 KB
2025-04-07 13:46
🐘 asset-helper.php
php
2.5 KB
2024-03-05 17:08
🐘 attachment-cleanup-helper.php
php
2.2 KB
2023-02-07 14:53
🐘 author-archive-helper.php
php
5.2 KB
2025-04-07 13:46
🐘 blocks-helper.php
php
2.3 KB
2022-11-29 19:15
🐘 capability-helper.php
php
2.1 KB
2020-09-01 16:27
🐘 crawl-cleanup-helper.php
php
8.1 KB
2026-02-17 17:17
🐘 curl-helper.php
php
655 B
2022-09-01 10:45
🐘 current-page-helper.php
php
15.6 KB
2026-02-17 17:17
🐘 date-helper.php
php
3.1 KB
2021-12-21 15:29
🐘 environment-helper.php
php
793 B
2022-11-29 19:15
🐘 first-time-configuration-notice-helper.php
php
5.4 KB
2025-12-02 18:31
🐘 home-url-helper.php
php
681 B
2026-02-17 17:17
🐘 image-helper.php
php
11.7 KB
2024-09-24 13:30
🐘 import-cursor-helper.php
php
1.4 KB
2025-04-07 13:46
🐘 import-helper.php
php
716 B
2022-04-05 17:50
🐘 indexable-helper.php
php
9.2 KB
2025-10-08 18:12
🐘 indexable-to-postmeta-helper.php
php
6.8 KB
2025-04-07 13:46
🐘 indexing-helper.php
php
12.7 KB
2026-02-17 17:17
🐘 language-helper.php
php
2.7 KB
2023-01-10 17:05
🐘 lock-helper.php
php
2.8 KB
2026-05-12 16:03
🐘 meta-helper.php
php
2.9 KB
2022-01-25 15:16
🐘 notification-helper.php
php
2 KB
2026-02-17 17:17
🐘 options-helper.php
php
4.6 KB
2026-01-07 16:32
🐘 pagination-helper.php
php
5.7 KB
2025-04-07 13:46
🐘 permalink-helper.php
php
1.6 KB
2026-02-04 19:42
🐘 post-helper.php
php
5.4 KB
2025-04-07 13:46
🐘 post-type-helper.php
php
7.2 KB
2026-02-17 17:17
🐘 primary-term-helper.php
php
1.4 KB
2024-01-19 15:31
🐘 product-helper.php
php
1.1 KB
2023-08-08 16:52
🐘 redirect-helper.php
php
1.7 KB
2026-02-17 17:17
🐘 require-file-helper.php
php
326 B
2025-04-07 13:46
🐘 robots-helper.php
php
1.7 KB
2025-04-07 13:46
🐘 robots-txt-helper.php
php
3.4 KB
2026-04-14 14:10
🐘 route-helper.php
php
694 B
2025-12-02 18:31
🐘 sanitization-helper.php
php
1 KB
2022-01-25 15:16
🐘 score-icon-helper.php
php
2.8 KB
2023-05-09 13:01
🐘 short-link-helper.php
php
3.5 KB
2025-04-07 13:46
🐘 site-helper.php
php
566 B
2021-03-22 17:43
🐘 social-profiles-helper.php
php
10.7 KB
2026-02-17 17:17
🐘 string-helper.php
php
1.2 KB
2022-01-25 15:16
🐘 taxonomy-helper.php
php
5 KB
2023-01-24 15:07
🐘 url-helper.php
php
8.1 KB
2026-02-17 17:17
🐘 user-helper.php
php
3.9 KB
2024-12-03 16:05
🐘 wincher-helper.php
php
2.5 KB
2023-06-13 14:02
🐘 woocommerce-helper.php
php
1.3 KB
2026-02-17 17:17
🐘 wordpress-helper.php
php
512 B
2021-07-07 18:45
🐘 wpdb-helper.php
php
937 B
2025-04-07 13:46