Add some Google analytics for the installer and then vaCentral connections

This commit is contained in:
Nabeel Shahzad
2018-01-18 20:24:06 -05:00
parent 3da403671a
commit 467a1a1dc6
8 changed files with 166 additions and 1 deletions

View File

@@ -41,6 +41,33 @@ class EnvironmentService
return true;
}
/**
* Update the environment file and update certain keys/values
* @param array $kvp
* @return void
*/
public function updateKeysInEnv(array $kvp)
{
$app = app();
$env_file = file_get_contents($app->environmentFilePath());
foreach($kvp as $key => $value) {
# cast
if(\is_bool($value)) {
$value = $value === true ? 'true' : 'false';
}
$env_file = preg_replace(
'/^' . $key . '(.*)?/m',
$key . '=' . $value,
$env_file
);
}
file_put_contents($app->environmentFilePath(), $env_file);
}
/**
* Generate a fresh new APP_KEY
* @return string
@@ -51,11 +78,17 @@ class EnvironmentService
}
/**
* Change a few options within the PDO driver, depending on the version
* of mysql/maria, etc used. ATM, only make a change for MariaDB
* @param $opts
* @return mixed
*/
protected function determinePdoOptions($opts)
{
if($opts['DB_CONN'] !== 'mysql') {
return $opts;
}
$dsn = "mysql:host=$opts[DB_HOST];port=$opts[DB_PORT];";
Log::info('Connection string: ' . $dsn);