original_string: public function scan_file_execute_commandline($file) {
          $pathtoclam = trim($this->get_config('pathtoclam'));
  
          if (!file_exists($pathtoclam) or !is_executable($pathtoclam)) {
              // Misconfigured clam, notify admins.
              $notice = get_string('invalidpathtoclam', 'antivirus_clamav', $pathtoclam);
              $this->set_scanning_notice($notice);
              return self::SCAN_RESULT_ERROR;
          }
  
          $clamparam = ' --stdout ';
          // If we are dealing with clamdscan, clamd is likely run as a different user
          // that might not have permissions to access your file.
          // To make clamdscan work, we use --fdpass parameter that passes the file
          // descriptor permissions to clamd, which allows it to scan given file
          // irrespective of directory and file permissions.
          if (basename($pathtoclam) == 'clamdscan') {
              $clamparam .= '--fdpass ';
          }
          // Execute scan.
          $cmd = escapeshellcmd($pathtoclam).$clamparam.escapeshellarg($file);
          exec($cmd, $output, $return);
          // Return variable will contain execution return code. It will be 0 if no virus is found,
          // 1 if virus is found, and 2 or above for the error. Return codes 0 and 1 correspond to
          // SCAN_RESULT_OK and SCAN_RESULT_FOUND constants, so we return them as it is.
          // If there is an error, it gets stored as scanning notice and function
          // returns SCAN_RESULT_ERROR.
          if ($return > self::SCAN_RESULT_FOUND) {
              $notice = get_string('clamfailed', 'antivirus_clamav', $this->get_clam_error_code($return));
              $notice .= "\n\n". implode("\n", $output);
              $this->set_scanning_notice($notice);
              return self::SCAN_RESULT_ERROR;
          }
  
          return (int)$return;
      }
code: public function scan_file_execute_commandline($file) {
          $pathtoclam = trim($this->get_config('pathtoclam'));
  
          if (!file_exists($pathtoclam) or !is_executable($pathtoclam)) {
              // Misconfigured clam, notify admins.
              $notice = get_string('invalidpathtoclam', 'antivirus_clamav', $pathtoclam);
              $this->set_scanning_notice($notice);
              return self::SCAN_RESULT_ERROR;
          }
  
          $clamparam = ' --stdout ';
          // If we are dealing with clamdscan, clamd is likely run as a different user
          // that might not have permissions to access your file.
          // To make clamdscan work, we use --fdpass parameter that passes the file
          // descriptor permissions to clamd, which allows it to scan given file
          // irrespective of directory and file permissions.
          if (basename($pathtoclam) == 'clamdscan') {
              $clamparam .= '--fdpass ';
          }
          // Execute scan.
          $cmd = escapeshellcmd($pathtoclam).$clamparam.escapeshellarg($file);
          exec($cmd, $output, $return);
          // Return variable will contain execution return code. It will be 0 if no virus is found,
          // 1 if virus is found, and 2 or above for the error. Return codes 0 and 1 correspond to
          // SCAN_RESULT_OK and SCAN_RESULT_FOUND constants, so we return them as it is.
          // If there is an error, it gets stored as scanning notice and function
          // returns SCAN_RESULT_ERROR.
          if ($return > self::SCAN_RESULT_FOUND) {
              $notice = get_string('clamfailed', 'antivirus_clamav', $this->get_clam_error_code($return));
              $notice .= "\n\n". implode("\n", $output);
              $this->set_scanning_notice($notice);
              return self::SCAN_RESULT_ERROR;
          }
  
          return (int)$return;
      }
code_tokens: public function scan_file_execute_commandline ( $ file ) { $ pathtoclam = trim ( $ this -> get_config ( 'pathtoclam' ) ) ; if ( ! file_exists ( $ pathtoclam ) or ! is_executable ( $ pathtoclam ) ) { // Misconfigured clam, notify admins. $ notice = get_string ( 'invalidpathtoclam' , 'antivirus_clamav' , $ pathtoclam ) ; $ this -> set_scanning_notice ( $ notice ) ; return self :: SCAN_RESULT_ERROR ; } $ clamparam = ' --stdout ' ; // If we are dealing with clamdscan, clamd is likely run as a different user // that might not have permissions to access your file. // To make clamdscan work, we use --fdpass parameter that passes the file // descriptor permissions to clamd, which allows it to scan given file // irrespective of directory and file permissions. if ( basename ( $ pathtoclam ) == 'clamdscan' ) { $ clamparam .= '--fdpass ' ; } // Execute scan. $ cmd = escapeshellcmd ( $ pathtoclam ) . $ clamparam . escapeshellarg ( $ file ) ; exec ( $ cmd , $ output , $ return ) ; // Return variable will contain execution return code. It will be 0 if no virus is found, // 1 if virus is found, and 2 or above for the error. Return codes 0 and 1 correspond to // SCAN_RESULT_OK and SCAN_RESULT_FOUND constants, so we return them as it is. // If there is an error, it gets stored as scanning notice and function // returns SCAN_RESULT_ERROR. if ( $ return > self :: SCAN_RESULT_FOUND ) { $ notice = get_string ( 'clamfailed' , 'antivirus_clamav' , $ this -> get_clam_error_code ( $ return ) ) ; $ notice .= "\n\n" . implode ( "\n" , $ output ) ; $ this -> set_scanning_notice ( $ notice ) ; return self :: SCAN_RESULT_ERROR ; } return ( int ) $ return ; }
docstring: Scan file using command line utility.
  
  @param string $file Full path to the file.
  @return int Scanning result constant.
docstring_tokens: Scan file using command line utility .