Changeset 339


Ignore:
Timestamp:
03/30/10 23:49:32 (10 years ago)
Author:
sander
Message:

Fix state updates for virus scan

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/www/app/models/request.php

    r307 r339  
    7171                $this->Preprocessor->callback('validateFile'); 
    7272                $this->Preprocessor->callback('saveField', 'state', self::STATE_QUEUED); 
    73                 $this->Preprocessor->errback('saveField', 'state', self::STATE_PREPROCESSOR_FAILED); 
     73                $this->Preprocessor->errback('preprocessorError'); 
    7474        } 
    7575 
     
    404404                        $this->data['Request']['state_info'] = $result; 
    405405                        $this->data['Request']['expire'] = date('Y-m-d H:i:s'); 
     406                        $this->save(); 
     407 
    406408                        $this->log('Clamd scanned ' . $path . ' (Request ID: ' . $this->id . '): FOUND ' . $result, LOG_DEBUG); 
    407409                        return false; 
     
    416418                        $this->data['Request']['state_info'] = $result; 
    417419                        $this->data['Request']['expire'] = date('Y-m-d H:i:s'); 
     420                        $this->save(); 
    418421 
    419422                        $this->log('Clamd error scanning ' . $path . ' (Request ID: ' . $this->id . '): ' . $result); 
     
    493496                return true; 
    494497        } 
     498 
     499        public function preprocessorError() 
     500        { 
     501                $state = $this->field('state'); 
     502                if ($state == self::STATE_PREPROCESSOR_QUEUED) { 
     503                        $this->saveField('state', self::STATE_PREPROCESSOR_FAILED); 
     504                } 
     505        } 
    495506} 
    496507 
Note: See TracChangeset for help on using the changeset viewer.