mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 03:57:22 +08:00
elastic basically finish
This commit is contained in:
@@ -243,6 +243,7 @@ else
|
||||
{
|
||||
write_log("Torrent $id ($name) was edited by {$CURUSER['username']}, Mod Edit" . $pick_info . $place_info);
|
||||
}
|
||||
\App\Events\TorrentUpdated::dispatch($id);
|
||||
$returl = "details.php?id=$id&edited=1";
|
||||
if (isset($_POST["returnto"]))
|
||||
$returl = $_POST["returnto"];
|
||||
|
||||
@@ -372,6 +372,8 @@ KPS("+",$uploadtorrent_bonus,$CURUSER["id"]);
|
||||
|
||||
write_log("Torrent $id ($torrent) was uploaded by $anon");
|
||||
|
||||
\App\Events\TorrentUpdated::dispatch($id);
|
||||
|
||||
//===notify people who voted on offer thanks CoLdFuSiOn :)
|
||||
if ($is_offer)
|
||||
{
|
||||
|
||||
+29
-15
@@ -12,6 +12,7 @@ parked();
|
||||
$tagRep = new \App\Repositories\TagRepository();
|
||||
$tagKeyById = $tagRep->createBasicQuery()->get()->keyBy('id');
|
||||
$renderKeyArr = $tagKeyById->keys()->toArray();
|
||||
$elasticsearchEnabled = nexus_env('ELASTICSEARCH_ENABLED');
|
||||
|
||||
//check searchbox
|
||||
switch (nexus()->getScript()) {
|
||||
@@ -847,10 +848,17 @@ else
|
||||
$sql = "SELECT COUNT(*), categories.mode FROM torrents LEFT JOIN categories ON category = categories.id " . ($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "") . $tagFilter . $where . " GROUP BY categories.mode";
|
||||
}
|
||||
|
||||
$res = sql_query($sql);
|
||||
$count = 0;
|
||||
while($row = mysql_fetch_array($res))
|
||||
$count += $row[0];
|
||||
if ($elasticsearchEnabled) {
|
||||
$searchRep = new \App\Repositories\SearchRepository();
|
||||
$resultFromElastic = $searchRep->listTorrentFromEs($_GET, $CURUSER['id'], $_SERVER['QUERY_STRING']);
|
||||
$count = $resultFromElastic['total'];
|
||||
} else {
|
||||
$res = sql_query($sql);
|
||||
$count = 0;
|
||||
while($row = mysql_fetch_array($res)) {
|
||||
$count += $row[0];
|
||||
}
|
||||
}
|
||||
|
||||
if ($CURUSER["torrentsperpage"])
|
||||
$torrentsperpage = (int)$CURUSER["torrentsperpage"];
|
||||
@@ -883,17 +891,19 @@ if ($count)
|
||||
//echo $addparam;
|
||||
|
||||
list($pagertop, $pagerbottom, $limit) = pager($torrentsperpage, $count, "?" . $addparam);
|
||||
if ($allsec == 1 || $enablespecial != 'yes'){
|
||||
$query = "SELECT torrents.id, torrents.sp_state, torrents.promotion_time_type, torrents.promotion_until, torrents.banned, torrents.picktype, torrents.pos_state, torrents.category, torrents.source, torrents.medium, torrents.codec, torrents.standard, torrents.processing, torrents.team, torrents.audiocodec, torrents.leechers, torrents.seeders, torrents.name, torrents.small_descr, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.anonymous,torrents.owner,torrents.url,torrents.cache_stamp,torrents.pt_gen,torrents.hr FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." $tagFilter $where $orderby $limit";
|
||||
}
|
||||
else{
|
||||
$query = "SELECT torrents.id, torrents.sp_state, torrents.promotion_time_type, torrents.promotion_until, torrents.banned, torrents.picktype, torrents.pos_state, torrents.category, torrents.source, torrents.medium, torrents.codec, torrents.standard, torrents.processing, torrents.team, torrents.audiocodec, torrents.leechers, torrents.seeders, torrents.name, torrents.small_descr, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.anonymous,torrents.owner,torrents.url,torrents.cache_stamp,torrents.pt_gen,torrents.hr FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." LEFT JOIN categories ON torrents.category=categories.id $tagFilter $where $orderby $limit";
|
||||
if ($allsec == 1 || $enablespecial != 'yes'){
|
||||
$query = "SELECT torrents.id, torrents.sp_state, torrents.promotion_time_type, torrents.promotion_until, torrents.banned, torrents.picktype, torrents.pos_state, torrents.category, torrents.source, torrents.medium, torrents.codec, torrents.standard, torrents.processing, torrents.team, torrents.audiocodec, torrents.leechers, torrents.seeders, torrents.name, torrents.small_descr, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.anonymous,torrents.owner,torrents.url,torrents.cache_stamp,torrents.pt_gen,torrents.hr FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." $tagFilter $where $orderby $limit";
|
||||
}
|
||||
else{
|
||||
$query = "SELECT torrents.id, torrents.sp_state, torrents.promotion_time_type, torrents.promotion_until, torrents.banned, torrents.picktype, torrents.pos_state, torrents.category, torrents.source, torrents.medium, torrents.codec, torrents.standard, torrents.processing, torrents.team, torrents.audiocodec, torrents.leechers, torrents.seeders, torrents.name, torrents.small_descr, torrents.times_completed, torrents.size, torrents.added, torrents.comments,torrents.anonymous,torrents.owner,torrents.url,torrents.cache_stamp,torrents.pt_gen,torrents.hr FROM torrents ".($search_area == 3 || $column == "owner" ? "LEFT JOIN users ON torrents.owner = users.id " : "")." LEFT JOIN categories ON torrents.category=categories.id $tagFilter $where $orderby $limit";
|
||||
}
|
||||
if (!$elasticsearchEnabled) {
|
||||
$res = sql_query($query);
|
||||
}
|
||||
} else {
|
||||
unset($res);
|
||||
}
|
||||
|
||||
$res = sql_query($query);
|
||||
}
|
||||
else
|
||||
unset($res);
|
||||
if (isset($searchstr))
|
||||
stdhead($lang_torrents['head_search_results_for'].$searchstr_ori);
|
||||
elseif ($sectiontype == $browsecatmode)
|
||||
@@ -1120,8 +1130,12 @@ elseif($inclbookmarked == 2)
|
||||
|
||||
if ($count) {
|
||||
$rows = [];
|
||||
while ($row = mysql_fetch_assoc($res)) {
|
||||
$rows[] = $row;
|
||||
if ($elasticsearchEnabled) {
|
||||
$rows = $resultFromElastic['data'];
|
||||
} else {
|
||||
while ($row = mysql_fetch_assoc($res)) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
}
|
||||
print($pagertop);
|
||||
if ($sectiontype == $browsecatmode)
|
||||
|
||||
Reference in New Issue
Block a user