/** * Check if all tables exists * * @since 1.1.0 * @since 0.3.0 in class ingot_boostrap * * @access protected * * @return bool */ public static function check_if_tables_exist() { if (!self::table_exists(\ingot\testing\crud\tracking::get_table_name()) || !self::table_exists(\ingot\testing\crud\group::get_table_name()) || !self::table_exists(\ingot\testing\crud\session::get_table_name()) || !self::table_exists(\ingot\testing\crud\variant::get_table_name())) { return false; } return true; }
/** * Find number of sessions in a range * * @access protected * * @since 1.1.0 * * @param int $max Max range timestamp * @param int $min Min range timestap * @param bool $unique Optional. To get unique values or not. Default is true. * * @return int */ protected function find_range($max, $min, $unique = true) { $min = $this->time_to_string($min); $max = $this->time_to_string($max); global $wpdb; $table_name = session::get_table_name(); if ($unique) { $select = 'DISTINCT `ingot_ID`'; } else { $select = '`ID`'; } $sql = sprintf('SELECT %s FROM `%s` WHERE `created` BETWEEN "%s" AND "%s"', $select, $table_name, $min, $max); $results = $wpdb->query($sql, ARRAY_A); if (is_int($results)) { return $results; } elseif (is_array($results) && !empty($results)) { return count($results); } else { return 0; } }