2019-06-03 11:02:50 +00:00
|
|
|
<?php
|
|
|
|
|
|
2021-02-09 05:32:31 +00:00
|
|
|
/* max execution time limit */
|
2021-01-06 04:13:55 +00:00
|
|
|
ini_set('max_execution_time', 900);
|
|
|
|
|
|
2021-02-09 05:32:31 +00:00
|
|
|
/* php bin path */
|
2021-01-05 01:27:37 +00:00
|
|
|
$phpbin = PHP_BINDIR . '/php';
|
2019-06-03 11:02:50 +00:00
|
|
|
|
2021-02-09 05:32:31 +00:00
|
|
|
/* commands sequence */
|
|
|
|
|
$commands = [
|
|
|
|
|
'seeder' => [
|
|
|
|
|
'key' => 'seeder_results',
|
|
|
|
|
'command' => 'cd ../.. && '. $phpbin .' artisan db:seed 2>&1'
|
|
|
|
|
],
|
|
|
|
|
'publish' => [
|
|
|
|
|
'key' => 'publish_results',
|
2022-04-05 08:31:22 +00:00
|
|
|
'command' => 'cd ../.. && '. $phpbin .' artisan bagisto:publish --force 2>&1'
|
2021-02-09 05:32:31 +00:00
|
|
|
],
|
|
|
|
|
'storage_link' => [
|
|
|
|
|
'key' => 'storage_link_results',
|
|
|
|
|
'command' => 'cd ../.. && '. $phpbin .' artisan storage:link 2>&1'
|
|
|
|
|
],
|
|
|
|
|
'key' => [
|
|
|
|
|
'key' => 'key_results',
|
|
|
|
|
'command' => 'cd ../.. && '. $phpbin .' artisan key:generate 2>&1'
|
|
|
|
|
],
|
|
|
|
|
'optimize' => [
|
|
|
|
|
'key' => 'optimize_results',
|
|
|
|
|
'command' => 'cd ../.. && '. $phpbin .' artisan optimize 2>&1'
|
|
|
|
|
],
|
|
|
|
|
];
|
2019-06-03 11:02:50 +00:00
|
|
|
|
2021-02-09 05:32:31 +00:00
|
|
|
// run command on terminal
|
|
|
|
|
$data = [];
|
|
|
|
|
foreach ($commands as $key => $value) {
|
|
|
|
|
exec($value['command'], $data[$key], $data[$value['key']]);
|
|
|
|
|
}
|
2019-06-03 11:02:50 +00:00
|
|
|
|
|
|
|
|
// return a response
|
2021-02-09 05:32:31 +00:00
|
|
|
// return all our data to an AJAX call
|
2021-01-06 04:13:55 +00:00
|
|
|
echo json_encode($data);
|