From b7cd406ab15a2be72ba2013fbcbcdc3b02b9fc1f Mon Sep 17 00:00:00 2001 From: DariusIII Date: Fri, 3 Jan 2020 03:18:00 +0100 Subject: [PATCH] Use \Elasticsearch --- Blacklight/NameFixer.php | 4 ++-- Blacklight/processing/post/ProcessAdditional.php | 4 ++-- app/Console/Commands/NntmuxResetDb.php | 12 ++++++------ app/Models/Release.php | 4 ++-- app/Models/ReleaseFile.php | 2 +- misc/elasticsearch/create_es_indexes.php | 12 ++++++------ misc/elasticsearch/populate_es_indexes.php | 4 ++-- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Blacklight/NameFixer.php b/Blacklight/NameFixer.php index 8105aca78..cf29196ad 100755 --- a/Blacklight/NameFixer.php +++ b/Blacklight/NameFixer.php @@ -1045,7 +1045,7 @@ class NameFixer 'id' => $release->releases_id, ]; - Elasticsearch::update($data); + \Elasticsearch::update($data); } else { $this->sphinx->updateRelease($release->releases_id); } @@ -1089,7 +1089,7 @@ class NameFixer 'id' => $release->releases_id, ]; - Elasticsearch::update($data); + \Elasticsearch::update($data); } } else { $this->sphinx->updateRelease($release->releases_id); diff --git a/Blacklight/processing/post/ProcessAdditional.php b/Blacklight/processing/post/ProcessAdditional.php index 6f2690cd1..0c2966711 100755 --- a/Blacklight/processing/post/ProcessAdditional.php +++ b/Blacklight/processing/post/ProcessAdditional.php @@ -1198,7 +1198,7 @@ class ProcessAdditional 'id' => $this->_release->id, ]; - Elasticsearch::update($data); + \Elasticsearch::update($data); } } else { $this->sphinx->updateRelease($this->_release->id); @@ -1775,7 +1775,7 @@ class ProcessAdditional 'id' => $this->_release->id, ]; - Elasticsearch::update($data); + \Elasticsearch::update($data); } else { $this->sphinx->updateRelease($this->_release->id); } diff --git a/app/Console/Commands/NntmuxResetDb.php b/app/Console/Commands/NntmuxResetDb.php index 25264d270..68e204bde 100644 --- a/app/Console/Commands/NntmuxResetDb.php +++ b/app/Console/Commands/NntmuxResetDb.php @@ -88,8 +88,8 @@ class NntmuxResetDb extends Command $this->info('Truncating completed.'); if (config('nntmux.elasticsearch_enabled') === true) { - if (Elasticsearch::indices()->exists(['index' => 'releases'])) { - Elasticsearch::indices()->delete(['index' => 'releases']); + if (\Elasticsearch::indices()->exists(['index' => 'releases'])) { + \Elasticsearch::indices()->delete(['index' => 'releases']); } $releases_index = [ 'index' => 'releases', @@ -102,10 +102,10 @@ class NntmuxResetDb extends Command ], ]; - Elasticsearch::indices()->create($releases_index); + \Elasticsearch::indices()->create($releases_index); - if (Elasticsearch::indices()->exists(['index' => 'predb'])) { - Elasticsearch::indices()->delete(['index' => 'predb']); + if (\Elasticsearch::indices()->exists(['index' => 'predb'])) { + \Elasticsearch::indices()->delete(['index' => 'predb']); } $predb_index = [ 'index' => 'predb', @@ -118,7 +118,7 @@ class NntmuxResetDb extends Command ], ]; - Elasticsearch::indices()->create($predb_index); + \Elasticsearch::indices()->create($predb_index); $this->info('All done! ElasticSearch indexes are deleted and recreated.'); } else { diff --git a/app/Models/Release.php b/app/Models/Release.php index 96c45b1fa..8f2a50ceb 100644 --- a/app/Models/Release.php +++ b/app/Models/Release.php @@ -309,7 +309,7 @@ class Release extends Model 'id' => $parameters['id'], ]; - Elasticsearch::index($data); + \Elasticsearch::index($data); } else { (new SphinxSearch())->insertRelease($parameters); } @@ -378,7 +378,7 @@ class Release extends Model 'id' => $ID, ]; - Elasticsearch::update($data); + \Elasticsearch::update($data); } else { (new SphinxSearch())->updateRelease($ID); } diff --git a/app/Models/ReleaseFile.php b/app/Models/ReleaseFile.php index 570ad54f2..9206dfca4 100644 --- a/app/Models/ReleaseFile.php +++ b/app/Models/ReleaseFile.php @@ -152,7 +152,7 @@ class ReleaseFile extends Model 'id' => $id, ]; - Elasticsearch::update($data); + \Elasticsearch::update($data); } } else { (new SphinxSearch())->updateRelease($id); diff --git a/misc/elasticsearch/create_es_indexes.php b/misc/elasticsearch/create_es_indexes.php index 1b59f22ec..61d83e6fc 100644 --- a/misc/elasticsearch/create_es_indexes.php +++ b/misc/elasticsearch/create_es_indexes.php @@ -2,8 +2,8 @@ require_once dirname(__DIR__, 2).DIRECTORY_SEPARATOR.'bootstrap/autoload.php'; -if (Elasticsearch::indices()->exists(['index' => 'releases'])) { - Elasticsearch::indices()->delete(['index' => 'releases']); +if (\Elasticsearch::indices()->exists(['index' => 'releases'])) { + \Elasticsearch::indices()->delete(['index' => 'releases']); } $releases_index = [ 'index' => 'releases', @@ -15,11 +15,11 @@ $releases_index = [ ], ]; -$response = Elasticsearch::indices()->create($releases_index); +$response = \Elasticsearch::indices()->create($releases_index); print_r($response); -if (Elasticsearch::indices()->exists(['index' => 'predb'])) { - Elasticsearch::indices()->delete(['index' => 'predb']); +if (\Elasticsearch::indices()->exists(['index' => 'predb'])) { + \Elasticsearch::indices()->delete(['index' => 'predb']); } $predb_index = [ 'index' => 'predb', @@ -31,7 +31,7 @@ $predb_index = [ ], ]; -$response = Elasticsearch::indices()->create($predb_index); +$response = \Elasticsearch::indices()->create($predb_index); print_r($response); diff --git a/misc/elasticsearch/populate_es_indexes.php b/misc/elasticsearch/populate_es_indexes.php index 7c8eb4284..3a5f8ba47 100644 --- a/misc/elasticsearch/populate_es_indexes.php +++ b/misc/elasticsearch/populate_es_indexes.php @@ -105,7 +105,7 @@ function populate_indexes($table, $max) } } // Stop and send the bulk request - $responses = Elasticsearch::bulk($data); + $responses = \Elasticsearch::bulk($data); // erase the old bulk request $data = ['body' => []]; @@ -118,7 +118,7 @@ function populate_indexes($table, $max) // Send the last batch if it exists if (! empty($data['body'])) { - $responses = Elasticsearch::bulk($data); + $responses = \Elasticsearch::bulk($data); } echo "\n[Done]\n"; } else {