first commit

This commit is contained in:
2023-09-12 21:41:04 +02:00
commit 3361a7f053
13284 changed files with 2116755 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
<?php
namespace WPML\TM\ATE\ClonedSites;
class Lock {
const CLONED_SITE_OPTION = 'otgs_wpml_tm_ate_cloned_site_lock';
public function lock( $lockData ) {
if ( $this->isLockDataPresent( $lockData ) ) {
update_option(
self::CLONED_SITE_OPTION,
[
'stored_fingerprint' => $lockData['stored_fingerprint'],
'received_fingerprint' => $lockData['received_fingerprint'],
'fingerprint_confirmed' => $lockData['fingerprint_confirmed'],
],
'no'
);
}
}
private function isLockDataPresent( $lockData ) {
return isset( $lockData['stored_fingerprint'] )
&& isset( $lockData['received_fingerprint'] )
&& isset( $lockData['fingerprint_confirmed'] );
}
public function unlock() {
delete_option( self::CLONED_SITE_OPTION );
}
public static function isLocked() {
return (bool) get_option( self::CLONED_SITE_OPTION, false ) && \WPML_TM_ATE_Status::is_enabled();
}
}