set(!$this->get()); } public function get() { return get_option("_ACTIONWEAR_LAST_RESYNCED_PRODUCTS", 0); } public function validate($v): bool { return is_bool($v); } public function set($value) { global $wpdb; if (!$this->validate($value)) throw new \Exception("Only boolean values are accepted to this setting"); try { Product::generateImages(); } catch (\Exception $e) { Log::write($e->getMessage(), Log::ERROR, Log::CONTEXT_PRODUCT_CREATION); } $skus = Sync::getRealWoocommerceProducts(); foreach ($skus as $sku) { \AC_SYNC\Includes\Classes\Async\Action_Wear_Job_Queue::push('images_update', ['sku' => $sku], 20, null, 'images_update'); } return true; } } }