Fix insertion of data into predb_rt index from IRCScraper

This commit is contained in:
DariusIII
2019-01-15 09:22:04 +01:00
parent 14c2602ae3
commit 21062d878c
3 changed files with 10 additions and 11 deletions
+4 -1
View File
@@ -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);
+4 -10
View File
@@ -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);
}
}
+2
View File
@@ -1,3 +1,5 @@
2019-01-15 DariusIII
* Fix: Fix insertion of data into predb_rt index from IRCScraper
2019-01-14 DariusIII
* Chg: Update opis/closure (3.1.4 => 3.1.5)
* Chg: Update dariusiii/rarinfo to version 2.7.2