-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2.0:feat(multi-application): allow absolute path in dump files #38
base: 2.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -532,18 +532,24 @@ private function readSql($databaseKey = null, $databaseConfig = null): void | |
* @return bool|null|string|string[] | ||
* @throws ModuleConfigException | ||
*/ | ||
private function readSqlFile(string $filePath): ?string | ||
private function readSqlFile(string $configPath): ?string | ||
{ | ||
if (!file_exists(Configuration::projectDir() . $filePath)) { | ||
if(file_exists($configPath)) { | ||
$dumpFile = $configPath; | ||
}elseif (file_exists(Configuration::projectDir().$configPath)){ | ||
$dumpFile = Configuration::projectDir().$configPath; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please check |
||
}else { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Formatting. Please put space after Please put spaces on both sides of concatenation operator. |
||
throw new ModuleConfigException( | ||
__CLASS__, | ||
"\nFile with dump doesn't exist.\n" | ||
. "Please, check path for sql file: " | ||
. $filePath | ||
sprintf( | ||
"Could not find dump file from config value.\nTried:\n%s\nand\n%s", | ||
$configPath, | ||
Configuration::projectDir().$configPath | ||
) | ||
); | ||
} | ||
|
||
$sql = file_get_contents(Configuration::projectDir() . $filePath); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And delete spaces in empty line. |
||
$sql = file_get_contents($dumpFile); | ||
|
||
// remove C-style comments (except MySQL directives) | ||
return preg_replace('#/\*(?!!\d+).*?\*/#s', '', $sql); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was it necessary to rename parameter?