Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 55 lines (41 sloc) 1.941 kB
3e26373 @thomascube Fulltext search over contact fields. Attention: DATABASE SCHEMA CHANG…
thomascube authored
1 #!/usr/bin/env php
2 <?php
3 /*
4
5 +-----------------------------------------------------------------------+
6 | bin/indexcontacts.sh |
7 | |
8 | This file is part of the Roundcube Webmail client |
9 | Copyright (C) 2011, The Roundcube Dev Team |
10 | Licensed under the GNU GPL |
11 | |
12 | PURPOSE: |
13 | Update the fulltext index for all contacts of the internal |
14 | address book. |
15 +-----------------------------------------------------------------------+
16 | Author: Thomas Bruederli <roundcube@gmail.com> |
17 +-----------------------------------------------------------------------+
18
19 $Id$
20
21 */
22
23 define('INSTALL_PATH', realpath(dirname(__FILE__) . '/..') . '/' );
24
25 require_once INSTALL_PATH.'program/include/clisetup.php';
4aafd99 @alecpl - Remove memory_limit for indexcontacts.sh (#1488109)
alecpl authored
26 ini_set('memory_limit', -1);
3e26373 @thomascube Fulltext search over contact fields. Attention: DATABASE SCHEMA CHANG…
thomascube authored
27
28 // connect to DB
29 $RCMAIL = rcmail::get_instance();
30
31 $db = $RCMAIL->get_dbh();
32 $db->db_connect('w');
33
34 if (!$db->is_connected() || $db->is_error())
35 die("No DB connection\n");
36
37 // iterate over all users
9556e00 @alecpl - Fix SQL query for postgres
alecpl authored
38 $sql_result = $db->query("SELECT user_id FROM " . $RCMAIL->config->get('db_table_users', 'users')." WHERE 1=1");
3e26373 @thomascube Fulltext search over contact fields. Attention: DATABASE SCHEMA CHANG…
thomascube authored
39 while ($sql_result && ($sql_arr = $db->fetch_assoc($sql_result))) {
40 echo "Indexing contacts for user " . $sql_arr['user_id'] . "...";
41
42 $contacts = new rcube_contacts($db, $sql_arr['user_id']);
43 $contacts->set_pagesize(9999);
44
45 $result = $contacts->list_records();
46 while ($result->count && ($row = $result->next())) {
47 unset($row['words']);
48 $contacts->update($row['ID'], $row);
49 }
4aafd99 @alecpl - Remove memory_limit for indexcontacts.sh (#1488109)
alecpl authored
50
3e26373 @thomascube Fulltext search over contact fields. Attention: DATABASE SCHEMA CHANG…
thomascube authored
51 echo "done.\n";
52 }
53
54 ?>
Something went wrong with that request. Please try again.