-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Jeli 93][SITE-2457] Reload core during post schema (#195)
--------- Co-authored-by: Kevin Porras <[email protected]> Co-authored-by: Tom Stovall <[email protected]> Co-authored-by: Phil Tyler <[email protected]> Co-authored-by: lcatlett <[email protected]>
- Loading branch information
1 parent
a14dfad
commit 0e35b4a
Showing
17 changed files
with
521 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,5 @@ | |
.idea | ||
.DS_Store | ||
docs/Badge.confluence | ||
|
||
.envrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
namespace Drupal\search_api_pantheon\Commands; | ||
|
||
use Drupal\Core\Logger\LoggerChannelFactoryInterface; | ||
use Drupal\Core\Logger\LoggerChannelTrait; | ||
use Drupal\search_api_pantheon\Services\PantheonGuzzle; | ||
use Drupal\search_api_pantheon\Services\SchemaPoster; | ||
use Drush\Commands\DrushCommands; | ||
|
||
/** | ||
* Drush Search Api Pantheon Schema Commands. | ||
*/ | ||
class Reload extends DrushCommands { | ||
use LoggerChannelTrait; | ||
|
||
/** | ||
* Configured pantheon-solr-specific guzzle client. | ||
* | ||
* @var \Drupal\search_api_pantheon\Services\PantheonGuzzle | ||
*/ | ||
private PantheonGuzzle $pantheonGuzzle; | ||
|
||
/** | ||
* Configured pantheon-solr-specific schema poster class. | ||
* | ||
* @var \Drupal\search_api_pantheon\Services\SchemaPoster | ||
*/ | ||
private SchemaPoster $schemaPoster; | ||
|
||
/** | ||
* Class constructor. | ||
* | ||
* @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $loggerChannelFactory | ||
* Injected by container. | ||
* @param \Drupal\search_api_pantheon\Services\PantheonGuzzle $pantheonGuzzle | ||
* Injected by container. | ||
* @param \Drupal\search_api_pantheon\Services\SchemaPoster $schemaPoster | ||
* Injected by Container. | ||
*/ | ||
public function __construct( | ||
LoggerChannelFactoryInterface $loggerChannelFactory, | ||
PantheonGuzzle $pantheonGuzzle, | ||
SchemaPoster $schemaPoster | ||
) { | ||
$this->logger = $loggerChannelFactory->get('SearchAPIPantheon Drush'); | ||
$this->pantheonGuzzle = $pantheonGuzzle; | ||
$this->schemaPoster = $schemaPoster; | ||
} | ||
|
||
/** | ||
* Search_api_pantheon:reloadSchema. | ||
* | ||
* @usage search-api-pantheon:reloadSchema | ||
* Reload the latest schema | ||
* | ||
* @command search-api-pantheon:reloadSchema | ||
*/ | ||
public function reloadSchema() { | ||
try { | ||
$this->schemaPoster->reloadServer(); | ||
} | ||
catch (\Exception $e) { | ||
$this->logger->error((string) $e); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.