Skip to content

Commit

Permalink
Merge pull request #23 from kkarkus/bugfix/install-problem
Browse files Browse the repository at this point in the history
Fixes problem with installation
  • Loading branch information
asim-inviqa authored Aug 11, 2016
2 parents bc8a0ec + 8fa98b2 commit 6bc2c5c
Showing 1 changed file with 23 additions and 24 deletions.
47 changes: 23 additions & 24 deletions lib/Byng/Pimcore/Elasticsearch/ElasticsearchPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@ public static function install()
if (self::isInstalled()) {
return true;
}
$configPath = new ConfigFilePath();

if (!is_writable($configPath->getDirectory())) {
throw new \RuntimeException(sprintf(
"Unable to write to config directory: '%s'",
$configPath->getDirectory()
));
}

if (!copy(new ConfigDistFilePath(), $configPath)) {
throw new \RuntimeException("Unable to create a config file: " . $configPath);
}

$config = self::loadConfig();

Expand All @@ -102,21 +114,21 @@ public static function install()
}

$client->indices()->putMapping($indexParams + [
"type" => $assetConfig->get("typeName"),
"body" => [
"asset" => [
"properties" => [
$assetConfig->get("typeName") => [
"properties" => [
$assetConfig->get("bodyContent")->get("propertyName") => [
"type" => "attachment"
"type" => $assetConfig->get("typeName"),
"body" => [
"asset" => [
"properties" => [
$assetConfig->get("typeName") => [
"properties" => [
$assetConfig->get("bodyContent")->get("propertyName") => [
"type" => "attachment"
]
]
]
]
]
]
]
]);
]);
}

/** @var Zend_Config $pageConfig */
Expand All @@ -131,20 +143,7 @@ public static function install()
}
}

$configPath = new ConfigFilePath();

if (!is_writable($configPath->getDirectory())) {
throw new \RuntimeException(sprintf(
"Unable to write to config directory: '%s'",
$configPath->getDirectory()
));
}

if (copy(new ConfigDistFilePath(), $configPath)) {
return true;
}

throw new \RuntimeException("Unable to create a config file: " . $configPath);
return true;
}

/**
Expand Down

0 comments on commit 6bc2c5c

Please sign in to comment.