mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-07 05:31:24 +00:00
Pint
This commit is contained in:
@@ -46,7 +46,7 @@ class EnvironmentManager
|
||||
*/
|
||||
public function updateEnv(array $data)
|
||||
{
|
||||
if (empty($data) || !is_array($data) || !is_file($this->envPath)) {
|
||||
if (empty($data) || ! is_array($data) || ! is_file($this->envPath)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -62,14 +62,14 @@ class EnvironmentManager
|
||||
|
||||
// Check if new or old key
|
||||
if ($entry[0] == $data_key) {
|
||||
$env[$env_key] = $data_key . '=' . $this->encode($data_value);
|
||||
$env[$env_key] = $data_key.'='.$this->encode($data_value);
|
||||
$updated = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Lets create if not available
|
||||
if (!$updated) {
|
||||
$env[] = $data_key . '=' . $this->encode($data_value);
|
||||
if (! $updated) {
|
||||
$env[] = $data_key.'='.$this->encode($data_value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,8 +88,8 @@ class EnvironmentManager
|
||||
private function encode($str)
|
||||
{
|
||||
|
||||
if ((strpos($str, ' ') !== false || preg_match('/' . preg_quote('^\'£$%^&*()}{@#~?><,@|-=-_+-¬', '/') . '/', $str)) && ($str[0] != '"' || $str[strlen($str) - 1] != '"')) {
|
||||
$str = '"' . $str . '"';
|
||||
if ((strpos($str, ' ') !== false || preg_match('/'.preg_quote('^\'£$%^&*()}{@#~?><,@|-=-_+-¬', '/').'/', $str)) && ($str[0] != '"' || $str[strlen($str) - 1] != '"')) {
|
||||
$str = '"'.$str.'"';
|
||||
}
|
||||
|
||||
return $str;
|
||||
@@ -124,7 +124,7 @@ class EnvironmentManager
|
||||
// https://laravel.com/docs/11.x/database#introduction
|
||||
if (extension_loaded('sqlite3') && class_exists('\SQLite3') && method_exists('\SQLite3', 'version')) {
|
||||
$version = \SQLite3::version();
|
||||
if (!empty($version['versionString']) && version_compare($version['versionString'], '3.35.0', '<')) {
|
||||
if (! empty($version['versionString']) && version_compare($version['versionString'], '3.35.0', '<')) {
|
||||
return [
|
||||
'error_message' => sprintf('The minimum SQLite version is %s. Your current SQLite version is %s which is not supported. Please upgrade SQLite and retry.', '3.35.0', $version['versionString']),
|
||||
];
|
||||
@@ -135,13 +135,13 @@ class EnvironmentManager
|
||||
];
|
||||
}
|
||||
$dbEnv['DB_DATABASE'] = $request->get('database_name');
|
||||
if (!empty($dbEnv['DB_DATABASE'])) {
|
||||
if (! empty($dbEnv['DB_DATABASE'])) {
|
||||
$sqlite_path = $dbEnv['DB_DATABASE'];
|
||||
} else {
|
||||
$sqlite_path = database_path('database.sqlite');
|
||||
}
|
||||
// Create empty SQLite database if it doesn't exist.
|
||||
if (!file_exists($sqlite_path)) {
|
||||
if (! file_exists($sqlite_path)) {
|
||||
copy(database_path('stubs/sqlite.empty.db'), $sqlite_path);
|
||||
$dbEnv['DB_DATABASE'] = $sqlite_path;
|
||||
}
|
||||
@@ -237,7 +237,7 @@ class EnvironmentManager
|
||||
/**
|
||||
* Returns the mail configuration
|
||||
*
|
||||
* @param MailEnvironmentRequest $request
|
||||
* @param MailEnvironmentRequest $request
|
||||
* @return array
|
||||
*/
|
||||
private function getMailConfiguration($request)
|
||||
@@ -444,7 +444,7 @@ class EnvironmentManager
|
||||
if ($parts_line[0] != $parts_last[0]) {
|
||||
$formatted .= $this->delimiter;
|
||||
}
|
||||
$formatted .= $current . $this->delimiter;
|
||||
$formatted .= $current.$this->delimiter;
|
||||
$previous = $current;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user