docs, cs
This commit is contained in:
+19
-13
@@ -27,9 +27,11 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use Espo\Core\Application;
|
||||
use Espo\Core\Container;
|
||||
use Espo\Core\DataManager;
|
||||
use Espo\Core\Exceptions\Error;
|
||||
use Espo\Core\InjectableFactory;
|
||||
use Espo\Core\ORM\DatabaseParamsFactory;
|
||||
use Espo\Core\Utils\Database\ConfigDataProvider;
|
||||
@@ -319,6 +321,10 @@ class Installer
|
||||
return $systemRequirementManager->getRequiredListByType($type, $requiredOnly, $additionalData);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DBALException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function checkDatabaseConnection(array $rawParams, bool $createDatabase = false): void
|
||||
{
|
||||
$params = $this->databaseParamsFactory->createWithMergedAssoc($rawParams);
|
||||
@@ -336,6 +342,7 @@ class Installer
|
||||
throw $e;
|
||||
}
|
||||
|
||||
/** @noinspection RegExpRedundantEscape */
|
||||
if ($dbname !== preg_replace('/[^A-Za-z0-9_\-@$#\(\)]+/', '', $dbname)) {
|
||||
throw new Exception("Bad database name.");
|
||||
}
|
||||
@@ -355,7 +362,7 @@ class Installer
|
||||
|
||||
$schemaManager->createDatabase($platform->quoteIdentifier($dbname));
|
||||
|
||||
$this->checkDatabaseConnection($rawParams, false);
|
||||
$this->checkDatabaseConnection($rawParams);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,13 +370,13 @@ class Installer
|
||||
* Save data.
|
||||
*
|
||||
* @param array<string, mixed> $saveData
|
||||
* array(
|
||||
* 'driver' => 'pdo_mysql',
|
||||
* 'host' => 'localhost',
|
||||
* 'dbname' => 'espocrm_test',
|
||||
* 'user' => 'root',
|
||||
* 'password' => '',
|
||||
* )
|
||||
* [
|
||||
* 'driver' => 'pdo_mysql',
|
||||
* 'host' => 'localhost',
|
||||
* 'dbname' => 'espocrm_test',
|
||||
* 'user' => 'root',
|
||||
* 'password' => '',
|
||||
* ]
|
||||
* @return bool
|
||||
*/
|
||||
public function saveData(array $saveData)
|
||||
@@ -425,6 +432,9 @@ class Installer
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Error
|
||||
*/
|
||||
public function rebuild(): void
|
||||
{
|
||||
try {
|
||||
@@ -644,11 +654,6 @@ class Installer
|
||||
$paramType = $paramDefs['type'] ?? 'varchar';
|
||||
|
||||
switch ($paramType) {
|
||||
case 'enumInt':
|
||||
$normalizedParams[$name] = (int) $value;;
|
||||
|
||||
break;
|
||||
|
||||
case 'enum':
|
||||
if (
|
||||
isset($paramDefs['options']) && array_key_exists($value, $paramDefs['options']) ||
|
||||
@@ -672,6 +677,7 @@ class Installer
|
||||
break;
|
||||
|
||||
case 'int':
|
||||
case 'enumInt':
|
||||
$normalizedParams[$name] = (int) $value;
|
||||
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user