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;
    }