Exemplo n.º 1
0
 function Run($aProjname, $aForceUpdate = false)
 {
     $this->iProjname = $aProjname;
     echo "<h3>Scanning files for project '{$aProjname}'</h3>";
     // Find full filename of all project files in the project
     $proj = $this->iDBUtils->GetProject($aProjname);
     $projidx = $proj['fld_key'];
     $q = "SELECT * FROM tbl_projfiles WHERE fld_projidx={$projidx}";
     $res = $this->iDB->Query($q);
     $n = $res->NumRows();
     $ptimer = new JpgTimer();
     while ($n-- > 0) {
         $r = $res->Fetch();
         $fname = $r['fld_name'];
         $modtime = filemtime($fname);
         $dbtime = strtotime($r['fld_dbupdtime']);
         if ($aForceUpdate || $modtime > $dbtime) {
             echo "Parsing file {$fname}...\n";
             flush();
             $dbdriver = new DBDriver($aProjname, $fname, $this->iDB);
             $ptimer->Push();
             $dbdriver->Run();
             $t = round($ptimer->Pop() / 1000, 2);
             $q = "UPDATE tbl_projfiles SET fld_dbupdtime=now() WHERE fld_key=" . $r['fld_key'];
             $this->iDB->Query($q);
             echo "[{$t} s]<br>\n";
         } else {
             echo "DB is up to date with file: '{$fname}'<br>\n";
         }
     }
     echo "<p><h3>Done.</h3>";
     HTMLGenerator::CloseWinButton();
 }