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]);
 }
Example #2
0
});
$app->map('/noaccess', function () use($app) {
    $app->view()->setData('filePath', UPDATE_PATH . '/' . 'allowed_ip.txt');
    $app->render('noaccess.php');
    $app->response()->status(403);
})->via('GET', 'POST')->name("noAccess");
$app->map('/', function () use($app) {
    $app->render('welcome.php');
    if (!UPDATE_IS_MANUAL) {
        $app->redirect($app->urlFor("checks"));
        return;
    }
})->via('GET', 'POST')->name("welcome");
// Check file & directory permissions
$app->map('/checks', function () use($app, $container) {
    $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;