download example

$this->io->comment(sprintf('Download plugin update package %s', $plugin->getLabel()));

        $request = new DownloadRequest($plugin->getTechnicalName()$version$domain, null);

        $model = $this->getPluginModel($plugin->getTechnicalName());
        if ($plugin->isActive()) {
            $this->container->get(InstallerService::class)->deactivatePlugin($model);
        }

        $this->container->get('shopware_plugininstaller.plugin_download_service')
            ->download($request);
    }

    /** * @param string $version * @param string $domain * * @throws Exception */
    private function handleDummyInstall(PluginStruct $plugin$domain$version)
    {
        $this->io->comment(sprintf('Download plugin install package %s', $plugin->getLabel()));

        


if ($argc >= 2) {
    $repoDir = $argv[1];
    $git = new GitRepository($repoDir);

    echo "Using the existing git repository at {$repoDir}.\n";
} else {
    echo "Starting git clone. This may take a while...\n";

    $repoDir = sys_get_temp_dir().'/icu-data';
    $git = GitRepository::download('https://github.com/unicode-org/icu.git', $repoDir);

    echo "Git clone to {$repoDir} complete.\n";
}

$gitTag = $git->getLastTag(fn ($tag) => preg_match('#^release-[0-9]{1,}-[0-9]{1}$#', $tag));
$shortIcuVersion = strip_minor_versions(preg_replace('#release-([0-9]{1,})-([0-9]{1,})#', '$1.$2', $gitTag));

echo "Checking out `{$gitTag}` for version `{$shortIcuVersion}`...\n";
$git->checkout('tags/'.$gitTag);

$filesystem = new Filesystem();
unlink($file->getPathname());

            throw $e;
        }

        return new Response('', Response::HTTP_NO_CONTENT);
    }

    #[Route(path: '/api/_action/extension/download/{technicalName}', name: 'api.extension.download', methods: ['POST'])]     public function downloadExtension(string $technicalName, Context $context): Response
    {
        $this->extensionDownloader->download($technicalName$context);

        return new Response('', Response::HTTP_NO_CONTENT);
    }

    #[Route(path: '/api/_action/extension/install/{type}/{technicalName}', name: 'api.extension.install', methods: ['POST'])]     public function installExtension(string $type, string $technicalName, Context $context): Response
    {
        $this->extensionLifecycleService->install($type$technicalName$context);

        return new Response('', Response::HTTP_NO_CONTENT);
    }

    
$archiver->addString("$name.yml", Yaml::encode($this->exportStorage->read($name)));
    }
    // Get all data from the remaining collections.     foreach ($this->exportStorage->getAllCollectionNames() as $collection) {
      $collection_storage = $this->exportStorage->createCollection($collection);
      foreach ($collection_storage->listAll() as $name) {
        $archiver->addString(str_replace('.', '/', $collection) . "/$name.yml", Yaml::encode($collection_storage->read($name)));
      }
    }

    $request = new Request(['file' => 'config.tar.gz']);
    return $this->fileDownloadController->download($request, 'temporary');
  }

  /** * Shows diff of specified configuration file. * * @param string $source_name * The name of the configuration file. * @param string $target_name * (optional) The name of the target configuration file if different from * the $source_name. * @param string $collection * (optional) The configuration collection name. Defaults to the default * collection. * * @return array * Table showing a two-way diff between the active and staged configuration. */

    /** * @internal */
    public function __construct(private readonly AbstractDocumentRoute $documentRoute)
    {
    }

    #[Route(path: '/account/order/document/{documentId}/{deepLinkCode}', name: 'frontend.account.order.single.document', defaults: ['_loginRequired' => true, '_loginRequiredAllowGuest' => true], methods: ['GET'])]     public function downloadDocument(Request $request, SalesChannelContext $context, string $documentId): Response
    {
        return $this->documentRoute->download($documentId$request$context$request->get('deepLinkCode'));
    }
}
public function testItThrowsAnExceptionIfInitialisedWithNonGitDirectory()
    {
        $this->expectException(RuntimeException::class);

        @mkdir($this->targetDir, 0777, true);

        new GitRepository($this->targetDir);
    }

    public function testItClonesTheRepository()
    {
        $git = GitRepository::download(self::REPO_URL, $this->targetDir);

        $this->assertInstanceOf(GitRepository::class$git);
        $this->assertDirectoryExists($this->targetDir.'/.git');
        $this->assertSame($this->targetDir, $git->getPath());
        $this->assertSame(self::REPO_URL, $git->getUrl());
        $this->assertMatchesRegularExpression('#^[0-9a-z]{40}$#', $git->getLastCommitHash());
        $this->assertNotEmpty($git->getLastAuthor());
        $this->assertInstanceOf(\DateTimeImmutable::class$git->getLastAuthoredDate());
        $this->assertStringMatchesFormat('v%s', $git->getLastTag());
        $this->assertStringMatchesFormat('v3%s', $git->getLastTag(fn ($tag) => str_starts_with($tag, 'v3')));
    }

    
$localApp = $this->appRepo->search(new Criteria([$id])$context)->first();
            $nextVersion = $extension->getLatestVersion();
            if (!$nextVersion) {
                continue;
            }

            if (version_compare($nextVersion$localApp->getVersion()) > 0) {
                $outdatedApps[] = $extension;
            }
        }
        foreach ($outdatedApps as $app) {
            $this->downloader->download($app->getName()$context);

            try {
                $this->appLifecycle->updateExtension($app->getName(), false, $context);
            } catch (ExtensionUpdateRequiresConsentAffirmationException) {
                // nth             }
        }
    }

    protected function getDecorated(): AbstractAppUpdater
    {
        
mkdir($this->getContainer()->getParameter('kernel.app_dir'), 0777, true);
    }

    public function testDownloadExtension(): void
    {
        $this->getRequestHandler()->reset();
        $this->getRequestHandler()->append(new Response(200, [], '{"location": "http://localhost/my.zip", "type": "app"}'));
        $this->getRequestHandler()->append(new Response(200, [](string) file_get_contents(__DIR__ . '/../_fixtures/TestApp.zip')));

        $context = $this->createAdminStoreContext();

        $this->extensionDownloader->download('TestApp', $context);
        $expectedLocation = $this->getContainer()->getParameter('kernel.app_dir') . '/TestApp';

        static::assertFileExists($expectedLocation);
        (new Filesystem())->remove($expectedLocation);
    }

    public function testDownloadExtensionServerNotReachable(): void
    {
        $this->getRequestHandler()->reset();
        $this->getRequestHandler()->append(new Response(200, [], '{"location": "http://localhost/my.zip"}'));
        $this->getRequestHandler()->append(new Response(500, [], ''));

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