Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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