/** * Get the total activations for this product. * * @since 1.0 * * @return int */ public function get_total_active_activations() { if ($this->get_status() == self::STATUS_ARCHIVED) { return $this->get_meta('activations', true); } if (!$this->get_start_date()) { return 0; } $found = null; $total = wp_cache_get($this->get_pk(), 'itelic-release-active-activations', false, $found); if ($found === false) { $query = new Activations(array('status' => Activation::ACTIVE, 'product' => $this->get_product()->ID, 'activation' => array('before' => $this->get_start_date()->format('Y-m-d H:i:s')), 'return_value' => 'count')); $total = $query->get_total_items(); wp_cache_set($this->get_pk(), $total, 'itelic-release-active-activations'); } return $total; }