mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
Save database type and version while rebuild
This commit is contained in:
@@ -91,8 +91,10 @@ class DataManager
|
||||
*/
|
||||
public function rebuildDatabase($entityList = null)
|
||||
{
|
||||
$schema = $this->getContainer()->get('schema');
|
||||
|
||||
try {
|
||||
$result = $this->getContainer()->get('schema')->rebuild($entityList);
|
||||
$result = $schema->rebuild($entityList);
|
||||
} catch (\Exception $e) {
|
||||
$result = false;
|
||||
$GLOBALS['log']->error('Fault to rebuild database schema'.'. Details: '.$e->getMessage());
|
||||
@@ -102,6 +104,18 @@ class DataManager
|
||||
throw new Exceptions\Error("Error while rebuilding database. See log file for details.");
|
||||
}
|
||||
|
||||
$config = $this->getContainer()->get('config');
|
||||
|
||||
$databaseType = strtolower($schema->getDatabaseHelper()->getDatabaseType());
|
||||
if (!$config->get('actualDatabaseType') || $config->get('actualDatabaseType') != $databaseType) {
|
||||
$config->set('actualDatabaseType', $databaseType);
|
||||
}
|
||||
|
||||
$databaseVersion = $schema->getDatabaseHelper()->getDatabaseVersion();
|
||||
if (!$config->get('actualDatabaseVersion') || $config->get('actualDatabaseVersion') != $databaseVersion) {
|
||||
$config->set('actualDatabaseVersion', $databaseVersion);
|
||||
}
|
||||
|
||||
$this->updateCacheTimestamp();
|
||||
|
||||
return $result;
|
||||
@@ -180,7 +194,7 @@ class DataManager
|
||||
public function updateCacheTimestamp()
|
||||
{
|
||||
$this->getContainer()->get('config')->updateCacheTimestamp();
|
||||
$this->getContainer()->get('config')->save();
|
||||
$this->getContainer()->get('config')->save(); /* correct rebuildDatabase() method when remove this line */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -127,6 +127,8 @@ return [
|
||||
'webSocketUseSecureServer',
|
||||
'webSocketPort',
|
||||
'aclStrictMode',
|
||||
'actualDatabaseType',
|
||||
'actualDatabaseVersion',
|
||||
],
|
||||
'adminItems' => [
|
||||
'devMode',
|
||||
|
||||
Reference in New Issue
Block a user