Exemplo n.º 1
0
 /**
  * @throws \RuntimeException
  */
 public function unpack()
 {
     // Manual updates do not contain files to overwrite
     if (UPDATE_IS_MANUAL) {
         Utils::clearOpcodeCache();
         $this->toJson(200, $this->resultMapper->toExtJs(new FinishResult(0, 0)));
         return;
     }
     $offset = $this->request->get('offset');
     $total = $this->request->get('total');
     /** @var FilesystemFactory $factory */
     $factory = $this->container->get('filesystem.factory');
     $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));
 }
Exemplo n.º 2
0
 public function unpackFiles()
 {
     $this->output->writeln("Replace system files...");
     if (!is_dir(UPDATE_FILES_PATH)) {
         $this->output->writeln("skipped...");
         return;
     }
     /** @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);
 }
Exemplo n.º 3
0
 private function synchronizeThemes()
 {
     /** @var \Shopware\Components\Theme\Installer $themeService */
     $themeService = $this->container->get('shopware.theme_installer');
     $themeService->synchronize();
 }
Exemplo n.º 4
0
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * "Shopware" is a registered trademark of shopware AG.
 * The licensing of the program under the AGPLv3 does not imply a
 * trademark license. Therefore any rights, title and interest in
 * our trademarks remain entirely with us.
 */
use Shopware\Recovery\Update\DependencyInjection\Container;
use Shopware\Recovery\Update\Utils;
date_default_timezone_set('Europe/Berlin');
ini_set('display_errors', 1);
error_reporting(-1);
$config = (require __DIR__ . '/../config/config.php');
$container = new Container(new Pimple(), $config);
/** @var \Slim\Slim $app */
$app = $container->get('app');
$app->hook('slim.before.dispatch', function () use($app, $container) {
    $baseUrl = \Shopware\Recovery\Common\Utils::getBaseUrl($app);
    $lang = null;
    if (!UPDATE_IS_MANUAL) {
        if (!is_file(UPDATE_META_FILE)) {
            $shopPath = str_replace('/recovery/update', '/', $app->request()->getRootUri());
            $app->response()->redirect($shopPath);
            $app->response()->status(302);
            $app->stop();
        }
        $file = file_get_contents(UPDATE_META_FILE);
        $updateConfig = json_decode($file, true);
        $container->setParameter('update.config', $updateConfig);
Exemplo n.º 5
0
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * "Shopware" is a registered trademark of shopware AG.
 * The licensing of the program under the AGPLv3 does not imply a
 * trademark license. Therefore any rights, title and interest in
 * our trademarks remain entirely with us.
 */
use Shopware\Recovery\Update\DependencyInjection\Container;
use Shopware\Recovery\Update\PluginCheck;
use Shopware\Recovery\Update\Utils;
date_default_timezone_set('Europe/Berlin');
ini_set('display_errors', 1);
error_reporting(-1);
$config = (require __DIR__ . '/../config/config.php');
$container = new Container(new \Pimple\Container(), $config);
/** @var \Slim\Slim $app */
$app = $container->get('app');
$app->hook('slim.before.dispatch', function () use($app, $container) {
    $baseUrl = \Shopware\Recovery\Common\Utils::getBaseUrl($app);
    $lang = null;
    if (!UPDATE_IS_MANUAL) {
        if (!is_file(UPDATE_META_FILE)) {
            $shopPath = str_replace('/recovery/update', '/', $app->request()->getRootUri());
            $app->response()->redirect($shopPath);
            $app->response()->status(302);
            $app->stop();
        }
        $file = file_get_contents(UPDATE_META_FILE);
        $updateConfig = json_decode($file, true);
        $container->setParameter('update.config', $updateConfig);