Ignore:
Timestamp:
Jan 8, 2014, 1:05:05 PM (11 years ago)
Author:
maron
Message:
  • Modify: Change store progress from file to Database
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Export/Export.php

    r729 r731  
    302302
    303303  function AddProgress($add = 2) {
    304     if (file_exists($this->TempDir.'progress')) { 
    305       $File = new FileStream();
    306       $File->OpenFile($this->TempDir.'progress');
    307       $Line = $File->ReadLine(); 
    308    
    309       $File = new FileStream();
    310       $File->CreateFile($this->TempDir.'progress');
    311       $Line+=$add;
    312       $File->WriteLine($Line);
    313     }
     304
     305    $DbResult = $this->System->Database->query('SELECT Progress FROM `ExportTask` WHERE `Export`='.$this->Id);
     306    $Task = $DbResult->fetch_assoc();
     307    $per = $Task['Progress']+$add;
     308    $this->System->Database->query('UPDATE `ExportTask` SET `Progress`='.$per.' WHERE `Export`='.$this->Id);
    314309  }
    315310
     
    411406          if($Progress != $OldProgress)
    412407          {
    413             if ($Group['Id'] == 13) $this->AddProgress(0.01);
     408            if (($Group['Id'] == 13) and ($Progress <> 100)) $this->AddProgress(0.01);
    414409            $Output .= $Progress."%\r";
    415410            echo($Output);
     
    436431    while($Group = $DbResult->fetch_assoc())
    437432    {
     433      $this->AddProgress(1);
    438434    //  $this->AddProgress();
    439435      $Output .= $Group['Name'].'... ';
Note: See TracChangeset for help on using the changeset viewer.