Thomas Bruederli
2015-06-02 a552b506da64bcedff7af5464ac786c1ce66c43c
bin/update.sh
@@ -5,7 +5,7 @@
 | bin/update.sh                                                         |
 |                                                                       |
 | This file is part of the Roundcube Webmail client                     |
 | Copyright (C) 2010-2014, The Roundcube Dev Team                       |
 | Copyright (C) 2010-2015, The Roundcube Dev Team                       |
 |                                                                       |
 | Licensed under the GNU General Public License version 3 or            |
 | any later version with exceptions for skins & plugins.                |
@@ -181,6 +181,33 @@
      */
    }
    // update the repositories section with the new dependencies
    if (is_array($composer_template['repositories'])) {
      if (!is_array($composer_data['repositories'])) {
        $composer_data['repositories'] = array();
      }
      foreach ($composer_template['repositories'] as $repo) {
        $rkey = $repo['type'] . preg_replace('/^https?:/', '', $repo['url']) . $repo['package']['name'];
        $existing = false;
        foreach ($composer_data['repositories'] as $k =>  $_repo) {
          if ($rkey == $_repo['type'] . preg_replace('/^https?:/', '', $_repo['url']) . $_repo['package']['name']) {
            $existing = true;
            break;
          }
          // remove old repos
          else if (strpos($_repo['url'], 'git://git.kolab.org') === 0) {
              unset($composer_data['repositories'][$k]);
          }
        }
        if (!$existing) {
          $composer_data['repositories'][] = $repo;
        }
      }
      $composer_data['repositories'] = array_values($composer_data['repositories']);
    }
    // use the JSON encoder from the Composer package
    if (is_file('composer.phar')) {
      include 'phar://composer.phar/src/Composer/Json/JsonFile.php';
@@ -188,7 +215,7 @@
    }
    // PHP 5.4's json_encode() does the job, too
    else if (defined('JSON_PRETTY_PRINT')) {
      $comsposer_json = json_encode($composer_data, JSON_PRETTY_PRINT & JSON_UNESCAPED_SLASHES);
      $comsposer_json = json_encode($composer_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
    }
    else {
      $success = false;