Beispiel #1
0
function make_html($link, $data_date, $base_table)
{
    if ($base_table == 'okato') {
        $classif = "ОКАТО";
    } else {
        $classif = "ОКТМО";
    }
    echo date("H:i:s") . " Генерация html для классификатора {$classif}\n\n";
    $time = -time();
    print_table($link, $data_date, $base_table, '', 'html');
    $i = 1;
    $query = 'SELECT mergedcode FROM ' . $base_table . ' WHERE mergedcode<>\'00000000\' AND exist<>0';
    $result = mysqli_query($link, $query);
    $num_pages = mysqli_num_rows($result);
    while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
        $percents = 100 * $i / $num_pages;
        $status = sprintf("%3d", $percents) . '% Обработано ' . sprintf("%7d", $i) . ' из ' . sprintf("%7d", $num_pages) . ' ';
        fwrite(STDERR, "\r{$status}");
        print_table($link, $data_date, $base_table, $row['mergedcode'], 'html');
        $i++;
    }
    $time += time();
    echo "\n\n" . date("H:i:s") . " Генерация html для {$classif} выполнена за " . hms($time) . "\n\n";
}
Beispiel #2
0
    $timeElapsed = $timeNow - $startTime;
    if ($timeElapsed == 0) {
        $timeElapsed = 1;
    }
    $currentSize = file_get_contents($progressFile);
    $percentDone = round($currentSize / $totalSize * 100);
    $speed = $currentSize / $timeElapsed;
    if ($speed == 0) {
        $speed = 1024;
    }
    $gBitSmarty->assign('kbitSpeed', round($speed / 1000));
    $gBitSmarty->assign('speed', $speed);
    $gBitSmarty->assign('startTime', $startTime);
    $gBitSmarty->assign('percentDone', $percentDone);
    $gBitSmarty->assign('timeRemainStr', hms(($totalSize - $currentSize) / $speed));
    $gBitSmarty->assign('timeElapsedStr', hms($timeElapsed));
    $gBitSmarty->assign('currentSize', $currentSize);
    $gBitSmarty->assign('totalSize', $totalSize);
}
if ($gBitThemes->isAjaxRequest()) {
    print $gBitSmarty->fetch('bitpackage:gigaupload/progress_inc.tpl');
} else {
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    // Date in the past
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    // always modified
    header("Cache-Control: no-cache, must-revalidate");
    // HTTP/1.1
    header("Pragma: no-cache");
    // HTTP/1.0
    print $gBitSmarty->fetch('bitpackage:gigaupload/progress.tpl');
Beispiel #3
0
    }
    if (array_key_exists("P17", $item["claims"])) {
        $values .= "\tQ" . $item["claims"]["P17"]["0"]["mainsnak"]["datavalue"]["value"]["numeric-id"];
    } else {
        $values .= "\t\\N";
    }
    if (array_key_exists("P625", $item["claims"])) {
        $values .= "\t" . $item["claims"]["P625"]["0"]["mainsnak"]["datavalue"]["value"]["latitude"];
        $values .= "\t" . $item["claims"]["P625"]["0"]["mainsnak"]["datavalue"]["value"]["longitude"];
    } else {
        $values .= "\t\\N\t\\N";
    }
    if (array_key_exists("P473", $item["claims"])) {
        $values .= "\t" . $item["claims"]["P473"]["0"]["mainsnak"]["datavalue"]["value"];
    } else {
        $values .= "\t\\N";
    }
    if (array_key_exists("P281", $item["claims"])) {
        $values .= "\t" . $item["claims"]["P281"]["0"]["mainsnak"]["datavalue"]["value"];
    } else {
        $values .= "\t\\N";
    }
    fwrite($handle_main, $values . "\n");
    $imported++;
}
$time += time();
echo "\n\n" . date("H:i:s") . ' Выборка завершена за ' . hms($time) . "\n\n";
fclose($handle);
fclose($handle_main);
fclose($handle_aliases);
fclose($handle_types);
				<!--
					top.close();
				// -->
			</script>
			<?php 
            exit;
        }
        // Calculate progress values if upload started.
        if ($current_size > 0 && $time_elapsed > 0) {
            $percent_done = sprintf("%.0f", $current_size / $total_size * 100);
            $speed = $current_size / $time_elapsed;
            if ($speed == 0) {
                $speed = 1024;
            }
            $time_remain_str = hms(($total_size - $current_size) / $speed);
            $time_elapsed_str = hms($time_elapsed);
        }
        if ($percent_done < 1) {
            $percent_done = 1;
        }
        ?>
		<script type="text/javascript">
			<!--
				document.getElementById("progress1").width = "<?php 
        print $percent_done;
        ?>
%";
				document.getElementById("progress2").innerHTML = '<? echo $current_size; ?>/<? echo $total_size; ?> (<? echo $percent_done; ?>%) <? echo printf("%.2f",$speed/1024); ?> kbit/s<br /><? echo $lang['time_elapsed'] . ": " . $time_elapsed_str; ?><br /><? echo $lang['time_remaining'] . ": " . $time_remain_str; ?>';
			// -->
		</script>
<?php 
Beispiel #5
0
    $query = 'SELECT ate, centrum FROM wikidata WHERE id=' . $i;
    $result = mysqli_query($link, $query);
    $row = mysqli_fetch_array($result, MYSQLI_ASSOC);
    mysqli_free_result($result);
    if (isset($row['ate'])) {
        $num_added += get_lost($link, $handle, $row, 'ate');
    }
    if (isset($row['centrum'])) {
        $num_added += get_lost($link, $handle, $row, 'centrum');
    }
    fwrite(STDERR, "\r" . percents($num_items, $i) . ' Обработано ' . sprintf("%10d", $i) . ' элементов из ' . sprintf("%10d", $num_items) . ' добавлено элементов ' . sprintf("%5d", $num_added) . ' ');
}
$query = 'SELECT SQL_CALC_FOUND_ROWS 1 FROM types LIMIT 0';
mysqli_query($link, $query);
$num_items = found_rows($link);
$num_added = 0;
echo "\n\n" . date("H:i:s") . " Выполняется поиск потерянных элементов для типов территорий\n\n";
for ($i = 1; $i <= $num_items; $i++) {
    $query = 'SELECT type FROM types WHERE id=' . $i;
    $result = mysqli_query($link, $query);
    $row = mysqli_fetch_array($result, MYSQLI_ASSOC);
    mysqli_free_result($result);
    if (isset($row['type'])) {
        $num_added += get_lost($link, $handle, $row, 'type');
    }
    fwrite(STDERR, "\r" . percents($num_items, $i) . ' Обработано ' . sprintf("%10d", $i) . ' элементов из ' . sprintf("%10d", $num_items) . ' добавлено элементов ' . sprintf("%5d", $num_added) . ' ');
}
$time += time();
echo "\n\n" . date("H:i:s") . ' Поиск выполнен за ' . hms($time) . "\n\n";
mysqli_close($link);
fclose($handle);