protected function resolveDatabaseImportDestination($import_path, $service, $copy_to_service = false, $localhost = false)
    {
        /** @var \SplFileInfo $import_path */
        $path = $this->resolveDatabaseImportPath($import_path);

        $filename = $path->getFilename();
        $extract_filename = substr($filename, 0, strrpos($filename, '.'));

        if (!$localhost) {
            // Copy file to service if uploaded from localhost.
            if ($copy_to_service) {
                /** @var DockerEngineType $engine */
                $engine = $this->getEngineInstance();

                if ($engine instanceof DockerEngineType) {
                    $engine->copyFileToService($path->getRealPath(), '/tmp', $service);
                }
            }

            return $this->extractArchive(
                "/tmp/{$filename}",
                "/tmp/{$extract_filename}",
                $service,
                $localhost
            );
        }

        return $this->extractArchive(
            $path->getRealPath(),
            "/tmp/{$extract_filename}",
            null,
            $localhost
        );
    }