Browse Source
Update vendor dir from installto.sh if untouched (#8642) (#8840)
* installto.sh checks for a marker indicating that composer was not run/used.
* update.sh tries to find and run composer
pull/8853/head
Thomas B
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
42 additions and
2 deletions
-
Makefile
-
bin/installto.sh
-
bin/update.sh
-
program/include/rcmail_install.php
|
|
@ -25,6 +25,7 @@ complete: roundcubemail-git |
|
|
|
(cd roundcubemail-$(VERSION); bin/jsshrink.sh program/js/publickey.js; bin/jsshrink.sh plugins/managesieve/codemirror/lib/codemirror.js) |
|
|
|
(cd roundcubemail-$(VERSION); rm -f jsdeps.json bin/install-jsdeps.sh *.orig; rm -rf temp/js_cache) |
|
|
|
(cd roundcubemail-$(VERSION); rm -rf vendor/pear/*/tests vendor/*/*/.git* vendor/*/*/.travis* vendor/*/*/phpunit.xml.dist vendor/pear/console_commandline/docs vendor/pear/net_ldap2/doc vendor/bacon/bacon-qr-code/test vendor/dasprid/enum/test) |
|
|
|
(cd roundcubemail-$(VERSION); echo "// generated by Roundcube install $(VERSION)" >> vendor/autoload.php) |
|
|
|
tar czf roundcubemail-$(VERSION)-complete.tar.gz roundcubemail-$(VERSION) |
|
|
|
rm -rf roundcubemail-$(VERSION) |
|
|
|
|
|
|
|
|
|
@ -60,7 +60,7 @@ if (strtolower($input) == 'y') { |
|
|
|
$adds = []; |
|
|
|
$dirs = ['bin','SQL','plugins','skins','program','public_html']; |
|
|
|
|
|
|
|
if (is_dir(INSTALL_PATH . 'vendor') && !is_file("$target_dir/composer.json")) { |
|
|
|
if (is_dir(INSTALL_PATH . 'vendor') && (!is_file("$target_dir/composer.json") || rcmail_install::vendor_dir_untouched($target_dir))) { |
|
|
|
$dirs[] = 'vendor'; |
|
|
|
} |
|
|
|
if (file_exists("$target_dir/installer")) { |
|
|
|
|
|
@ -267,7 +267,18 @@ if ($RCI->configured) { |
|
|
|
echo "\n }\n\n"; |
|
|
|
} |
|
|
|
|
|
|
|
echo "NOTICE: Update dependencies by running `php composer.phar update --no-dev`\n"; |
|
|
|
if (!rcmail_install::vendor_dir_untouched(INSTALL_PATH)) { |
|
|
|
$exit_code = 1; |
|
|
|
if ($composer_bin = find_composer()) { |
|
|
|
echo "Executing " . $composer_bin . " to update dependencies...\n"; |
|
|
|
echo system("$composer_bin update -d " . escapeshellarg(INSTALL_PATH) . " --no-dev", $exit_code); |
|
|
|
} |
|
|
|
if ($exit_code != 0) { |
|
|
|
echo "-----------------------------------------------------------------------------\n"; |
|
|
|
echo "ATTENTION: Update dependencies by running `php composer.phar update --no-dev`\n"; |
|
|
|
echo "-----------------------------------------------------------------------------\n"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// index contacts for fulltext searching |
|
|
@ -299,3 +310,19 @@ function repo_key($repo) |
|
|
|
|
|
|
|
return $key; |
|
|
|
} |
|
|
|
|
|
|
|
function find_composer() |
|
|
|
{ |
|
|
|
if (is_file(INSTALL_PATH . 'composer.phar')) { |
|
|
|
return 'php composer.phar'; |
|
|
|
} |
|
|
|
|
|
|
|
foreach (['composer', 'composer.phar'] as $check_file) { |
|
|
|
$which = trim(system("which $check_file")); |
|
|
|
if (!empty($which)) { |
|
|
|
return $which; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
} |
|
|
@ -917,4 +917,16 @@ class rcmail_install |
|
|
|
{ |
|
|
|
$this->last_error = $p; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Check if vendor/autoload.php was created by Roundcube and left untouched |
|
|
|
* |
|
|
|
* @param string $target_dir The target installation dir |
|
|
|
* @return string |
|
|
|
*/ |
|
|
|
public static function vendor_dir_untouched($target_dir) |
|
|
|
{ |
|
|
|
system('grep -q "generated by Roundcube" ' . escapeshellarg($target_dir . '/vendor/autoload.php') . ' 2>/dev/null', $exit_code); |
|
|
|
return $exit_code === 0; |
|
|
|
} |
|
|
|
} |