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]);
 }
Exemple #2
0
 $hasErrors = false;
 foreach ($systemCheckPathResults as $value) {
     if (!$value['result']) {
         $hasErrors = true;
     }
 }
 $directoriesToDelete = array('cache/proxies/' => false, 'cache/doctrine/filecache/' => false, 'cache/doctrine/proxies/' => false, 'cache/doctrine/attributes/' => false, 'cache/general/' => false, 'cache/templates/' => false, 'engine/Library/Mpdf/tmp' => false, 'engine/Library/Mpdf/ttfontdata' => false);
 if (function_exists('apc_clear_cache')) {
     apc_clear_cache();
     apc_clear_cache('user');
 }
 $results = array();
 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 && $app->request()->get("action")) {
     // No errors and submitted form - proceed with next-step
     $app->redirect($app->urlFor("dbmigration"));
 }
 if (!$hasErrors && $app->request()->get("force") !== "1") {
     // No errors, skip page except if force parameter is set
     $app->redirect($app->urlFor("dbmigration"));
 private function cleanupCache()
 {
     $cachePath = SW_PATH . '/var/cache';
     foreach (new \DirectoryIterator($cachePath) as $cacheDirectory) {
         if ($cacheDirectory->isDot() || !$cacheDirectory->isDir()) {
             continue;
         }
         Utils::deleteDir($cacheDirectory->getPathname(), true);
     }
 }
 private function cleanup()
 {
     $this->output->writeln("Cleanup old files, clearing caches...");
     $cleanupFile = UPDATE_ASSET_PATH . '/cleanup.php';
     if (!is_file($cleanupFile)) {
         return;
     }
     $rawList = (require $cleanupFile);
     $cleanupList = array();
     foreach ($rawList as $path) {
         $realpath = SW_PATH . '/' . $path;
         if (file_exists($realpath)) {
             $cleanupList[] = $path;
         }
     }
     foreach ($cleanupList as $path) {
         Utils::cleanPath(SW_PATH . '/' . $path);
     }
     $directoriesToDelete = array('cache/proxies/' => false, 'cache/doctrine/filecache/' => false, 'cache/doctrine/proxies/' => false, 'cache/doctrine/attributes/' => false, 'cache/general/' => false, 'cache/templates/' => false, 'engine/Library/Mpdf/tmp' => false, 'engine/Library/Mpdf/ttfontdata' => false);
     foreach ($directoriesToDelete as $directory => $deleteDirecory) {
         $filePath = SW_PATH . '/' . $directory;
         Utils::deleteDir($filePath, $deleteDirecory);
     }
 }