|
@@ 67-94 (lines=28) @@
|
| 64 |
|
* @param string $packageName |
| 65 |
|
* @return bool |
| 66 |
|
*/ |
| 67 |
|
public function execRequire($packageName) |
| 68 |
|
{ |
| 69 |
|
set_time_limit(0); |
| 70 |
|
// Build command |
| 71 |
|
$packageName = self::$vendorName.'/'.$packageName; |
| 72 |
|
$command = $this->getPHP().' '.$this->composerFile.' require '.$packageName; |
| 73 |
|
$command .= ' --prefer-dist --no-progress --no-suggest --no-scripts --ignore-platform-reqs --profile --no-ansi --no-interaction -d '; |
| 74 |
|
$command .= $this->app['config']['root_dir'].' 2>&1'; |
| 75 |
|
$this->app->log($command); |
| 76 |
|
|
| 77 |
|
/** |
| 78 |
|
* Mysql lock in transaction |
| 79 |
|
* @link https://dev.mysql.com/doc/refman/5.7/en/lock-tables.html |
| 80 |
|
* @var EntityManagerInterface $em |
| 81 |
|
*/ |
| 82 |
|
$em = $this->app['orm.em']; |
| 83 |
|
if ($em->getConnection()->isTransactionActive()) { |
| 84 |
|
$em->getConnection()->commit(); |
| 85 |
|
$em->getConnection()->beginTransaction(); |
| 86 |
|
} |
| 87 |
|
|
| 88 |
|
// Execute command |
| 89 |
|
$output = array(); |
| 90 |
|
exec($command, $output); |
| 91 |
|
$this->app->log(PHP_EOL . implode(PHP_EOL, $output) . PHP_EOL); |
| 92 |
|
|
| 93 |
|
return true; |
| 94 |
|
} |
| 95 |
|
|
| 96 |
|
/** |
| 97 |
|
* This function to remove a plugin by composer remove |
|
@@ 103-130 (lines=28) @@
|
| 100 |
|
* @param string $packageName |
| 101 |
|
* @return bool |
| 102 |
|
*/ |
| 103 |
|
public function execRemove($packageName) |
| 104 |
|
{ |
| 105 |
|
set_time_limit(0); |
| 106 |
|
// Build command |
| 107 |
|
$packageName = self::$vendorName.'/'.$packageName; |
| 108 |
|
$command = $this->getPHP().' '.$this->composerFile.' remove '.$packageName; |
| 109 |
|
$command .= ' --no-progress --no-scripts --ignore-platform-reqs --profile --no-ansi --no-interaction -d '; |
| 110 |
|
$command .= $this->app['config']['root_dir'].' 2>&1'; |
| 111 |
|
$this->app->log($command); |
| 112 |
|
|
| 113 |
|
/** |
| 114 |
|
* Mysql lock in transaction |
| 115 |
|
* @link https://dev.mysql.com/doc/refman/5.7/en/lock-tables.html |
| 116 |
|
* @var EntityManagerInterface $em |
| 117 |
|
*/ |
| 118 |
|
$em = $this->app['orm.em']; |
| 119 |
|
if ($em->getConnection()->isTransactionActive()) { |
| 120 |
|
$em->getConnection()->commit(); |
| 121 |
|
$em->getConnection()->beginTransaction(); |
| 122 |
|
} |
| 123 |
|
|
| 124 |
|
// Execute command |
| 125 |
|
$output = array(); |
| 126 |
|
exec($command, $output); |
| 127 |
|
$this->app->log(PHP_EOL.implode(PHP_EOL, $output).PHP_EOL); |
| 128 |
|
|
| 129 |
|
return true; |
| 130 |
|
} |
| 131 |
|
|
| 132 |
|
/** |
| 133 |
|
* Get environment php command |