mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 09:18:54 +00:00
41 lines
1.2 KiB
PHP
41 lines
1.2 KiB
PHP
<?php
|
|
require dirname(__FILE__) . '/../../www/config.php';
|
|
|
|
use newznab\db\Settings;
|
|
|
|
|
|
if (NN_RELEASE_SEARCH_TYPE != \ReleaseSearch::SPHINX) {
|
|
exit('Error, NN_RELEASE_SEARCH_TYPE in www/settings.php must be set to SPHINX!' . PHP_EOL);
|
|
}
|
|
|
|
if (!isset($argv[1]) || !isset($argv[2]) || !is_numeric($argv[2])) {
|
|
exit('Argument 1 must the hostname or IP to the Sphinx searchd server, Argument 2 must be the port to the Sphinx searchd server.' . PHP_EOL);
|
|
}
|
|
|
|
$pdo = new Settings();
|
|
|
|
$sphinxConnection = sprintf('%s:%d', $argv[1], $argv[2]);
|
|
|
|
$tables = [];
|
|
$tables['releases_se'] =
|
|
sprintf(
|
|
"CREATE TABLE releases_se
|
|
(
|
|
id BIGINT UNSIGNED NOT NULL,
|
|
weight INTEGER NOT NULL,
|
|
query VARCHAR(1024) NOT NULL,
|
|
guid VARCHAR(40) NOT NULL,
|
|
name VARCHAR(255) NOT NULL DEFAULT '',
|
|
searchname VARCHAR(255) NOT NULL DEFAULT '',
|
|
fromname VARCHAR(255) NULL,
|
|
INDEX(query)
|
|
) ENGINE=SPHINX CONNECTION=\"sphinx://%s/releases_rt\"",
|
|
$sphinxConnection
|
|
);
|
|
|
|
foreach ($tables as $table => $query) {
|
|
$pdo->queryExec(sprintf('DROP TABLE IF EXISTS %s', $table));
|
|
$pdo->queryExec($query);
|
|
}
|
|
|
|
echo 'All done! If you messed up your sphinx connection info, you can rerun this script.' . PHP_EOL; |