function extract_kw_tc_links($source_db, $target_db, $tmp_table_name, &$migrator) { $tc_count = $migrator->get_tmp_table_count(); $map_prod_kw_tc = null; $step_amt = 500; $items_processed = 0; // Make sure we have enough memory to do what we are about to do check_memory($tc_count); // testcase nodes have to be done separately from tcversions because the version // inserts a new node while ($items_processed < $tc_count) { $query = "SELECT * FROM {$tmp_table_name} ORDER BY id LIMIT {$items_processed},{$step_amt}"; $items = $source_db->fetchRowsIntoMap($query, 'id'); foreach ($items as $tcid => $value) { $the_kw = trim($value['keywords']); if (strlen($the_kw) > 0) { $akeywords = explode(',', $the_kw); foreach ($akeywords as $vkw) { $the_vkm = trim($vkw); if (strlen($the_vkm) > 0) { // 20070208 - francisco.mancardi@gruppotesi.com $map_prod_kw_tc[$value['prodid']][$the_vkm][] = $tcid; //$map_kw_tc[$the_vkm][$tcid]=$value['prodid']; } } } ++$items_processed; } } return $map_prod_kw_tc; }
?> </td> <td><?php echo check_memory($item['mem_total']); ?> </td> <td><?php echo check_memory($item['mem_free']); ?> </td> <td><?php echo check_memory($item['swap_total']); ?> </td> <td><?php echo check_memory($item['swap_avail']); ?> </td> <td><?php echo $item['disk_io_reads_total']; ?> </td> <td><?php echo $item['disk_io_writes_total']; ?> </td> <td><?php echo format_bytes($item['net_in_bytes_total']); ?> </td> <td><?php
legend: { show:true, location: 'e' } } ); }); $(document).ready(function(){ var data = [ ["swap_used (<?php echo check_memory($last_record['swap_total'] - $last_record['swap_avail']); ?> )",<?php echo $last_record['swap_total'] - $last_record['swap_avail']; ?> ], ["swap_avail (<?php echo check_memory($last_record['swap_avail']); ?> )",<?php echo $last_record['swap_avail']; ?> ] ]; var plot1 = jQuery.jqplot ('disk_swap', [data], { seriesColors: [ "#4bb2c5", "#EAA228", "#579575", "#839557", "#958c12", "#953579", "#4b5de4", "#d8b83f", "#ff5800", "#0085cc"], // 默认显示的分类颜色, title: { text: "<?php echo $cur_host; ?> swap utilization rate", // 设置当前图的标题
/** * Rebuild counters, and lastpost information right after importing posts * */ public function counters_cleanup() { global $db, $output, $import_session; $output->print_header("Rebuilding Counters"); $this->debug->log->trace0("Rebuilding thread, forum, and statistic counters"); $output->construct_progress_bar(); echo "<br />\nRebuilding thread, forum, and statistic counters...(This may take a while)<br /><br />\n"; echo "<br />\nRebuilding thread counters... "; flush(); // Rebuild thread counters, forum counters, user post counters, last post* and thread username $query = $db->simple_select("threads", "COUNT(*) as count", "import_tid != 0"); $num_imported_threads = $db->fetch_field($query, "count"); $progress = $last_percent = 0; if ($import_session['counters_cleanup_start'] < $num_imported_threads) { $this->debug->log->trace1("Rebuilding thread counters"); $progress = $import_session['counters_cleanup_start']; $query = $db->simple_select("threads", "tid", "import_tid != 0", array('order_by' => 'tid', 'order_dir' => 'asc', 'limit_start' => intval($import_session['counters_cleanup_start']), 'limit' => 1000)); while ($thread = $db->fetch_array($query)) { rebuild_thread_counters($thread['tid']); ++$progress; if ($progress % 5 == 0) { if ($progress % 100 == 0) { check_memory(); } $percent = round($progress / $num_imported_threads * 100, 1); if ($percent != $last_percent) { $output->update_progress_bar($percent, "Rebuilding counters for thread #{$thread['tid']}"); } $last_percent = $percent; } } $import_session['counters_cleanup_start'] += $progress; if ($import_session['counters_cleanup_start'] >= $num_imported_threads) { $this->debug->log->trace1("Finished rebuilding thread counters"); $import_session['counters_cleanup'] = 0; echo "done."; flush(); return; } $import_session['counters_cleanup'] = 1; return; } if ($import_session['counters_cleanup_start'] >= $num_imported_threads) { $this->debug->log->trace1("Rebuilding forum counters"); echo "done. <br />Rebuilding forum counters... "; flush(); $query = $db->simple_select("forums", "COUNT(*) as count", "import_fid != 0"); $num_imported_forums = $db->fetch_field($query, "count"); $progress = 0; $query = $db->simple_select("forums", "fid", "import_fid != 0", array('order_by' => 'fid', 'order_dir' => 'asc')); while ($forum = $db->fetch_array($query)) { rebuild_forum_counters($forum['fid']); ++$progress; $output->update_progress_bar(round($progress / $num_imported_forums * 50, 1) + 100, "Rebuilding counters for forum #{$forum['fid']}"); } $output->update_progress_bar(150); $query = $db->simple_select("forums", "fid", "usepostcounts = 0"); while ($forum = $db->fetch_array($query)) { $fids[] = $forum['fid']; } if (is_array($fids)) { $fids = implode(',', $fids); } if ($fids) { $fids = " AND fid NOT IN({$fids})"; } else { $fids = ""; } $this->debug->log->trace1("Rebuilding user counters"); echo "done. <br />Rebuilding user counters... "; flush(); $query = $db->simple_select("users", "COUNT(*) as count", "import_uid != 0"); $num_imported_users = $db->fetch_field($query, "count"); $progress = $last_percent = 0; $query = $db->simple_select("users", "uid", "import_uid != 0"); while ($user = $db->fetch_array($query)) { $query2 = $db->simple_select("posts", "COUNT(*) AS post_count", "uid='{$user['uid']}' AND visible > 0{$fids}"); $num_posts = $db->fetch_field($query2, "post_count"); $db->free_result($query2); $db->update_query("users", array("postnum" => intval($num_posts)), "uid='{$user['uid']}'"); ++$progress; $percent = round($progress / $num_imported_users * 50 + 150, 1); if ($percent != $last_percent) { $output->update_progress_bar($percent, "Rebuilding counters for user #{$user['uid']}"); } $last_percent = $percent; } // TODO: recount user posts doesn't seem to work $output->update_progress_bar(200, "Please wait..."); echo "done.<br />"; flush(); sleep(3); } }