/** * Runs the importer * * ## Options * * <region_name> * : The name of the region, case sensitive * * --nocache * : Ignores local cache * * @synopsis <region_name> [--nocache] */ public function import($args, $assoc_args) { $this->args = $args; $this->assoc_args = $assoc_args; $region_name = $this->args[0]; $ek_inst = Eve_Kill::init(); $region_id = $ek_inst->db->get_region_id($region_name); if (empty($region_id)) { $this->log("Cannot read region {$region_name} from the database.", 1); } $params = array(); if (!isset($assoc_args['nocache'])) { $after_id = $ek_inst->db->get_last_id(); if (!empty($after_id)) { $params['afterKillID'] = $after_id; } } if (isset($this->assoc_args['nocache'])) { $params['nocache'] = true; } $losses = $ek_inst->zkill->get_losses_by('region', $region_id, $params); if (empty($losses)) { $this->log('No losses', 1); } $this->progress_bar(count($losses)); foreach ($losses as $loss) { $ek_inst->db->insert_loss($loss); $this->progress_bar('tick'); } $this->progress_bar('finish'); }
public static function init() { if (is_null(self::$instance)) { self::$instance = new self(); } return self::$instance; }
/** * Builds the market tree using recursion */ function ek_market_tree() { $hash = md5('ek-market-tree'); $output = get_transient($hash); if (false == $output || isset($_GET['delete-trans'])) { $ek = Eve_Kill::init(); $parents = $ek->db->get_all_parent_market_groups(); $output = ''; if (!empty($parents)) { $output .= '<ul class="market-groups">'; foreach ($parents as $market_group) { $output .= sprintf('<li class="group-id-%1$s market-group" data-tip="%2$s"><div class="group-name">%3$s</div>', $market_group->marketGroupID, $market_group->description, $market_group->marketGroupName); $output .= ek_market_tree_children($market_group->marketGroupID); $output .= '</li>'; } $output .= '</ul>'; } set_transient($hash, $output, 30 * DAY_IN_SECONDS); } echo $output; }