public function checkRequirements() { $paths = Utils::getPaths(SW_PATH . "/engine/Shopware/Components/Check/Data/Path.xml"); clearstatcache(); $systemCheckPathResults = Utils::checkPaths($paths, SW_PATH); foreach ($systemCheckPathResults as $value) { if (!$value['result']) { $fileName = SW_PATH . '/' . $value['name']; @mkdir($fileName, 0777, true); @chmod($fileName, 0777); } } clearstatcache(); $systemCheckPathResults = Utils::checkPaths($paths, SW_PATH); $hasErrors = false; foreach ($systemCheckPathResults as $value) { if (!$value['result']) { $hasErrors = true; } } $directoriesToDelete = ['engine/Library/Mpdf/tmp' => false, 'engine/Library/Mpdf/ttfontdata' => false]; CommonUtils::clearOpcodeCache(); $results = []; foreach ($directoriesToDelete as $directory => $deleteDirecory) { $result = true; $filePath = SW_PATH . '/' . $directory; Utils::deleteDir($filePath, $deleteDirecory); if ($deleteDirecory && is_dir($filePath)) { $result = false; $hasErrors = true; } if ($deleteDirecory) { $results[$directory] = $result; } } if (!$hasErrors && $this->app->request()->get("force") !== "1") { // No errors, skip page except if force parameter is set $this->app->redirect($this->app->urlFor("dbmigration")); } $isSkippableCheck = $this->app->config('skippable.check'); if ($isSkippableCheck && $this->app->request()->get("force") !== "1") { // No errors, skip page except if force parameter is set $this->app->redirect($this->app->urlFor("dbmigration")); } $this->app->render('checks.php', ['systemCheckResultsWritePermissions' => $systemCheckPathResults, 'filesToDelete' => $results, 'error' => $hasErrors]); }
/** * @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)); }