Merge pull request #297 from chrometoasters/pulls/fix-260-optional-paths

FIX Only use values that are not empty
This commit is contained in:
Steve Boyd 2021-09-14 09:59:29 +12:00 committed by GitHub
commit a6153cecc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 6 deletions

View File

@ -13,7 +13,7 @@ class SolrConfigStore_File implements SolrConfigStore
public function __construct($config) public function __construct($config)
{ {
$this->local = $config['path']; $this->local = $config['path'];
$this->remote = isset($config['remotepath']) ? $config['remotepath'] : $config['path']; $this->remote = !empty($config['remotepath']) ? $config['remotepath'] : $config['path'];
} }
public function getTargetDir($index) public function getTargetDir($index)

View File

@ -26,12 +26,12 @@ class SolrConfigStore_Post implements SolrConfigStore
$this->url = implode('', [ $this->url = implode('', [
'http://', 'http://',
isset($config['auth']) ? $config['auth'] . '@' : '', !empty($config['auth']) ? $config['auth'] . '@' : '',
$options['host'] . ':' . $options['port'], $options['host'] . ':' . $options['port'],
$config['path'] $config['path']
]); ]);
if (isset($config['remotepath'])) { if (!empty($config['remotepath'])) {
$this->remote = $config['remotepath']; $this->remote = $config['remotepath'];
} }
} }

View File

@ -18,11 +18,14 @@ class SolrConfigStore_WebDAV implements SolrConfigStore
$this->url = implode('', array( $this->url = implode('', array(
'http://', 'http://',
isset($config['auth']) ? $config['auth'] . '@' : '', !empty($config['auth']) ? $config['auth'] . '@' : '',
$options['host'] . ':' . (isset($config['port']) ? $config['port'] : $options['port']), $options['host'] . ':' . (!empty($config['port']) ? $config['port'] : $options['port']),
$config['path'] $config['path']
)); ));
$this->remote = $config['remotepath'];
if (!empty($config['remotepath'])) {
$this->remote = $config['remotepath'];
}
} }
public function getTargetDir($index) public function getTargetDir($index)