|
1
|
|
|
<?php |
|
2
|
|
|
declare(strict_types=1); |
|
3
|
|
|
|
|
4
|
|
|
namespace App\Controller; |
|
5
|
|
|
|
|
6
|
|
|
use App\Services\PhpBinaryFinder; |
|
7
|
|
|
use App\Services\RecoveryManager; |
|
8
|
|
|
use Shopware\Core\Framework\Log\Package; |
|
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
|
|
|
#[Package('core')] |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* @internal |
|
18
|
|
|
*/ |
|
19
|
|
|
class PhpConfigController extends AbstractController |
|
20
|
|
|
{ |
|
21
|
|
|
public function __construct( |
|
22
|
|
|
private readonly PhpBinaryFinder $binaryFinder, |
|
23
|
|
|
private readonly RecoveryManager $recoveryManager |
|
24
|
|
|
) { |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
#[Route('/configure', name: 'configure', defaults: ['step' => 1])] |
|
28
|
|
|
public function index(Request $request): Response |
|
29
|
|
|
{ |
|
30
|
|
|
try { |
|
31
|
|
|
$shopwareLocation = $this->recoveryManager->getShopwareLocation(); |
|
32
|
|
|
} catch (\RuntimeException $e) { |
|
33
|
|
|
$shopwareLocation = null; |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
if ($phpBinary = $request->request->get('phpBinary')) { |
|
37
|
|
|
$request->getSession()->set('phpBinary', $phpBinary); |
|
38
|
|
|
|
|
39
|
|
|
return $this->redirectToRoute($shopwareLocation === null ? 'install' : 'update'); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
return $this->render('php_config.html.twig', [ |
|
43
|
|
|
'phpBinary' => $request->getSession()->get('phpBinary', $this->binaryFinder->find()), |
|
44
|
|
|
'shopwareLocation' => $shopwareLocation, |
|
45
|
|
|
]); |
|
46
|
|
|
} |
|
47
|
|
|
} |
|
48
|
|
|
|