Esempio n. 1
0
<?php

require_once __DIR__ . "/VecUtil.php";
require_once __DIR__ . "/LogUtil.php";
require_once __DIR__ . "/../json.php";
require_once __DIR__ . "/../PQuery.php";
require_once __DIR__ . "/../Progress.php";
require_once __DIR__ . "/../auth.php";
$class = Auth::curClass();
$get = new PQuery($_GET);
$k = $get->attrDef("k", 20);
if ($get->attrDef("state", 0) == 0) {
    //$vecs=array();
    $filesLimit = $get->attrDef("filesLimit", 1000000000);
    $logDir = LogUtil::getLogDir();
    $logFiles = LogUtil::getLogFiles();
    $cntmax = count($logFiles);
    $cnt = 0;
    $fp = $logDir->rel("{$class}-allvec.txt")->openWrite();
    foreach ($logFiles as $logFile) {
        showProgress("Process {$cnt}/{$cntmax}");
        foreach (LogUtil::readLog($logFile) as $i => $log) {
            $prog = LogUtil::detectProgram($log);
            $vec = VecUtil::mkvec2($prog);
            //$vec->logFile=$logFile;
            //$vec->index=$i;
            //$vecs[]=$vec;
            fwrite($fp, json_encode($vec->ary) . "\n");
        }
        if ($cnt++ > $filesLimit) {
            break;