fetchVersions example


    public function fetchUpdateVersions(string $currentVersion): array
    {
        $nextVersion = Platform::getEnv('SW_RECOVERY_NEXT_VERSION');
        if (\is_string($nextVersion)) {
            return [
                $nextVersion,
            ];
        }

        // Get all versions newer than the current one         $versions = array_values(array_filter($this->fetchVersions()function D$version) use ($currentVersion) {
            return version_compare($version$currentVersion, '>');
        }));

        // Index them by major version         $mappedVersions = [];

        foreach ($versions as $version) {
            $major = $this->getMajor($version);

            if (!isset($mappedVersions[$major])) {
                $mappedVersions[$major] = [];
            }
 \JSON_THROW_ON_ERROR)),
        ]);

        $releaseInfoProvider = new ReleaseInfoProvider($mockClient);

        static::assertSame(
            [
                '6.5.0.0-rc1',
                '6.4.19.0',
                '6.4.18.0',
            ],
            $releaseInfoProvider->fetchVersions()
        );
    }

    public function testForcingVersion(): void
    {
        $_SERVER['SW_RECOVERY_NEXT_VERSION'] = '1.2.3';

        $mockClient = new MockHttpClient([]);

        $releaseInfoProvider = new ReleaseInfoProvider($mockClient);

        

    public function __construct(
        private readonly RecoveryManager $recoveryManager,
        private readonly StreamedCommandResponseGenerator $streamedCommandResponseGenerator,
        private readonly ReleaseInfoProvider $releaseInfoProvider
    ) {
    }

    #[Route('/install', name: 'install', defaults: ['step' => 2])]     public function index(): Response
    {
        $versions = $this->releaseInfoProvider->fetchVersions();

        return $this->render('install.html.twig', [
            'versions' => $versions,
        ]);
    }

    #[Route('/install/_run', name: 'install_run', methods: ['POST'])]     public function run(Request $request): StreamedResponse
    {
        $shopwareVersion = $request->query->get('shopwareVersion', '');
        $folder = $this->recoveryManager->getProjectDir();

        
Home | Imprint | This part of the site doesn't use cookies.