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
        );
    }
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
        );
    }
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 ) ; }
Resolve database import destination.

@param $import_path
The database import path.
@param $service
The service name.
@param bool $copy_to_service
Copy imported file to service.
@param bool $localhost
Resolve destination path from host.
@return bool|null
@throws \Exception
Resolve database import destination .