mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-14 21:43:18 +00:00
51 lines
1.4 KiB
PHP
Executable File
51 lines
1.4 KiB
PHP
Executable File
#!/usr/bin/env php
|
|
<?php
|
|
function setupStreaming() {
|
|
// Turn off output buffering
|
|
ini_set('output_buffering', 'off');
|
|
// Turn off PHP output compression
|
|
ini_set('zlib.output_compression', false);
|
|
// Disable Apache output buffering/compression
|
|
if (function_exists('apache_setenv')) {
|
|
apache_setenv('no-gzip', '1');
|
|
apache_setenv('dont-vary', '1');
|
|
}
|
|
}
|
|
function runCommand($cmd){
|
|
echo "+ $cmd\n";
|
|
system($cmd, $return);
|
|
if (0 !== $return) {
|
|
throw new \Exception(sprintf('Error %d: %s', $return, $cmd));
|
|
}
|
|
}
|
|
setupStreaming();
|
|
|
|
$plugins = trim(getenv('PHRASEANET_PLUGINS'));
|
|
if (empty($plugins)) {
|
|
echo "No plugin to install... SKIP\n";
|
|
exit(0);
|
|
}
|
|
|
|
foreach (explode(' ', $plugins) as $key => $plugin) {
|
|
$plugin = trim($plugin);
|
|
$repo = $plugin;
|
|
$branch = 'master';
|
|
if (1 === preg_match('#^(.+)\(([^)]+)\)$#', $plugin, $matches)) {
|
|
$repo = $matches[1];
|
|
$branch = $matches[2];
|
|
}
|
|
|
|
$pluginTmpName = 'plugin' . $key;
|
|
$pluginPath = './plugin' . $key;
|
|
if (is_dir($pluginPath)) {
|
|
echo shell_exec(sprintf('rm -rf %s', $pluginPath));
|
|
}
|
|
|
|
echo sprintf("Installing %s (branch: %s)\n", $repo, $branch);
|
|
runCommand(sprintf('git clone --single-branch --branch %s %s %s', $branch, $repo, $pluginPath));
|
|
|
|
runCommand(sprintf('bin/setup plugins:add %s', $pluginPath));
|
|
|
|
echo shell_exec(sprintf('rm -rf %s', $pluginPath));
|
|
}
|