From 3d0d5dbd0f35c47b21e2e574703a08f07ce677dd Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 08 May 2016 08:27:56 -0400
Subject: [PATCH] Performance improvements in format_flowed() and unfold_flowed()

---
 bin/indexcontacts.sh |   29 ++---------------------------
 1 files changed, 2 insertions(+), 27 deletions(-)

diff --git a/bin/indexcontacts.sh b/bin/indexcontacts.sh
index 413dc4b..760e537 100755
--- a/bin/indexcontacts.sh
+++ b/bin/indexcontacts.sh
@@ -19,36 +19,11 @@
  +-----------------------------------------------------------------------+
 */
 
-define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' );
+define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/' );
 
 require_once INSTALL_PATH.'program/include/clisetup.php';
 ini_set('memory_limit', -1);
 
-// connect to DB
-$RCMAIL = rcmail::get_instance();
-
-$db = $RCMAIL->get_dbh();
-$db->db_connect('w');
-
-if (!$db->is_connected() || $db->is_error()) {
-    rcube::raise_error("No DB connection", false, true);
-}
-
-// iterate over all users
-$sql_result = $db->query("SELECT user_id FROM " . $RCMAIL->config->get('db_table_users', 'users')." WHERE 1=1");
-while ($sql_result && ($sql_arr = $db->fetch_assoc($sql_result))) {
-    echo "Indexing contacts for user " . $sql_arr['user_id'] . "...";
-
-    $contacts = new rcube_contacts($db, $sql_arr['user_id']);
-    $contacts->set_pagesize(9999);
-
-    $result = $contacts->list_records();
-    while ($result->count && ($row = $result->next())) {
-        unset($row['words']);
-        $contacts->update($row['ID'], $row);
-    }
-
-    echo "done.\n";
-}
+rcmail_utils::indexcontacts();
 
 ?>

--
Gitblit v1.9.1