aboutsummaryrefslogtreecommitdiff
path: root/src/phorkie/SetupCheck.php
diff options
context:
space:
mode:
authorJustin J. Novack <jnovack@gmail.com>2012-09-25 18:30:27 -0400
committerJustin J. Novack <jnovack@gmail.com>2012-09-25 18:40:23 -0400
commit494f8ffb69ff251b3448a5027a5e6b39f7dfd77b (patch)
tree1e2e2da3c7a43157548e464216b19cb9e15503d3 /src/phorkie/SetupCheck.php
parent776fadd33815e9e1b342b1cb30a6ca5debb760f2 (diff)
downloadphorkie-494f8ffb69ff251b3448a5027a5e6b39f7dfd77b.tar.gz
phorkie-494f8ffb69ff251b3448a5027a5e6b39f7dfd77b.zip
ADD: do a cursory validatation of the elasticsearch url
Diffstat (limited to 'src/phorkie/SetupCheck.php')
-rw-r--r--src/phorkie/SetupCheck.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/phorkie/SetupCheck.php b/src/phorkie/SetupCheck.php
index b1107b5..f1fbc0f 100644
--- a/src/phorkie/SetupCheck.php
+++ b/src/phorkie/SetupCheck.php
@@ -14,7 +14,7 @@ class SetupCheck
);
protected $writableDirs;
-
+ protected $elasticsearch;
public function __construct()
{
@@ -23,6 +23,7 @@ class SetupCheck
'gitdir' => $cfg['gitdir'],
'workdir' => $cfg['workdir'],
);
+ $this->elasticsearch = $cfg['elasticsearch'];
}
public static function run()
@@ -31,7 +32,9 @@ class SetupCheck
$sc->checkDeps();
$sc->checkDirs();
$sc->checkGit();
- $sc->checkDatabase();
+ if ($this->elasticsearch != '') {
+ $sc->checkDatabase();
+ }
}
public function checkDeps()
@@ -73,6 +76,11 @@ class SetupCheck
public function checkDatabase()
{
+ $es = parse_url($this->elasticsearch);
+ if (!preg_match("#/.+/#", $es['path'], $matches)) {
+ $this->fail('Improper elasticsearch url. Elasticsearch requires a'
+ . ' search domain to store your data. (e.g. http://localhost:9200/phorkie/)');
+ }
$dbs = new Database();
$dbs->getSetup()->setup();
}