1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Fi\PannelloAmministrazioneBundle\Controller; |
4
|
|
|
|
5
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
6
|
|
|
use Symfony\Component\HttpFoundation\Request; |
7
|
|
|
use Symfony\Component\HttpFoundation\Response; |
8
|
|
|
use Symfony\Component\Finder\Finder; |
9
|
|
|
use Symfony\Component\Filesystem\Filesystem; |
10
|
|
|
use Symfony\Component\Process\Process; |
11
|
|
|
use Fi\OsBundle\DependencyInjection\OsFunctions; |
12
|
|
|
use Fi\PannelloAmministrazioneBundle\DependencyInjection\PannelloAmministrazioneUtils; |
13
|
|
|
use Symfony\Component\Lock\Factory; |
14
|
|
|
use Symfony\Component\Lock\Store\FlockStore; |
15
|
|
|
|
16
|
|
|
class PannelloAmministrazioneController extends Controller |
17
|
|
|
{ |
18
|
|
|
|
19
|
|
|
protected $apppaths; |
20
|
|
|
protected $locksystem; |
21
|
|
|
protected $factory; |
22
|
|
|
|
23
|
1 |
|
public function __construct() |
24
|
|
|
{ |
25
|
1 |
|
$store = new FlockStore(sys_get_temp_dir()); |
|
|
|
|
26
|
1 |
|
$factory = new Factory($store); |
|
|
|
|
27
|
1 |
|
$this->locksystem = $factory->createLock('pannelloamministrazione-command'); |
28
|
1 |
|
$this->locksystem->release(); |
29
|
1 |
|
} |
30
|
|
|
|
31
|
1 |
|
public function indexAction() |
32
|
|
|
{ |
33
|
1 |
|
$finder = new Finder(); |
|
|
|
|
34
|
1 |
|
$fs = new Filesystem(); |
|
|
|
|
35
|
1 |
|
$this->apppaths = $this->get("pannelloamministrazione.projectpath"); |
|
|
|
|
36
|
|
|
|
37
|
1 |
|
$projectDir = $this->apppaths->getRootPath(); |
|
|
|
|
38
|
1 |
|
$bundlelists = $this->container->getParameter('kernel.bundles'); |
39
|
1 |
|
$bundles = array(); |
|
|
|
|
40
|
1 |
|
foreach ($bundlelists as $bundle) { |
41
|
1 |
|
if (substr($bundle, 0, 2) === 'Fi') { |
42
|
1 |
|
$bundle = str_replace('\\', '/', $bundle); |
|
|
|
|
43
|
1 |
|
$bundlepath = $this->apppaths->getSrcPath() . DIRECTORY_SEPARATOR . substr($bundle, 0, strripos($bundle, '/')); |
44
|
1 |
|
if ($fs->exists($bundlepath)) { |
45
|
|
|
$bundles[] = substr($bundle, 0, strripos($bundle, '/')); |
46
|
|
|
} |
47
|
1 |
|
} |
48
|
1 |
|
} |
49
|
1 |
|
$docDir = $this->apppaths->getDocPath(); |
50
|
|
|
|
51
|
1 |
|
$mwbs = array(); |
52
|
|
|
|
53
|
1 |
|
if ($fs->exists($docDir)) { |
54
|
1 |
|
$finder->in($docDir)->files()->name('*.mwb'); |
55
|
1 |
|
foreach ($finder as $file) { |
56
|
1 |
|
$mwbs[] = $file->getBasename(); |
57
|
1 |
|
} |
58
|
1 |
|
} |
59
|
|
|
|
60
|
1 |
|
if ($fs->exists($projectDir . '/.svn')) { |
61
|
|
|
$svn = true; |
62
|
|
|
} else { |
63
|
1 |
|
$svn = false; |
64
|
|
|
} |
65
|
|
|
|
66
|
1 |
|
if ($fs->exists($projectDir . '/.git')) { |
67
|
|
|
$git = true; |
68
|
|
|
} else { |
69
|
1 |
|
$git = false; |
70
|
|
|
} |
71
|
|
|
|
72
|
1 |
|
if (!OsFunctions::isWindows()) { |
73
|
1 |
|
$delcmd = 'rm -rf'; |
|
|
|
|
74
|
1 |
|
$setfilelock = "touch " . $this->getParameter("maintenanceLockFilePath"); |
|
|
|
|
75
|
1 |
|
$remfilelock = "rm " . $this->getParameter("maintenanceLockFilePath"); |
|
|
|
|
76
|
1 |
|
$windows = false; |
|
|
|
|
77
|
1 |
|
} else { |
78
|
|
|
$delcmd = 'del'; |
|
|
|
|
79
|
|
|
$setfilelock = 'echo $null >> ' . $this->getParameter("maintenanceLockFilePath"); |
|
|
|
|
80
|
|
|
$remfilelock = "del " . $this->getParameter("maintenanceLockFilePath"); |
|
|
|
|
81
|
|
|
$windows = true; |
|
|
|
|
82
|
|
|
} |
83
|
|
|
|
84
|
1 |
|
$dellockfile = "DELETELOCK"; |
|
|
|
|
85
|
1 |
|
$delcomposerfile = $delcmd . ' ' . $projectDir . DIRECTORY_SEPARATOR . 'composer.lock'; |
|
|
|
|
86
|
1 |
|
$dellogsfiles = $delcmd . ' ' . $this->apppaths->getLogsPath() . DIRECTORY_SEPARATOR . '*'; |
|
|
|
|
87
|
1 |
|
$delcacheprodfiles = $delcmd . ' ' . $this->apppaths->getCachePath() . DIRECTORY_SEPARATOR . 'prod' . DIRECTORY_SEPARATOR . '*'; |
|
|
|
|
88
|
1 |
|
$delcachedevfiles = $delcmd . ' ' . $this->apppaths->getCachePath() . DIRECTORY_SEPARATOR . 'dev' . DIRECTORY_SEPARATOR . '*'; |
|
|
|
|
89
|
1 |
|
$setmaintenancefile = $setfilelock; |
90
|
1 |
|
$remmaintenancefile = $remfilelock; |
91
|
|
|
|
92
|
|
|
$comandishell = array( |
93
|
1 |
|
'lockfile' => $dellockfile, |
94
|
1 |
|
'composerlock' => $this->fixSlash($delcomposerfile), |
95
|
1 |
|
'logsfiles' => $this->fixSlash($dellogsfiles), |
96
|
1 |
|
'cacheprodfiles' => $this->fixSlash($delcacheprodfiles), |
97
|
1 |
|
'cachedevfiles' => $this->fixSlash($delcachedevfiles), |
98
|
1 |
|
'setmaintenancefile' => $setmaintenancefile, |
99
|
1 |
|
'remmaintenancefile' => $remmaintenancefile, |
100
|
1 |
|
); |
101
|
|
|
|
102
|
1 |
|
$twigparms = array('svn' => $svn, 'git' => $git, 'bundles' => $bundles, 'mwbs' => $mwbs, |
103
|
1 |
|
'rootdir' => $this->fixSlash($projectDir), |
104
|
1 |
|
'comandishell' => $comandishell, 'iswindows' => $windows,); |
105
|
|
|
|
106
|
1 |
|
return $this->render('PannelloAmministrazioneBundle:PannelloAmministrazione:index.html.twig', $twigparms); |
107
|
|
|
} |
108
|
|
|
|
109
|
1 |
|
private function fixSlash($path) |
110
|
|
|
{ |
111
|
1 |
|
return str_replace('\\', '\\\\', $path); |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
private function getLockMessage() |
115
|
|
|
{ |
116
|
|
|
return "<h2 style='color: orange;'>E' già in esecuzione un comando, riprova tra qualche secondo!</h2>"; |
117
|
|
|
} |
118
|
|
|
|
119
|
1 |
|
public function aggiornaSchemaDatabaseAction() |
120
|
|
|
{ |
121
|
1 |
|
if (!$this->locksystem->acquire()) { |
122
|
|
|
return new Response($this->getLockMessage()); |
123
|
|
|
} else { |
124
|
1 |
|
$this->locksystem->acquire(); |
125
|
1 |
|
$command = $this->container->get("pannelloamministrazione.commands"); |
|
|
|
|
126
|
1 |
|
$result = $command->aggiornaSchemaDatabase(); |
|
|
|
|
127
|
|
|
|
128
|
1 |
|
$this->locksystem->release(); |
129
|
1 |
|
$twigparms = array('errcode' => $result['errcode'], 'command' => $result['command'], 'message' => $result['message']); |
130
|
|
|
|
131
|
1 |
|
return $this->render('PannelloAmministrazioneBundle:PannelloAmministrazione:outputcommand.html.twig', $twigparms); |
132
|
|
|
} |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/* FORMS */ |
136
|
|
|
|
137
|
1 |
|
public function generateFormCrudAction(Request $request) |
138
|
|
|
{ |
139
|
1 |
|
if (!$this->locksystem->acquire()) { |
140
|
|
|
return new Response($this->getLockMessage()); |
141
|
|
|
} else { |
142
|
1 |
|
$bundlename = $request->get('bundlename'); |
143
|
1 |
|
$entityform = $request->get('entityform'); |
144
|
|
|
|
145
|
1 |
|
$this->locksystem->acquire(); |
146
|
|
|
|
147
|
1 |
|
$command = $this->container->get("pannelloamministrazione.commands"); |
|
|
|
|
148
|
1 |
|
$ret = $command->generateFormCrud($bundlename, $entityform); |
|
|
|
|
149
|
|
|
|
150
|
1 |
|
$this->locksystem->release(); |
151
|
|
|
//$retcc = ''; |
|
|
|
|
152
|
1 |
|
if ($ret['errcode'] < 0) { |
153
|
|
|
return new Response($ret['message']); |
154
|
|
|
} else { |
|
|
|
|
155
|
|
|
//$retcc = $command->clearCacheEnv($this->container->get('kernel')->getEnvironment()); |
|
|
|
|
156
|
|
|
} |
157
|
1 |
|
$twigparms = array('errcode' => $ret['errcode'], 'command' => $ret['command'], 'message' => $ret['message']); |
158
|
|
|
|
159
|
1 |
|
return $this->render('PannelloAmministrazioneBundle:PannelloAmministrazione:outputcommand.html.twig', $twigparms); |
160
|
|
|
} |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
/* ENTITIES */ |
164
|
|
|
|
165
|
1 |
|
public function generateEntityAction(Request $request) |
166
|
|
|
{ |
167
|
1 |
|
if (!$this->locksystem->acquire()) { |
168
|
|
|
return new Response($this->getLockMessage()); |
169
|
|
|
} else { |
170
|
1 |
|
$this->locksystem->acquire(); |
171
|
1 |
|
$wbFile = $request->get('file'); |
|
|
|
|
172
|
1 |
|
$bundlePath = $request->get('bundle'); |
173
|
1 |
|
$command = $this->container->get("pannelloamministrazione.commands"); |
|
|
|
|
174
|
1 |
|
$ret = $command->generateEntity($wbFile, $bundlePath); |
|
|
|
|
175
|
1 |
|
$this->locksystem->release(); |
176
|
1 |
|
return new Response($ret['message']); |
177
|
|
|
} |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/* ENTITIES */ |
181
|
|
|
|
182
|
1 |
|
public function generateEntityClassAction(Request $request) |
183
|
|
|
{ |
184
|
1 |
|
if (!$this->locksystem->acquire()) { |
185
|
|
|
return new Response($this->getLockMessage()); |
186
|
|
|
} else { |
187
|
1 |
|
$this->locksystem->acquire(); |
188
|
1 |
|
$bundlePath = $request->get('bundle'); |
189
|
1 |
|
$command = $this->container->get("pannelloamministrazione.commands"); |
|
|
|
|
190
|
1 |
|
$ret = $command->generateEntityClass($bundlePath); |
|
|
|
|
191
|
1 |
|
$this->locksystem->release(); |
192
|
|
|
|
193
|
1 |
|
return new Response($ret['message']); |
194
|
|
|
} |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
/* BUNDLE */ |
198
|
|
|
|
199
|
1 |
|
public function generateBundleAction(Request $request) |
200
|
|
|
{ |
201
|
1 |
|
$this->apppaths = $this->get("pannelloamministrazione.projectpath"); |
|
|
|
|
202
|
1 |
|
if (!$this->locksystem->acquire()) { |
203
|
|
|
return new Response($this->getLockMessage()); |
204
|
|
|
} else { |
205
|
1 |
|
$this->locksystem->acquire(); |
206
|
1 |
|
$command = $this->container->get("pannelloamministrazione.commands"); |
|
|
|
|
207
|
1 |
|
$bundleName = $request->get('bundlename'); |
208
|
1 |
|
$result = $command->generateBundle($bundleName); |
|
|
|
|
209
|
1 |
|
if ($result["errcode"] >= 0) { |
|
|
|
|
210
|
|
|
//$msg = "\nPer abilitare il nuovo bundle nel kernel pulire la cache e aggiornare la pagina"; |
|
|
|
|
211
|
|
|
//$alert = '<script type="text/javascript">alert("' . $msg . '");location.reload();</script>'; |
|
|
|
|
212
|
|
|
//$result['message'] = $result['message'] . $msg; |
|
|
|
|
213
|
1 |
|
} |
214
|
1 |
|
$this->locksystem->release(); |
215
|
|
|
//Uso exit perchè la render avendo creato un nuovo bundle schianta perchè non è caricato nel kernel il nuovo bundle ancora |
216
|
|
|
//exit; |
217
|
1 |
|
$twigparms = array('errcode' => $result['errcode'], 'command' => $result['command'], 'message' => $result['message']); |
218
|
|
|
|
219
|
1 |
|
return $this->render('PannelloAmministrazioneBundle:PannelloAmministrazione:outputcommand.html.twig', $twigparms); |
220
|
|
|
} |
221
|
|
|
} |
222
|
|
|
|
223
|
|
|
/* VCS (GIT,SVN) */ |
|
|
|
|
224
|
|
|
|
225
|
|
|
public function getVcsAction() |
226
|
|
|
{ |
227
|
|
|
set_time_limit(0); |
228
|
|
|
$this->apppaths = $this->get("pannelloamministrazione.projectpath"); |
|
|
|
|
229
|
|
|
if (!$this->locksystem->acquire()) { |
230
|
|
|
return new Response($this->getLockMessage()); |
231
|
|
|
} else { |
232
|
|
|
$this->locksystem->acquire(); |
233
|
|
|
$command = $this->container->get("pannelloamministrazione.commands"); |
|
|
|
|
234
|
|
|
$result = $command->getVcs(); |
|
|
|
|
235
|
|
|
$this->locksystem->release(); |
236
|
|
|
if ($result['errcode'] < 0) { |
237
|
|
|
$responseout = '<pre>Errore nel comando: <i style = "color: white;">' . $result['command'] . '</i>' |
238
|
|
|
. '<br/><i style = "color: red;">' . nl2br($result['errmsg']) . '</i></pre>'; |
239
|
|
|
} else { |
240
|
|
|
$responseout = '<pre>Eseguito comando: <i style = "color: white;">' . $result['command'] . '</i><br/>' . |
241
|
|
|
nl2br($result['errmsg']) . '</pre>'; |
242
|
|
|
} |
243
|
|
|
|
244
|
|
|
return new Response($responseout); |
245
|
|
|
} |
246
|
|
|
} |
247
|
|
|
|
248
|
|
|
/* CLEAR CACHE */ |
249
|
|
|
|
250
|
|
|
/** |
251
|
|
|
* Suppress PMD warnings per exit. |
252
|
|
|
* |
253
|
|
|
* @//SuppressWarnings(PHPMD) |
254
|
|
|
*/ |
255
|
|
|
public function clearCacheAction(Request $request) |
|
|
|
|
256
|
|
|
{ |
257
|
|
|
set_time_limit(0); |
258
|
|
|
if (!$this->locksystem->acquire()) { |
259
|
|
|
return new Response($this->getLockMessage()); |
260
|
|
|
} else { |
261
|
|
|
$this->locksystem->acquire(); |
262
|
|
|
$command = $this->container->get("pannelloamministrazione.commands"); |
|
|
|
|
263
|
|
|
$result = $command->clearcache(); |
|
|
|
|
264
|
|
|
|
265
|
|
|
$this->locksystem->release(); |
266
|
|
|
|
267
|
|
|
/* Uso exit perchè new response avendo cancellato la cache schianta non avendo più a disposizione i file */ |
268
|
|
|
//return $commanddev . '<br/>' . $cmdoutputdev . '<br/><br/>' . $commandprod . '<br/>' . $cmdoutputprod; |
269
|
|
|
return new Response(nl2br($result)); |
270
|
|
|
//exit(nl2br($result)); |
|
|
|
|
271
|
|
|
//return dump($result); |
|
|
|
|
272
|
|
|
} |
273
|
|
|
} |
274
|
|
|
|
275
|
|
|
/* CLEAR CACHE */ |
276
|
|
|
|
277
|
1 |
|
public function symfonyCommandAction(Request $request) |
278
|
|
|
{ |
279
|
1 |
|
set_time_limit(0); |
280
|
1 |
|
$comando = $request->get('symfonycommand'); |
281
|
1 |
|
if (!$this->locksystem->acquire()) { |
282
|
|
|
return new Response($this->getLockMessage()); |
283
|
|
|
} else { |
284
|
1 |
|
$this->locksystem->acquire(); |
285
|
1 |
|
$this->apppaths = $this->get("pannelloamministrazione.projectpath"); |
|
|
|
|
286
|
1 |
|
$pammutils = new PannelloAmministrazioneUtils($this->container); |
|
|
|
|
287
|
1 |
|
$phpPath = OsFunctions::getPHPExecutableFromPath(); |
|
|
|
|
288
|
1 |
|
$result = $pammutils->runCommand($phpPath . ' ' . $this->apppaths->getConsole() . ' ' . $comando); |
|
|
|
|
289
|
|
|
|
290
|
1 |
|
$this->locksystem->release(); |
291
|
1 |
|
if ($result['errcode'] < 0) { |
292
|
|
|
$responseout = 'Errore nel comando: <i style = "color: white;">' . |
293
|
|
|
str_replace(';', '<br/>', str_replace('&&', '<br/>', $comando)) . |
294
|
|
|
'</i><br/><i style = "color: red;">' . nl2br($result['errmsg']) . '</i>'; |
295
|
|
|
|
296
|
|
|
return new Response($responseout); |
297
|
|
|
} |
298
|
|
|
$responseout = '<pre>Eseguito comando:<br/><br/><i style = "color: white;">' . |
299
|
1 |
|
str_replace(';', '<br/>', str_replace('&&', '<br/>', $comando)) . '</i><br/><br/>' . |
300
|
1 |
|
str_replace("\n", '<br/>', $result['errmsg']) . '</pre>'; |
301
|
|
|
|
302
|
1 |
|
return new Response($responseout); |
303
|
|
|
} |
304
|
|
|
} |
305
|
|
|
|
306
|
|
|
/** |
307
|
|
|
* Suppress PMD warnings per exit. |
308
|
|
|
* |
309
|
|
|
* @//SuppressWarnings(PHPMD) |
310
|
|
|
*/ |
311
|
1 |
|
public function unixCommandAction(Request $request) |
312
|
|
|
{ |
313
|
1 |
|
set_time_limit(0); |
314
|
1 |
|
$pammutils = new PannelloAmministrazioneUtils($this->container); |
315
|
1 |
|
$command = $request->get('unixcommand'); |
|
|
|
|
316
|
|
|
//Se viene lanciato il comando per cancellare il file di lock su bypassa tutto e si lancia |
317
|
1 |
|
$dellockfile = "DELETELOCK"; |
|
|
|
|
318
|
1 |
|
if ($command == $dellockfile) { |
319
|
|
|
$this->locksystem->release(); |
320
|
|
|
return new Response('File di lock cancellato'); |
321
|
|
|
} |
322
|
|
|
|
323
|
1 |
|
if (!$this->locksystem->acquire()) { |
324
|
|
|
return new Response($this->getLockMessage()); |
325
|
|
|
} else { |
326
|
1 |
|
$this->locksystem->acquire(); |
327
|
1 |
|
$result = $pammutils->runCommand($command); |
328
|
|
|
|
329
|
1 |
|
$this->locksystem->release(); |
330
|
|
|
// eseguito deopo la fine del comando |
331
|
1 |
|
if ($result['errcode'] < 0) { |
332
|
|
|
$errmsg = 'Errore nel comando: <i style = "color: white;">' . |
333
|
|
|
str_replace(';', '<br/>', str_replace('&&', '<br/>', $command)) . |
334
|
|
|
'</i><br/><i style = "color: red;">' . nl2br($result['errmsg']) . '</i>'; |
335
|
|
|
|
336
|
|
|
return new Response($errmsg); |
337
|
|
|
//exit(nl2br($errmsg)); |
|
|
|
|
338
|
|
|
//Uso exit perchè new response avendo cancellato la cache schianta non avendo più a disposizione i file |
339
|
|
|
//return; |
340
|
|
|
/* return new Response('Errore nel comando: <i style = "color: white;">' . |
|
|
|
|
341
|
|
|
* $command . '</i><br/><i style = "color: red;">' . str_replace("\n", '<br/>', $process->getErrorOutput()) . '</i>'); */ |
342
|
|
|
} |
343
|
|
|
$msgok = '<pre>Eseguito comando:<br/><i style = "color: white;"><br/>' . |
344
|
1 |
|
str_replace(';', '<br/>', str_replace('&&', '<br/>', $command)) . '</i><br/>' . |
345
|
1 |
|
nl2br($result['errmsg']) . '</pre>'; |
346
|
|
|
//Uso exit perchè new response avendo cancellato la cache schianta non avendo più a disposizione i file |
347
|
1 |
|
return new Response($msgok); |
348
|
|
|
//exit(nl2br($msgok)); |
|
|
|
|
349
|
|
|
//return; |
350
|
|
|
/* return new Response('<pre>Eseguito comando: <i style = "color: white;">' . $command . |
|
|
|
|
351
|
|
|
* '</i><br/>' . str_replace("\n", "<br/>", $process->getOutput()) . "</pre>"); */ |
352
|
|
|
} |
353
|
|
|
} |
354
|
|
|
|
355
|
|
|
public function phpunittestAction(Request $request) |
|
|
|
|
356
|
|
|
{ |
357
|
|
|
set_time_limit(0); |
358
|
|
|
$this->apppaths = $this->get("pannelloamministrazione.projectpath"); |
|
|
|
|
359
|
|
|
if (!$this->locksystem->acquire()) { |
360
|
|
|
return new Response($this->getLockMessage()); |
361
|
|
|
} else { |
362
|
|
|
if (!OsFunctions::isWindows()) { |
363
|
|
|
$this->locksystem->acquire(); |
364
|
|
|
//$phpPath = OsFunctions::getPHPExecutableFromPath(); |
|
|
|
|
365
|
|
|
$sepchr = OsFunctions::getSeparator(); |
|
|
|
|
366
|
|
|
$phpPath = OsFunctions::getPHPExecutableFromPath(); |
367
|
|
|
|
368
|
|
|
// Questo codice per versioni che usano un symfony 2 o 3 |
369
|
|
|
if (version_compare(\Symfony\Component\HttpKernel\Kernel::VERSION, '3.0') >= 0) { |
370
|
|
|
$command = 'cd ' . $this->apppaths->getRootPath() . $sepchr . |
371
|
|
|
$phpPath . ' ' . 'vendor' . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'phpunit'; |
372
|
|
|
} else { |
373
|
|
|
$command = 'cd ' . $this->apppaths->getRootPath() . $sepchr . |
374
|
|
|
$phpPath . ' ' . 'bin' . DIRECTORY_SEPARATOR . 'phpunit -c app'; |
375
|
|
|
} |
376
|
|
|
|
377
|
|
|
$process = new Process($command); |
378
|
|
|
$process->run(); |
379
|
|
|
|
380
|
|
|
$this->locksystem->release(); |
381
|
|
|
// eseguito deopo la fine del comando |
382
|
|
|
/* if (!$process->isSuccessful()) { |
|
|
|
|
383
|
|
|
return new Response('Errore nel comando: <i style = "color: white;">' . |
384
|
|
|
* $command . '</i><br/><i style = "color: red;">' . str_replace("\n", |
385
|
|
|
* '<br/>', $process->getErrorOutput()) . '</i>'); |
386
|
|
|
} */ |
387
|
|
|
$responseout = '<pre>Eseguito comando: <i style = "color: white;">' . $command . '</i><br/>' . |
388
|
|
|
str_replace("\n", '<br/>', $process->getOutput()) . '</pre>'; |
389
|
|
|
|
390
|
|
|
return new Response($responseout); |
391
|
|
|
} else { |
392
|
|
|
return new Response('Non previsto in ambiente windows!'); |
393
|
|
|
} |
394
|
|
|
} |
395
|
|
|
} |
396
|
|
|
} |
397
|
|
|
|
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.