UnpackStep example

$this->View()->assign('success', false);

            return;
        }
        $source = $this->createDestinationFromVersion($version);

        $fs = new Filesystem();

        $updateDir = Shopware()->DocPath() . 'files/update/';
        $fileDir = Shopware()->DocPath() . 'files/update/files';

        $unpackStep = new UnpackStep($source$fileDir);

        $offset = (int) $this->Request()->get('offset', 0);
        if ($offset === 0) {
            $fs->remove($updateDir);
        }

        $result = $unpackStep->run($offset);

        $this->view->assign($this->mapResult($result));
        if ($result instanceof FinishResult) {
            $fs->rename($fileDir . '/update-assets/', $updateDir . '/update-assets/');
            
$localFilesystem = $factory->createLocalFilesystem();
        $remoteFilesystem = $factory->createRemoteFilesystem();

        if ($offset == 0) {
            $this->validateFilesytems($localFilesystem$remoteFilesystem);
        }

        /** @var PathBuilder $pathBuilder */
        $pathBuilder = $this->container->get('path.builder');

        $debug = false;
        $step = new UnpackStep($localFilesystem$remoteFilesystem$pathBuilder$debug);

        $result = $step->run($offset$total);

        if ($result instanceof ValidResult) {
            Utils::clearOpcodeCache();
        }

        $this->toJson(200, $this->resultMapper->toExtJs($result));
    }

    public function updateHtaccess()
    {


        /** @var FilesystemFactory $factory */
        $factory = $this->container->get('filesystem.factory');
        $localFilesytem = $factory->createLocalFilesystem();
        $remoteFilesystem = $factory->createLocalFilesystem();

        /** @var PathBuilder $pathBuilder */
        $pathBuilder = $this->container->get('path.builder');

        $debug = false;
        $step = new UnpackStep($localFilesytem$remoteFilesystem$pathBuilder$debug);

        $offset = 0;
        $total = 0;
        do {
            $result = $step->run($offset$total);
            if ($result instanceof ErrorResult) {
                throw new Exception($result->getMessage(), 0, $result->getException());
            }
            $offset = $result->getOffset();
            $total = $result->getTotal();
        } while ($result instanceof ValidResult);
    }
Home | Imprint | This part of the site doesn't use cookies.