diff --git a/install/core/Installer.php b/install/core/Installer.php
index d764e15e2a..b4987cf54e 100644
--- a/install/core/Installer.php
+++ b/install/core/Installer.php
@@ -148,7 +148,7 @@ class Installer
*/
public function saveData($database, $language)
{
- $initData = include('install/core/afterInstall/config.php');
+ $initData = include('install/core/init/config.php');
$siteUrl = $this->getSystemHelper()->getBaseUrl();
@@ -194,7 +194,9 @@ class Installer
if (isset($preferences['defaultCurrency']) && !in_array($preferences['defaultCurrency'], $currencyList)) {
$preferences['currencyList'] = array($preferences['defaultCurrency']);
- $preferences['baseCurrency'] = $preferences['defaultCurrency'];
+
+ $preferences['currency'] = $this->getConfig()->get('currency');
+ $preferences['currency']['base'] = $preferences['defaultCurrency'];
}
$res = $this->saveConfig($preferences);
@@ -208,7 +210,7 @@ class Installer
protected function createRecords()
{
- $records = include('install/core/afterInstall/records.php');
+ $records = include('install/core/init/records.php');
$result = true;
foreach ($records as $entityName => $recordList) {
@@ -269,6 +271,8 @@ class Installer
$result = $this->createRecord('User', $user);
+ $result &= $this->createRecords();
+
return $result;
}
@@ -311,16 +315,9 @@ class Installer
public function setSuccess()
{
- $this->auth();
-
- /** afterInstall scripts */
- $result = $this->createRecords();
- $result &= $this->executeQueries();
- /** END: afterInstall scripts */
-
$config = $this->app->getContainer()->get('config');
$config->set('isInstalled', true);
- $result &= $config->save();
+ $result = $config->save();
return $result;
}
@@ -382,21 +379,5 @@ class Installer
return $this->getContainer()->get('scheduledJob')->getSetupMessage();
}
- protected function executeQueries()
- {
- $queries = include('install/core/afterInstall/queries.php');
-
- $pdo = $this->getEntityManager()->getPDO();
-
- $result = true;
-
- foreach ($queries as $query) {
- $sth = $pdo->prepare($query);
- $result =& $sth->execute();
- }
-
- return $result;
- }
-
}
diff --git a/install/core/Language.php b/install/core/Language.php
new file mode 100644
index 0000000000..8db1655272
--- /dev/null
+++ b/install/core/Language.php
@@ -0,0 +1,55 @@
+systemHelper = new SystemHelper();
+ }
+
+ protected function getSystemHelper()
+ {
+ return $this->systemHelper;
+ }
+
+ public function get($language)
+ {
+ if (empty($language)) {
+ $language = $this->defaultLanguage;
+ }
+
+ $langFileName = 'install/core/i18n/'.$language.'/install.json';
+ if (!file_exists($langFileName)) {
+ $langFileName = 'install/core/i18n/'.$this->defaultLanguage.'/install.json';
+ }
+
+ $i18n = file_get_contents($langFileName);
+ $i18n = json_decode($i18n, true);
+
+ $this->afterRetrieve($i18n);
+
+ return $i18n;
+ }
+
+ /**
+ * After retrieve actions
+ *
+ * @param array $i18n
+ * @return array $i18n
+ */
+ protected function afterRetrieve(array &$i18n)
+ {
+ /** Get rewrite rules */
+ $serverType = $this->getSystemHelper()->getServerType();
+ $rewriteRules = $this->getSystemHelper()->getRewriteRules();
+ $i18n['options']['modRewriteHelp'][$serverType] = str_replace('{0}', $rewriteRules, $i18n['options']['modRewriteHelp'][$serverType]);
+ }
+
+
+}
diff --git a/install/core/SystemHelper.php b/install/core/SystemHelper.php
index 92f0587e49..391a34b2e5 100644
--- a/install/core/SystemHelper.php
+++ b/install/core/SystemHelper.php
@@ -76,7 +76,7 @@ class SystemHelper extends \Espo\Core\Utils\System
return $result;
}
- public function checkDbConnection($hostName, $port, $dbUserName, $dbUserPass, $dbName, $dbDriver = 'pdo_mysql', $isCreateDatabase = true)
+ public function checkDbConnection($hostName, $port ,$dbUserName, $dbUserPass, $dbName, $dbDriver = 'pdo_mysql')
{
$result['success'] = true;
@@ -104,28 +104,6 @@ class SystemHelper extends \Espo\Core\Utils\System
$result['errors']['dbConnect']['errorMsg'] = $e->getMessage();
$result['success'] = false;
}
-
- /** try to create a database */
- if ($isCreateDatabase && !$result['success'] && $result['errors']['dbConnect']['errorCode'] == '1049') {
-
- $dsn = "mysql:host={$hostName};" . ((!empty($port)) ? "port={$port}" : '');
- $pdo = new PDO($dsn, $dbUserName, $dbUserPass);
-
- $isCreated = true;
- try {
- $pdo->query("CREATE DATABASE IF NOT EXISTS `$dbName`");
- } catch (PDOException $e) {
- $isCreated = false;
- }
-
- if ($isCreated) {
- return $this->checkDbConnection($hostName, $port, $dbUserName, $dbUserPass, $dbName, $dbDriver, false);
- }
- }
- /** END: try to create a database */
-
-
-
break;
}
@@ -207,8 +185,8 @@ class SystemHelper extends \Espo\Core\Utils\System
$commands[] = $this->getCd();
}
- $commands[] = 'find '.$path.' -type f -exec ' .$sudoStr.'chmod '.$bufPerm[0].' {} +';//.'chmod '.$bufPerm[0].' $(find '.$path.' -type f)';
- $commands[] = 'find '.$path.' -type d -exec ' .$sudoStr. 'chmod '.$bufPerm[1].' {} +';//.'chmod '.$bufPerm[1].' $(find '.$path.' -type d)';
+ $commands[] = 'find '.$path.' -type f -exec ' .$sudoStr.'chmod '.$bufPerm[0].' {} +';
+ $commands[] = 'find '.$path.' -type d -exec ' .$sudoStr. 'chmod '.$bufPerm[1].' {} +';
if (count($permissions) >= 2) {
return implode(' ' . $this->combineOperator . ' ', $commands);
@@ -273,4 +251,19 @@ class SystemHelper extends \Espo\Core\Utils\System
return $cd;
}
+ public function getRewriteRules()
+ {
+ $serverType = $this->getServerType();
+
+ $rules = array(
+ 'nginx' => "location /api/v1/ {\n if (!-e " . '$request_filename' . "){\n rewrite ^/api/v1/(.*)$ /api/v1/index.php last; break;\n }\n}\n\nlocation / {\n rewrite reset/?$ reset.html break;\n}\n\nlocation /(data|api) {\n if (-e " . '$request_filename' . "){\n return 403;\n }\n}\n\nlocation /data/logs {\n return 403;\n}\nlocation /data/config.php$ {\n return 403;\n}\nlocation /data/cache {\n return 403;\n}\nlocation /data/upload {\n return 403;\n}\nlocation /application {\n return 403;\n}\nlocation /custom {\n return 403;\n}\nlocation /vendor {\n return 403;\n}",
+ );
+
+ if (isset($rules[$serverType])) {
+ return $rules[$serverType];
+ }
+
+ return '';
+ }
+
}
diff --git a/install/core/i18n/de_DE/install.json b/install/core/i18n/de_DE/install.json
index 2084e646c8..08ae567549 100644
--- a/install/core/i18n/de_DE/install.json
+++ b/install/core/i18n/de_DE/install.json
@@ -104,7 +104,7 @@
},
"modRewriteHelp": {
"apache": "API Fehler: EspoCRM API nicht verfügbar
Mögliches Problem: deaktiviertes \"mod_rewrite\" des Apache Servers oder des .htaccess Supports.",
- "nginx": "API Error: EspoCRM API unavailable.
Add this code to Nginx Host Config (inside \"server\" block):
\n
\nlocation /api/v1/ {\n if (!-e $request_filename){\n rewrite ^/api/v1/(.*)$ /api/v1/index.php last; break;\n }\n}\n\nlocation / {\n rewrite reset/?$ reset.html break;\n}",
+ "nginx": "API Error: EspoCRM API unavailable.\n{0}\n",
"microsoft-iis": "API Fehler: EspoCRM API nicht verfügbar\nlocation /api/v1/ {\n if (!-e $request_filename){\n rewrite ^/api/v1/(.*)$ /api/v1/index.php last; break;\n }\n}\n\nlocation / {\n rewrite reset/?$ reset.html break;\n}",
+ "nginx": "API Error: EspoCRM API unavailable.\n{0}\n",
"microsoft-iis": "API Error: EspoCRM API unavailable.\nlocation /api/v1/ {\n if (!-e $request_filename){\n rewrite ^/api/v1/(.*)$ /api/v1/index.php last; break;\n }\n}\n\nlocation / {\n rewrite reset/?$ reset.html break;\n}",
+ "nginx": "API Error: EspoCRM API unavailable.\n{0}\n",
"microsoft-iis": "API Error: EspoCRM API unavailable.\nlocation /api/v1/ {\n if (!-e $request_filename){\n rewrite ^/api/v1/(.*)$ /api/v1/index.php last; break;\n }\n}\n\nlocation / {\n rewrite reset/?$ reset.html break;\n}",
+ "nginx": "API Error: EspoCRM API unavailable.\n{0}\n",
"microsoft-iis": "API Error: EspoCRM API unavailable.\nlocation /api/v1/ {\n if (!-e $request_filename){\n rewrite ^/api/v1/(.*)$ /api/v1/index.php last; break;\n }\n}\n\nlocation / {\n rewrite reset/?$ reset.html break;\n}",
+ "nginx": "API Error: EspoCRM API unavailable.\n{0}\n",
"microsoft-iis": "API Error: EspoCRM API niet beschikbaar.\nlocation /api/v1/ {\n if (!-e $request_filename){\n rewrite ^/api/v1/(.*)$ /api/v1/index.php last; break;\n }\n}\n\nlocation / {\n rewrite reset/?$ reset.html break;\n}",
+ "nginx": "API Error: EspoCRM API unavailable.\n{0}\n",
"microsoft-iis": "Eroare API: API-ul EspoCRM nu este valabil.\nlocation \/api\/v1\/ {\n if (!-e $request_filename){\n rewrite ^\/api\/v1\/(.*)$ \/api\/v1\/index.php last; break;\n }\n}\n\nlocation \/ {\n rewrite reset\/?$ reset.html break;\n}<\/pre>",
+ "nginx": "API Error: EspoCRM API unavailable.
Add this code to your Nginx Host Config (inside \"server\" block):
\n\n{0}\n",
"microsoft-iis": "API Error: EspoCRM API unavailable.
Possible problem: disabled \"URL Rewrite\". Please check and enable \"URL Rewrite\" Module in IIS server",
"default": "API Error: EspoCRM API unavailable.
Possible problem: disabled Rewrite Module. Please check and enable Rewrite Module in your server (e.g. mod_rewrite in Apache) and .htaccess support."
}
diff --git a/install/core/i18n/vi_VN/install.json b/install/core/i18n/vi_VN/install.json
index bcffaaedf5..4c6eebbc3b 100644
--- a/install/core/i18n/vi_VN/install.json
+++ b/install/core/i18n/vi_VN/install.json
@@ -104,7 +104,7 @@
},
"modRewriteHelp": {
"apache": "API Error: EspoCRM API unavailable.
Possible problems: disabled \"mod_rewrite\" in Apache server or .htaccess support.",
- "nginx": "API Error: EspoCRM API unavailable.
Add this code to Nginx Host Config (inside \"server\" block):
\n\nlocation /api/v1/ {\n if (!-e $request_filename){\n rewrite ^/api/v1/(.*)$ /api/v1/index.php last; break;\n }\n}\n\nlocation / {\n rewrite reset/?$ reset.html break;\n}",
+ "nginx": "API Error: EspoCRM API unavailable.
Add this code to your Nginx Host Config (inside \"server\" block):
\n\n{0}\n",
"microsoft-iis": "API Error: EspoCRM API unavailable.
Possible problem: disabled \"URL Rewrite\". Please check and enable \"URL Rewrite\" Module in IIS server",
"default": "API Error: EspoCRM API unavailable.
Possible problem: disabled Rewrite Module. Please check and enable Rewrite Module in your server (e.g. mod_rewrite in Apache) and .htaccess support."
}
diff --git a/install/core/tpl/step2.tpl b/install/core/tpl/step2.tpl
index ff0dab0b9a..3139e959f4 100644
--- a/install/core/tpl/step2.tpl
+++ b/install/core/tpl/step2.tpl
@@ -2,9 +2,9 @@
{$langs['labels']['Step2 page title']}
-
+
-
+
-
-
-
+
+
+
+
-
+
@@ -60,8 +61,8 @@
-
-
+
+