123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- function sphinx_use_network()
- {
- return have_option('network');
- }
- function sphinx_base()
- {
- if (have_option('base')) {
- return get_option_value('base');
- } else {
- return "/usr/local/sphinx";
- }
- }
- function sphinx_iterate_sites($callback)
- {
- if (sphinx_use_network()) {
-
- Status_network::setupDB('localhost', 'statusnet', 'statuspass', 'statusnet');
- $sn = new Status_network();
- if (!$sn->find()) {
- die("Confused... no sites in status_network table or lookup failed.\n");
- }
- while ($sn->fetch()) {
- $callback($sn);
- }
- } else {
- if (preg_match('!^(mysqli?|pgsql)://(.*?):(.*?)@(.*?)/(.*?)$!',
- common_config('db', 'database'), $matches)) {
- list(, $dbtype, $dbuser, $dbpass, $dbhost, $dbname) = $matches;
- $sn = (object)array(
- 'sitename' => common_config('site', 'name'),
- 'dbhost' => $dbhost,
- 'dbuser' => $dbuser,
- 'dbpass' => $dbpass,
- 'dbname' => $dbname);
- $callback($sn);
- } else {
- print "Unrecognized database configuration string in config.php\n";
- exit(1);
- }
- }
- }
|