3 * StatusNet - the distributed open-source microblogging tool
4 * Copyright (C) 2009, StatusNet, Inc.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 function sphinx_use_network()
22 return have_option('network');
25 function sphinx_base()
27 if (have_option('base')) {
28 return get_option_value('base');
30 return "/usr/local/sphinx";
34 function sphinx_iterate_sites($callback)
36 if (sphinx_use_network()) {
37 // @fixme this should use, like, some kind of config
38 Status_network::setupDB('localhost', 'statusnet', 'statuspass', 'statusnet');
39 $sn = new Status_network();
41 die("Confused... no sites in status_network table or lookup failed.\n");
43 while ($sn->fetch()) {
47 if (preg_match('!^(mysqli?|pgsql)://(.*?):(.*?)@(.*?)/(.*?)$!',
48 common_config('db', 'database'), $matches)) {
49 list(/*all*/, $dbtype, $dbuser, $dbpass, $dbhost, $dbname) = $matches;
51 'sitename' => common_config('site', 'name'),
58 print "Unrecognized database configuration string in config.php\n";