1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
namespace Shopware\WebInstaller\Controller; |
5
|
|
|
|
6
|
|
|
use Shopware\Core\Framework\Log\Package; |
7
|
|
|
use Shopware\WebInstaller\Services\PhpBinaryFinder; |
8
|
|
|
use Shopware\WebInstaller\Services\RecoveryManager; |
9
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
10
|
|
|
use Symfony\Component\HttpFoundation\Request; |
11
|
|
|
use Symfony\Component\HttpFoundation\Response; |
12
|
|
|
use Symfony\Component\Routing\Annotation\Route; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @internal |
16
|
|
|
*/ |
17
|
|
|
#[Package('core')] |
18
|
|
|
class PhpConfigController extends AbstractController |
19
|
|
|
{ |
20
|
|
|
public function __construct( |
21
|
|
|
private readonly PhpBinaryFinder $binaryFinder, |
22
|
|
|
private readonly RecoveryManager $recoveryManager |
23
|
|
|
) { |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
#[Route('/configure', name: 'configure', defaults: ['step' => 1])] |
27
|
|
|
public function index(Request $request): Response |
28
|
|
|
{ |
29
|
|
|
try { |
30
|
|
|
$shopwareLocation = $this->recoveryManager->getShopwareLocation(); |
31
|
|
|
} catch (\RuntimeException $e) { |
32
|
|
|
$shopwareLocation = null; |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
if ($phpBinary = $request->request->get('phpBinary')) { |
36
|
|
|
// Reset the latest version to force a new check |
37
|
|
|
$request->getSession()->remove('latestVersion'); |
38
|
|
|
|
39
|
|
|
$request->getSession()->set('phpBinary', $phpBinary); |
40
|
|
|
|
41
|
|
|
return $this->redirectToRoute($shopwareLocation === null ? 'install' : 'update'); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
return $this->render('php_config.html.twig', [ |
45
|
|
|
'phpBinary' => $request->getSession()->get('phpBinary', $this->binaryFinder->find()), |
46
|
|
|
'shopwareLocation' => $shopwareLocation, |
47
|
|
|
]); |
48
|
|
|
} |
49
|
|
|
} |
50
|
|
|
|