当前位置: 首页>>代码示例>>PHP>>正文


PHP time_elapsed函数代码示例

本文整理汇总了PHP中time_elapsed函数的典型用法代码示例。如果您正苦于以下问题:PHP time_elapsed函数的具体用法?PHP time_elapsed怎么用?PHP time_elapsed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了time_elapsed函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: start_process

 public function start_process()
 {
     if (!$this->path_to_xml_file) {
         return false;
     }
     if (!$this->valid_xml) {
         return false;
     }
     $this->archive_builder = new \eol_schema\ContentArchiveBuilder(array('directory_path' => DOC_ROOT . 'temp/xml_to_archive/'));
     $this->taxon_ids = array();
     $this->media_ids = array();
     $this->vernacular_name_ids = array();
     $this->reference_ids = array();
     $this->agent_ids = array();
     $reader = new \XMLReader();
     $file = file_get_contents($this->path_to_xml_file);
     $file = iconv("UTF-8", "UTF-8//IGNORE", $file);
     $reader->XML($file);
     $i = 0;
     while (@$reader->read()) {
         if ($reader->nodeType == \XMLReader::ELEMENT && $reader->name == "taxon") {
             $taxon_xml = $reader->readOuterXML();
             $t = simplexml_load_string($taxon_xml, null, LIBXML_NOCDATA);
             if ($t) {
                 $this->add_taxon_to_archive($t);
             }
             $i++;
             if ($i % 100 == 0) {
                 echo "Parsed taxon {$i} : " . time_elapsed() . "\n";
             }
             // if($i >= 5000) break;
         }
     }
     $this->archive_builder->finalize();
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:35,代码来源:XMLToArchive.php

示例2: lookup_block

 private function lookup_block($start, $limit)
 {
     $query = "SELECT tc.id taxon_concept_id, he.id hierarchy_entry_id, he.visibility_id, he.vetted_id, v.view_order vetted_view_order, h.id hierarchy_id, h.browsable, h.label\n            FROM taxon_concepts tc\n            STRAIGHT_JOIN hierarchy_entries he ON (tc.id=he.taxon_concept_id)\n            STRAIGHT_JOIN hierarchies h ON (he.hierarchy_id=h.id)\n            STRAIGHT_JOIN vetted v ON (he.vetted_id=v.id)\n            WHERE tc.id BETWEEN {$start} AND " . ($start + $limit) . " AND he.published=1";
     static $j = 0;
     $all_entries = array();
     foreach ($this->mysqli->iterate_file($query) as $row_num => $row) {
         if ($j % 50000 == 0) {
             echo "{$start} : {$j} : " . time_elapsed() . " : " . memory_get_usage() . "\n";
         }
         $j++;
         $taxon_concept_id = $row[0];
         $hierarchy_entry_id = $row[1];
         $visibility_id = $row[2];
         $vetted_id = $row[3];
         $vetted_view_order = $row[4];
         $hierarchy_id = $row[5];
         $browsable = $row[6];
         $label = $row[7];
         if (!$browsable) {
             $browsable = 0;
         }
         if ($browsable == 'NULL') {
             $browsable = 0;
         }
         if (@(!$all_entries[$taxon_concept_id])) {
             $all_entries[$taxon_concept_id] = array();
         }
         $all_entries[$taxon_concept_id][$hierarchy_id] = array('hierarchy_entry_id' => $hierarchy_entry_id, 'visibility_id' => $visibility_id, 'vetted_id' => $vetted_id, 'vetted_view_order' => $vetted_view_order, 'hierarchy_id' => $hierarchy_id, 'browsable' => $browsable, 'hierarchy_sort_order' => self::hierarchy_sort_order($label));
     }
     $curated_best_entries = $this->lookup_curated_best_entries($start, $limit);
     $this->sort_and_insert_best_entries($all_entries, $curated_best_entries);
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:32,代码来源:PreferredEntriesCalculator.php

示例3: lookup_names

 function lookup_names($start, $limit, &$taxon_concept_ids = array())
 {
     debug("querying names");
     $query = "SELECT n.id, n.string FROM names n WHERE n.id ";
     if ($taxon_concept_ids) {
         $query .= "IN (" . implode(",", $taxon_concept_ids) . ")";
     } else {
         $query .= "BETWEEN {$start} AND " . ($start + $limit);
     }
     static $i = 0;
     foreach ($this->mysqli_slave->iterate_file($query) as $row_num => $row) {
         if ($i % 100000 == 0) {
             echo "   ===> {$i} :: " . time_elapsed() . " :: " . memory_get_usage() . "\n";
         }
         $i++;
         $name_id = $row[0];
         $name_string = $row[1];
         if (preg_match("/[0-9]\\/[0-9]/", $name_string, $arr)) {
             if (Name::is_surrogate($name_string)) {
                 continue;
             }
             $canonical_form = trim($this->name_parser->lookup_string($name_string));
             echo "{$name_id}\t{$name_string}\t{$canonical_form}\n";
         }
     }
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:26,代码来源:NamesCheck.php

示例4: get_eol_photos

 public static function get_eol_photos($per_page, $page, $auth_token = "", $user_id = NULL, $start_date = NULL, $end_date = NULL)
 {
     global $used_image_ids;
     $response = self::pools_get_photos(FLICKR_EOL_GROUP_ID, "", $per_page, $page, $auth_token, $user_id, $start_date, $end_date);
     echo "\n page " . $response->photos->page . " of " . $response->photos->pages . " | total taxa =  " . $response->photos->total . "\n";
     echo "\n -- response count: " . count($response);
     echo "\n -- response photos count per page: " . count($response->photos->photo) . "\n";
     static $count_taxa = 0;
     $page_taxa = array();
     foreach ($response->photos->photo as $photo) {
         if (@$used_image_ids[$photo->id]) {
             continue;
         }
         $count_taxa++;
         echo "taxon {$count_taxa} ({$photo->id}): " . time_elapsed() . "\n";
         $taxa = self::get_taxa_for_photo($photo->id, $photo->secret, $photo->lastupdate, $auth_token, $user_id);
         if ($taxa) {
             foreach ($taxa as $t) {
                 $page_taxa[] = $t;
             }
         }
         $used_image_ids[$photo->id] = true;
     }
     return $page_taxa;
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:25,代码来源:FlickrAPI+orig.php

示例5: profile

function profile($str)
{
    if (!defined('PROFILE') || !PROFILE) {
        return;
    }
    echo time_elapsed() . ":{$str};";
}
开发者ID:nmatasci,项目名称:TNRSbatch,代码行数:7,代码来源:config.php

示例6: get_nodes

 public function get_nodes()
 {
     $path = $this->download_directory . "/nodes.dmp";
     foreach (new FileIterator($path) as $line_number => $line) {
         if ($line_number % 10000 == 0) {
             echo "{$line_number} :: " . time_elapsed() . " :: " . memory_get_usage() . "\n";
         }
         $line_data = explode("\t|", $line);
         $tax_id = trim($line_data[0]);
         $parent_tax_id = trim($line_data[1]);
         $rank = trim($line_data[2]);
         $comments = trim($line_data[12]);
         if (!is_numeric($tax_id)) {
             continue;
         }
         if (!is_numeric($parent_tax_id)) {
             continue;
         }
         if ($rank == "no rank") {
             $rank = "";
         }
         // tax_id 1 is a sudo-node named 'root'. Things with 1 as a parent are the real roots
         if ($parent_tax_id == 1) {
             $parent_tax_id = 0;
         }
         if (isset($this->taxon_names[$tax_id])) {
             $t = new \eol_schema\Taxon();
             $t->taxonID = $tax_id;
             $t->scientificName = $this->taxon_names[$tax_id];
             $t->parentNameUsageID = $parent_tax_id;
             $t->taxonRank = $rank;
             $t->taxonomicStatus = "valid";
             $t->taxonRemarks = $comments;
             $this->archive_builder->write_object_to_file($t);
             if (isset($this->taxon_synonyms[$tax_id])) {
                 foreach ($this->taxon_synonyms[$tax_id] as $name_class => $names) {
                     if (in_array($name_class, array("genbank common name", "common name", "blast name"))) {
                         foreach ($names as $name => $junk) {
                             $v = new \eol_schema\VernacularName();
                             $v->taxonID = $tax_id;
                             $v->vernacularName = $name;
                             $v->language = "en";
                             $this->archive_builder->write_object_to_file($v);
                         }
                     } else {
                         foreach ($names as $name => $junk) {
                             $t = new \eol_schema\Taxon();
                             $t->taxonID = $tax_id . "_syn_" . md5($name . $name_class);
                             $t->scientificName = $name;
                             $t->acceptedNameUsageID = $tax_id;
                             $t->taxonomicStatus = $name_class;
                             $this->archive_builder->write_object_to_file($t);
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:59,代码来源:NCBIConnector.php

示例7: index

 public function index()
 {
     $this->template->setTitle($this->lang->line('text_title'));
     $this->template->setHeading($this->lang->line('text_heading'));
     $this->template->setStyleTag(root_url('assets/js/daterange/daterangepicker-bs3.css'), 'daterangepicker-css', '100400');
     $this->template->setScriptTag(root_url('assets/js/daterange/moment.min.js'), 'daterange-moment-js', '1000451');
     $this->template->setScriptTag(root_url('assets/js/daterange/daterangepicker.js'), 'daterangepicker-js', '1000452');
     $this->template->setScriptTag(root_url('assets/js/Chart.min.js'), 'chart-min-js', '1000453');
     $data['total_menus'] = $this->Dashboard_model->getTotalMenus();
     $data['current_month'] = mdate('%Y-%m', time());
     $data['months'] = array();
     $pastMonth = date('Y-m-d', strtotime(date('Y-m-01') . ' -3 months'));
     $futureMonth = date('Y-m-d', strtotime(date('Y-m-01') . ' +3 months'));
     for ($i = $pastMonth; $i <= $futureMonth; $i = date('Y-m-d', strtotime($i . ' +1 months'))) {
         $data['months'][mdate('%Y-%m', strtotime($i))] = mdate('%F', strtotime($i));
     }
     $data['default_location_id'] = $this->config->item('default_location_id');
     $data['locations'] = array();
     $results = $this->Locations_model->getLocations();
     foreach ($results as $result) {
         $data['locations'][] = array('location_id' => $result['location_id'], 'location_name' => $result['location_name']);
     }
     $filter = array();
     $filter['page'] = '1';
     $filter['limit'] = '10';
     $data['activities'] = array();
     $this->load->model('Activities_model');
     $results = $this->Activities_model->getList($filter);
     foreach ($results as $result) {
         $data['activities'][] = array('activity_id' => $result['activity_id'], 'icon' => 'fa fa-tasks', 'message' => $result['message'], 'time' => mdate('%h:%i %A', strtotime($result['date_added'])), 'time_elapsed' => time_elapsed($result['date_added']), 'state' => $result['status'] === '1' ? 'read' : 'unread');
     }
     $data['top_customers'] = array();
     $results = $this->Dashboard_model->getTopCustomers($filter);
     foreach ($results as $result) {
         $data['top_customers'][] = array('first_name' => $result['first_name'], 'last_name' => $result['last_name'], 'total_orders' => $result['total_orders'], 'total_sale' => $result['total_sale']);
     }
     $filter = array();
     $filter['page'] = '';
     $filter['limit'] = 10;
     $filter['sort_by'] = 'orders.date_added';
     $filter['order_by'] = 'DESC';
     $data['order_by_active'] = 'DESC';
     $data['orders'] = array();
     $this->load->model('Orders_model');
     $results = $this->Orders_model->getList($filter);
     foreach ($results as $result) {
         $current_date = mdate('%d-%m-%Y', time());
         $date_added = mdate('%d-%m-%Y', strtotime($result['date_added']));
         if ($current_date === $date_added) {
             $date_added = $this->lang->line('text_today');
         } else {
             $date_added = mdate('%d %M %y', strtotime($date_added));
         }
         $data['orders'][] = array('order_id' => $result['order_id'], 'location_name' => $result['location_name'], 'first_name' => $result['first_name'], 'last_name' => $result['last_name'], 'order_status' => $result['status_name'], 'status_color' => $result['status_color'], 'order_time' => mdate('%H:%i', strtotime($result['order_time'])), 'order_type' => $result['order_type'] === '1' ? $this->lang->line('text_delivery') : $this->lang->line('text_collection'), 'date_added' => $date_added, 'edit' => site_url('orders/edit?id=' . $result['order_id']));
     }
     $this->template->render('dashboard', $data);
 }
开发者ID:labeetotrent,项目名称:latthiya,代码行数:57,代码来源:Dashboard.php

示例8: get_all_taxa

 public function get_all_taxa()
 {
     if (!file_exists(DOC_ROOT . 'tmp/natureserve')) {
         mkdir(DOC_ROOT . 'tmp/natureserve');
     }
     if (!file_exists(DOC_ROOT . 'tmp/natureserve/images')) {
         mkdir(DOC_ROOT . 'tmp/natureserve/images');
     }
     $this->archive_builder = new \eol_schema\ContentArchiveBuilder(array('directory_path' => DOC_ROOT . "/temp/dwc_archive_test/"));
     $species_list_path = DOC_ROOT . "update_resources/connectors/files/natureserve_species_list.xml";
     shell_exec("rm -f {$species_list_path}");
     shell_exec("curl " . self::SPECIES_LIST_URL . " -o {$species_list_path}");
     $reader = new \XMLReader();
     $reader->open($species_list_path);
     $records = array();
     while (@$reader->read()) {
         if ($reader->nodeType == \XMLReader::ELEMENT && $reader->name == "DATA_RECORD") {
             $record = simplexml_load_string($reader->readOuterXML(), null, LIBXML_NOCDATA);
             $records[] = (string) $record->EGT_UID;
         }
     }
     echo "Total Records: " . count($records) . "\n";
     $chunk_size = 1;
     // shuffle($records);
     // array_unshift($records, 'ELEMENT_GLOBAL.2.104470'); // Bald eagle
     array_unshift($records, 'ELEMENT_GLOBAL.2.102211');
     // Polar bear
     // array_unshift($records, 'ELEMENT_GLOBAL.2.106470'); // bobcat - Lynx rufus
     // array_unshift($records, 'ELEMENT_GLOBAL.2.104731'); // striped bass - Morone saxatilis
     array_unshift($records, 'ELEMENT_GLOBAL.2.105926');
     // American Bullfrog
     array_unshift($records, 'ELEMENT_GLOBAL.2.104777');
     // White tailed deer
     array_unshift($records, 'ELEMENT_GLOBAL.2.100925');
     // golden eagle
     $records = array_unique($records);
     $chunks = array_chunk($records, $chunk_size);
     $i = 0;
     $start_time = time_elapsed();
     foreach ($chunks as $chunk) {
         $this->lookup_multiple_ids($chunk);
         // if($i % 500 == 0) print_r($this->archive_builder->file_columns);
         $i += $chunk_size;
         if ($i % 100 == 0) {
             $estimated_total_time = (time_elapsed() - $start_time) / $i * count($records);
             echo "Time spent ({$i} records) " . time_elapsed() . "\n";
             echo "Estimated total seconds : {$estimated_total_time}\n";
             echo "Estimated total hours : " . $estimated_total_time / (60 * 60) . "\n";
             echo "Memory : " . memory_get_usage() . "\n";
         }
         // if($i >= 100) break;
     }
     $this->archive_builder->finalize();
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:54,代码来源:NatureServeAPI.php

示例9: latest

 public function latest()
 {
     $filter = array();
     $filter['page'] = '1';
     $filter['limit'] = '10';
     $data['activities'] = array();
     $results = $this->Activities_model->getList($filter);
     foreach ($results as $result) {
         $data['activities'][] = array('activity_id' => $result['activity_id'], 'icon' => 'fa fa-tasks', 'message' => $result['message'], 'time' => mdate('%h:%i %A', strtotime($result['date_added'])), 'time_elapsed' => time_elapsed($result['date_added']), 'state' => $result['status'] === '1' ? 'read' : 'unread');
     }
     $this->template->render('activities_latest', $data);
 }
开发者ID:AKCore,项目名称:TastyIgniter,代码行数:12,代码来源:Activities.php

示例10: newsitem

function newsitem($profile_pic, $from, $to, $message, $picture, $name, $link, $caption, $description, $icon, $time, $comments, $likes)
{
    if ($to) {
        $to_section = '<div class="to" >to</div><div class="news-friend-name"><strong><a>' . $to . '</a></strong></div><div class="clear"></div>';
    } else {
        $to_section = '';
    }
    if ($message) {
        $message_section = '<div class="message">' . $message . '</div>';
    } else {
        $message_section = '';
    }
    if ($picture) {
        $picture_section = '<div class="external-image"><img src="' . $picture . '"/></div><div class="news-external">';
    } else {
        $picture_section = '<div class="news-external" style="width: 410px;">';
    }
    if (!$link) {
        $link = '#';
    }
    if ($name) {
        $name_section = '<div class="news-title"><h3><a href="' . $link . '" target="_blank">' . $name . '</a></h3></div>';
    } else {
        $name_section = '';
    }
    if ($caption) {
        $caption_section = '<div class="news-caption"><i>' . $caption . '</i></div>';
    } else {
        $caption_section = '';
    }
    if ($description) {
        $description_section = '<div class="news-desc">' . $description . '</div>';
    } else {
        $description_section = '';
    }
    if ($icon) {
        $icon_section = '<div class="news-icon" ><img src="' . $icon . '" /></div>';
    } else {
        $icon_section = '';
    }
    $time_converted = time_elapsed($time);
    $news = '<div class="news">
						<div class="news-friend-thumb"><img src="' . $profile_pic . '"/></div>
						<div class="news-content">
							<div class="news-friend-name"><strong><a>' . $from . '</a></strong></div>' . $to_section . '<div class="clear"></div>' . $message_section . $picture_section . $name_section . $caption_section . $description_section . '</div>
							<div class="clear"></div>
							<div class="comment-like">' . $icon_section . $time_converted . ' ago  ·  ' . $comments . ' comments  ·  ' . $likes . ' likes</div>
						</div>
					</div>';
    return $news;
}
开发者ID:neelkamal0666,项目名称:FosterGemNews,代码行数:51,代码来源:index.php

示例11: begin_calculating

 public function begin_calculating($taxon_concept_ids = null, $range = null)
 {
     $GLOBALS['top_taxa'] = array();
     $all_scores = array();
     $batches = array(1);
     if ($taxon_concept_ids) {
         $batches = array_chunk($taxon_concept_ids, 10000);
     }
     foreach ($batches as $batch) {
         $query = "SELECT taxon_concept_id, image_trusted, image_unreviewed, text_trusted, text_unreviewed, text_trusted_words, text_unreviewed_words, video_trusted, video_unreviewed, sound_trusted, sound_unreviewed, flash_trusted, flash_unreviewed, youtube_trusted, youtube_unreviewed, iucn_total, data_object_references, info_items, content_partners, has_GBIF_map, BHL_publications, user_submitted_text FROM taxon_concept_metrics";
         if ($taxon_concept_ids) {
             $query .= " WHERE taxon_concept_id IN (" . implode($batch, ",") . ")";
         } elseif ($range) {
             $query .= " WHERE taxon_concept_id BETWEEN {$range}";
         }
         foreach ($this->mysqli_slave->iterate_file($query) as $row_num => $row) {
             static $i = 0;
             if ($i == 0) {
                 echo "QUERY IS DONE (" . time_elapsed() . ")\n";
             }
             $i++;
             if ($i % 10000 == 0) {
                 echo "{$i}: " . memory_get_usage() . "\n";
             }
             $taxon_concept_id = $row[0];
             $this_scores = $this->calculate_score_from_row($row);
             // if($this_scores['total'] >= .5) $all_scores[$taxon_concept_id] = $this_scores;
             $all_scores[$taxon_concept_id] = $this_scores['total'];
         }
     }
     echo "CALCULATIONS ARE DONE (" . time_elapsed() . ") {$range}\n";
     // uasort($all_scores, array('self', 'sort_by_total_score'));
     static $num = 0;
     // $OUT = fopen(DOC_ROOT . '/tmp/richness.txt', 'w+');
     // fwrite($OUT, "RANK\tID\tNAME\tBREADTH\tDEPTH\tDIVERSITY\tTOTAL\n");
     // foreach($all_scores as $id => $scores)
     // {
     //     $num++;
     //     // if($num >= 2500) break;
     //     $str = "$num\t$id\t" . TaxonConcept::get_name($id) ."\t";
     //     $str .= $scores['breadth'] / TaxonConceptMetric::$BREADTH_WEIGHT ."\t";
     //     $str .= $scores['depth'] / TaxonConceptMetric::$DEPTH_WEIGHT ."\t";
     //     $str .= $scores['diversity'] / TaxonConceptMetric::$DIVERSITY_WEIGHT ."\t";
     //     $str .= $scores['total']."\n";
     //     fwrite($OUT, $str);
     // }
     // fclose($OUT);
     return $all_scores;
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:49,代码来源:PageRichnessCalculator.php

示例12: run_stats_gathering_methods

 function run_stats_gathering_methods($methods_to_run, $single_method_to_run = null)
 {
     foreach ($methods_to_run as $method) {
         if ($single_method_to_run && $method != $single_method_to_run) {
             continue;
         }
         $time_start = time_elapsed();
         echo "Calling {$method}\n";
         // create and/or truncate the stats file for this category
         $this->initialize_category_file($method);
         call_user_func(array($this, $method));
         echo "Finished {$method}\n";
         echo "in " . round((time_elapsed() - $time_start) / 60, 2) . " minutes\n\n";
     }
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:15,代码来源:TaxonPageMetricsNew.php

示例13: start

 public static function start($resource_file = null)
 {
     // $document_list_html = Functions::get_remote_file(self::DOCUMENT_LIST);
     $document_list_html = file_get_contents('plazii.html');
     if (preg_match_all("/<a href=\"((http:\\/\\/plazi.cs.umb.edu\\/exist\\/rest\\/db\\/taxonx_docs\\/plazi\\/(.*?))\\?_xsl.*?)\">(.*)<\\/a>/", $document_list_html, $matches, PREG_SET_ORDER)) {
         $count = 0;
         foreach ($matches as $match) {
             $xml_with_stylesheet_url = $match[1];
             $xml_url = $match[2];
             $xml_filename = $match[3];
             echo "{$xml_with_stylesheet_url}\n";
             self::get_metadata($xml_with_stylesheet_url);
             $xml = Functions::lookup_with_cache($xml_url, array('validation_regex' => 'xmlns:'));
             $count += 1;
             echo "\n   >>>>>>>> COUNT: {$count} >> " . time_elapsed() . "\n\n";
             // if($count >= 400) break;
         }
     }
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:19,代码来源:Plazi.php

示例14: read_data

 public function read_data()
 {
     $this->column_labels = array();
     $this->column_indices = array();
     foreach (new FileIterator($this->text_path["obis"]["ranges_OBIS"]) as $line_number => $line) {
         if ($line_number % 1000 == 0) {
             echo "{$line_number} :: " . time_elapsed() . " :: " . memory_get_usage() . "\n";
         }
         $line_data = ContentArchiveReader::line_to_array($line, ",", "\"");
         if ($line_number == 0) {
             $this->column_labels = $line_data;
             foreach ($this->column_labels as $k => $v) {
                 $this->column_indices[$v] = $k;
             }
             continue;
         }
         $this->process_line_data($line_data);
     }
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:19,代码来源:ObisDataConnector.php

示例15: lookup_block2

 private function lookup_block2($start, $limit)
 {
     $query = "SELECT tc.id taxon_concept_id, he.id hierarchy_entry_id, he.identifier, he.source_url, h.label, h.outlink_uri, r.title, h.id FROM taxon_concepts tc JOIN hierarchy_entries he ON (tc.id=he.taxon_concept_id) JOIN hierarchies h ON (he.hierarchy_id=h.id) LEFT JOIN resources r ON (h.id=r.hierarchy_id) WHERE tc.id BETWEEN {$start} AND " . ($start + $limit) . " AND he.published=1 AND he.visibility_id=1";
     static $j = 0;
     $concept_links = array();
     $links_from_hierarchy = array();
     foreach ($this->mysqli->iterate_file($query) as $row_num => $row) {
         if ($j % 50000 == 0) {
             echo "{$start} : {$j} : " . time_elapsed() . " : " . memory_get_usage() . "\n";
         }
         $j++;
         $taxon_concept_id = $row[0];
         $hierarchy_id = $row[7];
         if (@(!$concept_links[$taxon_concept_id])) {
             $concept_links[$taxon_concept_id] = array();
         }
         if (@$links_from_hierarchy[$taxon_concept_id][$hierarchy_id]) {
             continue;
         }
         if ($link = $this->prepare_link($row)) {
             fwrite($this->LINKS_OUT, "{$taxon_concept_id}\t" . $link['title'] . "\t" . $link['url'] . "\n");
             $concept_links[$taxon_concept_id][] = $link;
             $links_from_hierarchy[$taxon_concept_id][$hierarchy_id] = 1;
         }
         // $all_entries[$taxon_concept_id][$hierarchy_id] = array(
         //     'hierarchy_entry_id' => $hierarchy_entry_id,
         //     'visibility_id' => $visibility_id,
         //     'vetted_id' => $vetted_id,
         //     'vetted_view_order' => $vetted_view_order,
         //     'hierarchy_id' => $hierarchy_id,
         //     'browsable' => $browsable);
     }
     // foreach($concept_links as $taxon_concept_id => $links)
     // {
     //     if(!$links) continue;
     //     usort($links, array("php_active_record\GoogleDumpPreparer", "sort_by_title"));
     //     // echo "$taxon_concept_id\n";
     //     // print_r($links);
     //
     // }
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:41,代码来源:GoogleDumpPreparerOriginal.php


注:本文中的time_elapsed函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。