Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation bugs fixed #163

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion environments/dev/common/config/main-local.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
'sphinx' => [
'class' => 'yii\sphinx\Connection',
'dsn' => 'mysql:host=localhost;port=9001;',
'dsn' => 'mysql:host=127.0.0.1;port=9306;',
'username' => '',
'password' => '',
'schemaCache' => 'cache',
Expand Down
67 changes: 41 additions & 26 deletions environments/dev/conf/sphinx.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source opb_dbconnect {
source npb_dbconnect {
type = mysql

sql_host = localhost
Expand All @@ -10,23 +10,7 @@ source opb_dbconnect {
sql_query_pre = SET NAMES utf8
}

index opb_common {
docinfo = extern
charset_table = 0..9, A..Z->a..z, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F

expand_keywords = 1
index_exact_words = 1
morphology = stem_enru
min_stemming_len = 4
dict = keywords

ngram_len = 1
ngram_chars = U+4E00..U+9FBB, U+3400..U+4DB5, U+20000..U+2A6D6, U+FA0E, U+FA0F, U+FA11, U+FA13, U+FA14, U+FA1F, U+FA21, U+FA23, U+FA24, U+FA27, U+FA28, U+FA29, U+3105..U+312C, U+31A0..U+31B7, U+3041, U+3043, U+3045, U+3047, U+3049, U+304B, U+304D, U+304F, U+3051, U+3053, U+3055, U+3057, U+3059, U+305B, U+305D, U+305F, U+3061, U+3063, U+3066, U+3068, U+306A..U+306F, U+3072, U+3075, U+3078, U+307B, U+307E..U+3083, U+3085, U+3087, U+3089..U+308E, U+3090..U+3093, U+30A1, U+30A3, U+30A5, U+30A7, U+30A9, U+30AD, U+30AF, U+30B3, U+30B5, U+30BB, U+30BD, U+30BF, U+30C1, U+30C3, U+30C4, U+30C6, U+30CA, U+30CB, U+30CD, U+30CE, U+30DE, U+30DF, U+30E1, U+30E2, U+30E3, U+30E5, U+30E7, U+30EE, U+30F0..U+30F3, U+30F5, U+30F6, U+31F0, U+31F1, U+31F2, U+31F3, U+31F4, U+31F5, U+31F6, U+31F7, U+31F8, U+31F9, U+31FA, U+31FB, U+31FC, U+31FD, U+31FE, U+31FF, U+AC00..U+D7A3, U+1100..U+1159, U+1161..U+11A2, U+11A8..U+11F9, U+A000..U+A48C, U+A492..U+A4C6

preopen = 1
}

source opbtorrents : opb_dbconnect {
source npbtorrents : npb_dbconnect {
sql_query_pre = SELECT @maxId := MAX(id), @minId := MIN(id) FROM torrents
sql_query_pre = SELECT @dateMerged := NOW()
sql_query_pre = SELECT @sphinxInstance := IF(STRCMP(@sphinxHost := SUBSTRING_INDEX(host, ':', 1), 'localhost'), @sphinxHost, @@hostname) AS sphinx_instance \
Expand Down Expand Up @@ -61,14 +45,27 @@ source opbtorrents : opb_dbconnect {

}

index opbtorrents : opb_common {
source = opbtorrents
path = /var/lib/sphinx/opbtorrents
index npbtorrents {
source = npbtorrents
path = /var/lib/sphinx/npbtorrents
min_prefix_len = 3
dict = keywords

docinfo = extern
charset_table = 0..9, A..Z->a..z, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F

expand_keywords = 1
index_exact_words = 1
morphology = stem_enru
min_stemming_len = 4

ngram_len = 1
ngram_chars = U+4E00..U+9FBB, U+3400..U+4DB5, U+20000..U+2A6D6, U+FA0E, U+FA0F, U+FA11, U+FA13, U+FA14, U+FA1F, U+FA21, U+FA23,$

preopen = 1
}

source opbtorrents_delta : opb_dbconnect {
source npbtorrents_delta : npb_dbconnect {
sql_query_pre = SELECT @sphinxInstance := IF(STRCMP(@sphinxHost := SUBSTRING_INDEX(host, ':', 1), 'localhost'), @sphinxHost, @@hostname) AS sphinx_instance \
FROM information_schema.processlist WHERE ID=connection_id();
sql_query_pre = SELECT @minId := `last_merged_id` FROM `sph_idx` WHERE `index`='opbtorrents' AND `host`=@sphinxInstance
Expand Down Expand Up @@ -102,7 +99,25 @@ source opbtorrents_delta : opb_dbconnect {
sql_attr_uint = deleted
}

index opbtorrents_delta : opbtorrents {
source = opbtorrents_delta
path = /var/lib/sphinx/opbtorrents_delta
}
index npbtorrents_delta : npbtorrents {
source = npbtorrents_delta
path = /var/lib/sphinx/npbtorrents_delta
}

indexer {
mem_limit = 512M
}

searchd {
listen = 3312
listen = 9306:mysql41
log = /var/log/sphinx/searchd.log
read_timeout = 5
max_children = 0
pid_file = /var/run/sphinx/searchd.pid
seamless_rotate = 0
preopen_indexes = 1
unlink_old = 1
workers = threads
binlog_path = /var/lib/sphinx
}
2 changes: 2 additions & 0 deletions frontend/modules/rating/RatingModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace frontend\modules\rating;

use yii\base\Exception;

class RatingModule extends \yii\base\Module
{
const EVENT_RATING_ADD = 'ratingAdd';
Expand Down
2 changes: 1 addition & 1 deletion frontend/modules/search/models/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public static function getLastTorrentsDataProvider($count = 5, $forceRefresh = f
}

if (empty($torrentsIds)) {
Yii::log('Empty last torrents ids', CLogger::LEVEL_WARNING);
Yii::warning('Empty last torrents ids');
} else {
$query = (new Torrent())->find()->with('scrapes')
->where(['id' => $torrentsIds]);
Expand Down
22 changes: 11 additions & 11 deletions frontend/themes/newopb/modules/rating/widgets/views/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
</div>

<div class="rating-stat none">
<?php for($i = $max; $i >= $min; $i=$i-$step): ?>
<?php $isRating = false; ?>
<?php foreach($ratingStats as $ratingStat): ?>
<?php if($ratingStat->rating == $i):?>
<p><strong><?= $ratingStat->rating ?></strong> (<span id="rating-stat-<?= $i ?>"><?= $ratingStat->count ?></span>)</p>
<?php $isRating = true; break; ?>
<?php for($i = $max; $i >= $min; $i=$i-$step): ?>
<?php $isRating = false; ?>
<?php foreach($ratingStats as $ratingStat): ?>
<?php if($ratingStat->rating == $i): ?>
<p><strong><?= $ratingStat->rating ?></strong> (<span id="rating-stat-<?= $i ?>"><?= $ratingStat->count ?></span>)</p>
<?php $isRating = true; break; ?>
<?php endif; ?>
<?php endforeach; ?>
<?php if(!$isRating): ?>
<p><strong><?= $i ?></strong> (<span id="rating-stat-<?= $i ?>">0</span>)</p>
<?php endif; ?>
<? endforeach; ?>
<?php if(!$isRating): ?>
<p><strong><?= $i ?></strong> (<span id="rating-stat-<?= $i ?>">0</span>)</p>
<?php endif; ?>
<?php endfor; ?>
<?php endfor; ?>
</div>