Skip to content

Commit

Permalink
Remove extra copypasta methods
Browse files Browse the repository at this point in the history
  • Loading branch information
namespacebrian committed Nov 12, 2024
1 parent ada254e commit 12320c0
Showing 1 changed file with 0 additions and 67 deletions.
67 changes: 0 additions & 67 deletions src/Commands/Reload.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,70 +67,3 @@ public function reloadSchema() {
$this->logger->error((string) $e);
}
}

/**
* Search_api_pantheon:postSchema.
*
* @usage search-api-pantheon:postSchema [server_id] [path]
* Post the latest schema to the given Server.
* Default server ID = pantheon_solr8.
* Default path = empty (build files using search_api_solr mechanism).
*
* @command search-api-pantheon:postSchema
*
* @param $server_id
* Server id to post schema for.
* @param $path
* Path to schema files (Leave empty to use default schema).
*
* @aliases sapps
*/
public function postSchema(?string $server_id = NULL, ?string $path = NULL) {
if (!$server_id) {
$server_id = PantheonSolrConnector::getDefaultEndpoint();
}
try {
$files = [];
if ($path) {
if (!is_dir($path)) {
throw new \Exception("Path '$path' is not a directory.");
}
$finder = new Finder();
// Only work with direct children.
$finder->depth('== 0');
$finder->files()->in($path);
if (!$finder->hasResults()) {
throw new \Exception("Path '$path' does not contain any files.");
}
foreach ($finder as $file) {
$files[$file->getfilename()] = $file->getContents();
}
}

$this->schemaPoster->postSchema($server_id, $files);
}
catch (\Exception $e) {
$this->logger->error((string) $e);
}
}

/**
* View a Schema File.
*
* @param string $filename
* Filename to retrieve.
*
* @command search-api-pantheon:view-schema
* @aliases sapvs
* @usage sapvs schema.xml
* @usage search-api-pantheon:view-schema elevate.xml
*
* @throws \Exception
* @throws \Psr\Http\Client\ClientExceptionInterface
*/
public function viewSchema(string $filename = 'schema.xml') {
$currentSchema = $this->schemaPoster->viewSchema($filename);
$this->logger->notice($currentSchema);
}

}

0 comments on commit 12320c0

Please sign in to comment.