5 +-----------------------------------------------------------------------+
6 | bin/indexcontacts.sh |
8 | This file is part of the Roundcube Webmail client |
9 | Copyright (C) 2011, The Roundcube Dev Team |
10 | Licensed under the GNU GPL |
13 | Update the fulltext index for all contacts of the internal |
15 +-----------------------------------------------------------------------+
16 | Author: Thomas Bruederli <roundcube@gmail.com> |
17 +-----------------------------------------------------------------------+
19 $Id: indexcontacts.sh 5307 2011-10-05 09:28:25Z alec $
23 define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' );
25 require_once INSTALL_PATH.'program/include/clisetup.php';
26 ini_set('memory_limit', -1);
29 $RCMAIL = rcmail::get_instance();
31 $db = $RCMAIL->get_dbh();
34 if (!$db->is_connected() || $db->is_error())
35 die("No DB connection\n");
37 // iterate over all users
38 $sql_result = $db->query("SELECT user_id FROM " . $RCMAIL->config->get('db_table_users', 'users')." WHERE 1=1");
39 while ($sql_result && ($sql_arr = $db->fetch_assoc($sql_result))) {
40 echo "Indexing contacts for user " . $sql_arr['user_id'] . "...";
42 $contacts = new rcube_contacts($db, $sql_arr['user_id']);
43 $contacts->set_pagesize(9999);
45 $result = $contacts->list_records();
46 while ($result->count && ($row = $result->next())) {
48 $contacts->update($row['ID'], $row);