From a3644638aaf0418598196a870204e0b632a4c8ad Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Fri, 17 Apr 2015 06:28:40 -0400
Subject: [PATCH] Allow preference sections to define CSS class names

---
 bin/update.sh |   31 +++++++++++++++++++++++++------
 1 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/bin/update.sh b/bin/update.sh
index 9d3508e..bfb2148 100755
--- a/bin/update.sh
+++ b/bin/update.sh
@@ -156,10 +156,8 @@
   // check database schema
   if ($RCI->config['db_dsnw']) {
     echo "Executing database schema update.\n";
-    system("php " . INSTALL_PATH . "bin/updatedb.sh --package=roundcube --version=" . $opts['version']
-      . " --dir=" . INSTALL_PATH . "SQL", $res);
-
-    $success = !$res;
+    $success = rcmail_utils::db_update(INSTALL_PATH . 'SQL', 'roundcube', $opts['version'],
+        array('errors' => true));
   }
 
   // update composer dependencies
@@ -181,6 +179,27 @@
       */
     }
 
+    // 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'] . $repo['url'] . $repo['package']['name'];
+        $existing = false;
+        foreach ($composer_data['repositories'] as $_repo) {
+          if ($rkey == $_repo['type'] . $_repo['url'] . $_repo['package']['name']) {
+            $existing = true;
+            break;
+          }
+        }
+        if (!$existing) {
+          $composer_data['repositories'][] = $repo;
+        }
+      }
+    }
+
     // use the JSON encoder from the Composer package
     if (is_file('composer.phar')) {
       include 'phar://composer.phar/src/Composer/Json/JsonFile.php';
@@ -196,7 +215,7 @@
     }
 
     // write updated composer.json back to disk
-    if (0&&$comsposer_json && is_writeable(INSTALL_PATH . 'composer.json')) {
+    if ($comsposer_json && is_writeable(INSTALL_PATH . 'composer.json')) {
       $success &= (bool)file_put_contents(INSTALL_PATH . 'composer.json', $comsposer_json);
     }
     else {
@@ -218,7 +237,7 @@
 
   // index contacts for fulltext searching
   if ($opts['version'] && version_compare(version_parse($opts['version']), '0.6.0', '<')) {
-    system("php " . INSTALL_PATH . 'bin/indexcontacts.sh');
+    rcmail_utils::indexcontacts();
   }
 
   if ($success) {

--
Gitblit v1.9.1