original_string: public function scan_file($file, $filename) {
          if (!is_readable($file)) {
              // This should not happen.
              debugging('File is not readable.');
              return self::SCAN_RESULT_ERROR;
          }
  
          // Execute the scan using preferable method.
          $method = 'scan_file_execute_' . $this->get_config('runningmethod');
          if (!method_exists($this, $method)) {
              throw new \coding_exception('Attempting to call non-existing method ' . $method);
          }
          $return = $this->$method($file);
  
          if ($return === self::SCAN_RESULT_ERROR) {
              $this->message_admins($this->get_scanning_notice());
              // If plugin settings require us to act like virus on any error,
              // return SCAN_RESULT_FOUND result.
              if ($this->get_config('clamfailureonupload') === 'actlikevirus') {
                  return self::SCAN_RESULT_FOUND;
              }
          }
          return $return;
      }
code: public function scan_file($file, $filename) {
          if (!is_readable($file)) {
              // This should not happen.
              debugging('File is not readable.');
              return self::SCAN_RESULT_ERROR;
          }
  
          // Execute the scan using preferable method.
          $method = 'scan_file_execute_' . $this->get_config('runningmethod');
          if (!method_exists($this, $method)) {
              throw new \coding_exception('Attempting to call non-existing method ' . $method);
          }
          $return = $this->$method($file);
  
          if ($return === self::SCAN_RESULT_ERROR) {
              $this->message_admins($this->get_scanning_notice());
              // If plugin settings require us to act like virus on any error,
              // return SCAN_RESULT_FOUND result.
              if ($this->get_config('clamfailureonupload') === 'actlikevirus') {
                  return self::SCAN_RESULT_FOUND;
              }
          }
          return $return;
      }
code_tokens: public function scan_file ( $ file , $ filename ) { if ( ! is_readable ( $ file ) ) { // This should not happen. debugging ( 'File is not readable.' ) ; return self :: SCAN_RESULT_ERROR ; } // Execute the scan using preferable method. $ method = 'scan_file_execute_' . $ this -> get_config ( 'runningmethod' ) ; if ( ! method_exists ( $ this , $ method ) ) { throw new \ coding_exception ( 'Attempting to call non-existing method ' . $ method ) ; } $ return = $ this -> $ method ( $ file ) ; if ( $ return === self :: SCAN_RESULT_ERROR ) { $ this -> message_admins ( $ this -> get_scanning_notice ( ) ) ; // If plugin settings require us to act like virus on any error, // return SCAN_RESULT_FOUND result. if ( $ this -> get_config ( 'clamfailureonupload' ) === 'actlikevirus' ) { return self :: SCAN_RESULT_FOUND ; } } return $ return ; }
docstring: Scan file.
  
  This method is normally called from antivirus manager (\core\antivirus\manager::scan_file).
  
  @param string $file Full path to the file.
  @param string $filename Name of the file (could be different from physical file if temp file is used).
  @return int Scanning result constant.
docstring_tokens: Scan file .