mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-09-02 19:28:55 +00:00
Fix insertion of data into predb_rt index from IRCScraper
This commit is contained in:
@@ -323,6 +323,7 @@ class IRCScraper extends IRCClient
|
||||
'id' => DB::connection()->getPdo()->lastInsertId(),
|
||||
'title' => $this->_curPre['title'],
|
||||
'filename' => $this->_curPre['filename'],
|
||||
'source' => $this->_curPre['source'],
|
||||
];
|
||||
|
||||
(new SphinxSearch())->insertPredb($parameters);
|
||||
@@ -333,7 +334,8 @@ class IRCScraper extends IRCClient
|
||||
/**
|
||||
* Updates PRE data in the DB.
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function _updatePre()
|
||||
{
|
||||
@@ -371,6 +373,7 @@ class IRCScraper extends IRCClient
|
||||
'id' => DB::connection()->getPdo()->lastInsertId(),
|
||||
'title' => $this->_curPre['title'],
|
||||
'filename' => $this->_curPre['filename'],
|
||||
'source' => $this->_curPre['source'],
|
||||
];
|
||||
|
||||
(new SphinxSearch())->updatePreDb($parameters);
|
||||
|
||||
@@ -139,19 +139,13 @@ class SphinxSearch
|
||||
/**
|
||||
* Update Sphinx Predb index for given predb_id.
|
||||
*
|
||||
* @param int $title
|
||||
* @param array $parameters
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function updatePreDb($title): void
|
||||
public function updatePreDb($parameters): void
|
||||
{
|
||||
$new = Predb::query()
|
||||
->where('title', $title)
|
||||
->select(['id', 'title', 'filename', 'source'])
|
||||
->groupBy('id')
|
||||
->first();
|
||||
|
||||
if ($new !== null) {
|
||||
$this->insertPredb($new);
|
||||
if (! empty($parameters)) {
|
||||
$this->insertPredb($parameters);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user