diff options
author | Thomas Bruederli <thomas@roundcube.net> | 2016-05-15 16:49:35 +0300 |
---|---|---|
committer | Thomas Bruederli <thomas@roundcube.net> | 2016-05-15 16:49:35 +0300 |
commit | 26c4006c87b78e7f068e00566f3cc907b9efdec6 (patch) | |
tree | 018a2fe0c322a76e67963630224e41ca56fc0c4a /bin | |
parent | 614f4413ae916e2636e743a56c9d374475eca1f9 (diff) |
Improve migration of the composer.json file when updating
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/update.sh | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/bin/update.sh b/bin/update.sh index 5bc01beb2..ed0d4dbe9 100755 --- a/bin/update.sh +++ b/bin/update.sh @@ -169,14 +169,20 @@ if ($RCI->configured) { // update the require section with the new dependencies if (is_array($composer_data['require']) && is_array($composer_template['require'])) { $composer_data['require'] = array_merge($composer_data['require'], $composer_template['require']); - /* TO BE ADDED LATER - $old_packages = array(); - for ($old_packages as $pkg) { - if (array_key_exists($composer_data['require'], $pkg)) { + + // remove obsolete packages + $old_packages = array( + 'pear/mail_mime', + 'pear/mail_mime-decode', + 'pear/net_smtp', + 'pear/net_sieve', + 'pear-pear.php.net/net_sieve', + ); + foreach ($old_packages as $pkg) { + if (array_key_exists($pkg, $composer_data['require'])) { unset($composer_data['require'][$pkg]); } } - */ } // update the repositories section with the new dependencies @@ -190,12 +196,18 @@ if ($RCI->configured) { $existing = false; foreach ($composer_data['repositories'] as $k => $_repo) { if ($rkey == $_repo['type'] . preg_replace('/^https?:/', '', $_repo['url']) . $_repo['package']['name']) { + // switch to https:// + if (isset($_repo['url']) && strpos($_repo['url'], 'http://') === 0) + $composer_data['repositories'][$k]['url'] = 'https:' . substr($_repo['url'], 5); $existing = true; break; } // remove old repos else if (strpos($_repo['url'], 'git://git.kolab.org') === 0) { - unset($composer_data['repositories'][$k]); + unset($composer_data['repositories'][$k]); + } + else if ($_repo['type'] == 'package' && $_repo['package']['name'] == 'Net_SMTP') { + unset($composer_data['repositories'][$k]); } } if (!$existing) { |