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