| @@ 82-91 (lines=10) @@ | ||
| 79 | * @param int $expiry Blog lock transient lifetime. |
|
| 80 | * @return boolean True if succeeded, false otherwise. |
|
| 81 | */ |
|
| 82 | public function attempt_request_lock( $blog_id, $expiry = self::BLOG_LOCK_TRANSIENT_EXPIRY ) { |
|
| 83 | $transient_name = $this->get_concurrent_request_transient_name( $blog_id ); |
|
| 84 | $locked_time = get_site_transient( $transient_name ); |
|
| 85 | if ( $locked_time ) { |
|
| 86 | return false; |
|
| 87 | } |
|
| 88 | set_site_transient( $transient_name, microtime( true ), $expiry ); |
|
| 89 | ||
| 90 | return true; |
|
| 91 | } |
|
| 92 | ||
| 93 | /** |
|
| 94 | * Retrieve the blog lock transient name for a particular blog. |
|
| @@ 764-773 (lines=10) @@ | ||
| 761 | * @param int $expiry enqueue transient lifetime. |
|
| 762 | * @return boolean True if succeeded, false otherwise. |
|
| 763 | */ |
|
| 764 | public function attempt_enqueue_lock( $expiry = self::ENQUEUE_LOCK_TRANSIENT_EXPIRY ) { |
|
| 765 | $transient_name = $this->get_concurrent_enqueue_transient_name(); |
|
| 766 | $locked_time = get_site_transient( $transient_name ); |
|
| 767 | if ( $locked_time ) { |
|
| 768 | return false; |
|
| 769 | } |
|
| 770 | set_site_transient( $transient_name, microtime( true ), $expiry ); |
|
| 771 | return true; |
|
| 772 | } |
|
| 773 | /** |
|
| 774 | * Retrieve the enqueue lock transient name for the current blog. |
|
| 775 | * |
|
| 776 | * @access public |
|