- move sphinx plugin to a separate repo

- regenerate config checks without sphinx-related variables
This commit is contained in:
Andrew Dolgov 2020-12-11 09:48:34 +03:00
parent 43bd3394c3
commit 65254f5db4
5 changed files with 3 additions and 1775 deletions

View File

@ -89,18 +89,6 @@
// intervals is disabled and all articles (which are not starred) // intervals is disabled and all articles (which are not starred)
// older than this amount of days are purged. // older than this amount of days are purged.
// ****************************
// *** Sphinx search plugin ***
// ****************************
define('SPHINX_SERVER', 'localhost:9312');
// Hostname:port combination for the Sphinx server.
define('SPHINX_INDEX', 'ttrss, delta');
// Index name in Sphinx configuration. You can specify multiple indexes
// as a comma-separated string.
// Example configuration files are available on tt-rss wiki.
// *********************************** // ***********************************
// *** Self-registrations by users *** // *** Self-registrations by users ***
// *********************************** // ***********************************

View File

@ -1,3 +1,3 @@
<?php # This file has been generated at: Thu Nov 22 22:14:43 MSK 2018 <?php # This file has been generated at: Fri Dec 11 09:30:20 MSK 2020
define('GENERATED_CONFIG_CHECK', 26); define('GENERATED_CONFIG_CHECK', 26);
$required_defines = array( 'DB_TYPE', 'DB_HOST', 'DB_USER', 'DB_NAME', 'DB_PASS', 'MYSQL_CHARSET', 'SELF_URL_PATH', 'SINGLE_USER_MODE', 'SIMPLE_UPDATE_MODE', 'PHP_EXECUTABLE', 'LOCK_DIRECTORY', 'CACHE_DIR', 'ICONS_DIR', 'ICONS_URL', 'AUTH_AUTO_CREATE', 'AUTH_AUTO_LOGIN', 'FORCE_ARTICLE_PURGE', 'SPHINX_SERVER', 'SPHINX_INDEX', 'ENABLE_REGISTRATION', 'REG_NOTIFY_ADDRESS', 'REG_MAX_USERS', 'SESSION_COOKIE_LIFETIME', 'SMTP_FROM_NAME', 'SMTP_FROM_ADDRESS', 'DIGEST_SUBJECT', 'CHECK_FOR_UPDATES', 'ENABLE_GZIP_OUTPUT', 'PLUGINS', 'LOG_DESTINATION', 'CONFIG_VERSION'); ?> $required_defines = array( 'DB_TYPE', 'DB_HOST', 'DB_USER', 'DB_NAME', 'DB_PASS', 'MYSQL_CHARSET', 'SELF_URL_PATH', 'SINGLE_USER_MODE', 'SIMPLE_UPDATE_MODE', 'PHP_EXECUTABLE', 'LOCK_DIRECTORY', 'CACHE_DIR', 'ICONS_DIR', 'ICONS_URL', 'AUTH_AUTO_CREATE', 'AUTH_AUTO_LOGIN', 'FORCE_ARTICLE_PURGE', 'ENABLE_REGISTRATION', 'REG_NOTIFY_ADDRESS', 'REG_MAX_USERS', 'SESSION_COOKIE_LIFETIME', 'SMTP_FROM_NAME', 'SMTP_FROM_ADDRESS', 'DIGEST_SUBJECT', 'CHECK_FOR_UPDATES', 'ENABLE_GZIP_OUTPUT', 'PLUGINS', 'LOG_DESTINATION', 'CONFIG_VERSION'); ?>

View File

@ -1,65 +0,0 @@
<?php
class Search_Sphinx extends Plugin {
function about() {
return array(1.0,
"Delegate searching for articles to Sphinx (don't forget to set options in config.php)",
"hoelzro",
true,
"https://git.tt-rss.org/fox/tt-rss/wiki/SphinxSearch");
}
function init($host) {
$host->add_hook($host::HOOK_SEARCH, $this);
// idk if that would work but checking for the class being loaded is somehow not enough
if (class_exists("SphinxClient") && !defined('SEARCHD_COMMAND_SEARCH')) {
user_error("Your PHP has a separate systemwide Sphinx client installed which conflicts with the client library used by tt-rss. Either remove the system library or disable Sphinx support.");
}
require_once __DIR__ . "/sphinxapi.php";
}
function hook_search($search) {
$offset = 0;
$limit = 500;
$sphinxClient = new SphinxClient();
$sphinxpair = explode(":", SPHINX_SERVER, 2);
$sphinxClient->SetServer($sphinxpair[0], (int)$sphinxpair[1]);
$sphinxClient->SetConnectTimeout(1);
$sphinxClient->SetFieldWeights(array('title' => 70, 'content' => 30,
'feed_title' => 20));
$sphinxClient->SetMatchMode(SPH_MATCH_EXTENDED2);
$sphinxClient->SetRankingMode(SPH_RANK_PROXIMITY_BM25);
$sphinxClient->SetLimits($offset, $limit, 1000);
$sphinxClient->SetArrayResult(false);
$sphinxClient->SetFilter('owner_uid', array($_SESSION['uid']));
$result = $sphinxClient->Query($search, SPHINX_INDEX);
$ids = array();
if (is_array($result['matches'])) {
foreach (array_keys($result['matches']) as $int_id) {
$ref_id = $result['matches'][$int_id]['attrs']['ref_id'];
array_push($ids, $ref_id);
}
}
$ids = join(",", $ids);
if ($ids)
return array("ref_id IN ($ids)", array());
else
return array("ref_id = -1", array());
}
function api_version() {
return 2;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@ DESTINATION="include/sanity_config.php"
echo "<?php # This file has been generated at: " `date` > $DESTINATION echo "<?php # This file has been generated at: " `date` > $DESTINATION
echo -n "define('GENERATED_CONFIG_CHECK', " >> $DESTINATION echo -n "define('GENERATED_CONFIG_CHECK', " >> $DESTINATION
grep CONFIG_VERSION config.php-dist | awk -F ' |)' '{ print $2 }' | xargs echo -n >> $DESTINATION grep CONFIG_VERSION config.php-dist | awk -F ' |\)' '{ print $2 }' | xargs echo -n >> $DESTINATION
echo ");" >> $DESTINATION echo ");" >> $DESTINATION
echo -n "\$required_defines = array( " >> $DESTINATION echo -n "\$required_defines = array( " >> $DESTINATION