1 | <?php |
||
2 | |||
3 | class Shopware_Controllers_Frontend_Snapshots extends \Enlight_Controller_Action |
||
0 ignored issues
–
show
|
|||
4 | { |
||
5 | public function indexAction() |
||
6 | { |
||
7 | $this->forward('load'); |
||
8 | } |
||
9 | |||
10 | /** |
||
11 | * @throws Exception |
||
12 | */ |
||
13 | public function loadAction() |
||
14 | { |
||
15 | $sessionID = $this->Request()->getParam('session'); |
||
16 | $step = (int)$this->Request()->getParam('step', 1); |
||
17 | |||
18 | if (empty($sessionID)) { |
||
19 | throw new \Exception( |
||
20 | 'A valid session ID must be provided' |
||
21 | ); |
||
22 | } |
||
23 | |||
24 | $sqlParams = [ |
||
25 | ':sessionID' => $sessionID, |
||
26 | ':step' => $step, |
||
27 | ]; |
||
28 | |||
29 | $snapshot = $this->get('dbal_connection')->fetchAssoc( |
||
30 | 'SELECT * FROM `view_snapshots` WHERE `sessionID` = :sessionID AND `step` = :step', |
||
31 | $sqlParams |
||
32 | ); |
||
33 | |||
34 | if (empty($snapshot)) { |
||
35 | throw new \Exception( |
||
36 | sprintf('No snapshot found by session ID %s and step %d', $sessionID, $step) |
||
37 | ); |
||
38 | } |
||
39 | |||
40 | $nextStep = (int)$this->get('dbal_connection')->fetchColumn( |
||
41 | 'SELECT MIN(`step`) as step FROM `view_snapshots` WHERE `sessionID` = :sessionID AND `step` > :step LIMIT 1', |
||
42 | $sqlParams |
||
43 | ); |
||
44 | |||
45 | $prevStep = (int)$this->get('dbal_connection')->fetchColumn( |
||
46 | 'SELECT MAX(`step`) as step FROM `view_snapshots` WHERE `sessionID` = :sessionID AND `step` < :step LIMIT 1', |
||
47 | $sqlParams |
||
48 | ); |
||
49 | |||
50 | $params = json_decode($snapshot['params'], true); |
||
51 | |||
52 | $this->Request()->setParams($params); |
||
53 | |||
54 | $this->Request()->setControllerName($params['__controller']); |
||
55 | $this->Request()->setActionName($params['__action']); |
||
56 | |||
57 | $this->View()->loadTemplate($snapshot['template']); |
||
58 | $this->View()->assign(unserialize($snapshot['variables'])); |
||
59 | |||
60 | $this->View()->assign( |
||
61 | [ |
||
62 | 'snapshotStep' => $step, |
||
63 | 'snapshotNextStep' => $nextStep, |
||
64 | 'snapshotPrevStep' => $prevStep, |
||
65 | 'snapshotSessionID' => $sessionID, |
||
66 | ] |
||
67 | ); |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * @throws \Exception |
||
72 | */ |
||
73 | public function startRecordingAction() |
||
74 | { |
||
75 | $this->get('front')->Plugins()->ViewRenderer()->setNoRender(); |
||
76 | |||
77 | $this->get('session')->offsetSet('isSessionRecorded', true); |
||
78 | |||
79 | $this->Response()->setBody(json_encode(['success' => true])); |
||
80 | } |
||
81 | |||
82 | /** |
||
83 | * @throws \Exception |
||
84 | */ |
||
85 | public function stopRecordingAction() |
||
86 | { |
||
87 | $this->get('front')->Plugins()->ViewRenderer()->setNoRender(); |
||
88 | |||
89 | $this->get('session')->offsetSet('isSessionRecorded', false); |
||
90 | |||
91 | $this->Response()->setBody(json_encode(['success' => true])); |
||
92 | } |
||
93 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths