-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
š mariadb added sandbox mode to the mysql-dump command https://mariadā¦
- Loading branch information
Showing
9 changed files
with
83 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
parameters: | ||
ignoreErrors: [] | ||
ignoreErrors: | ||
- | ||
message: "#^Caught class Symfony\\\\Component\\\\Process\\\\Exception\\\\ProcessStartFailedException not found\\.$#" | ||
count: 1 | ||
path: src/Tools/EnvironmentUtility.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,14 +27,12 @@ private function getGlobalConfig(): GlobalConfig | |
$globalConfig = new GlobalConfig(); | ||
$globalConfig->addFilesystemObject((new FileSystem())->setName('fileadmin')->setPath('fileadmin')); | ||
$globalConfig->addFilesystemObject((new FileSystem())->setName('uploads')->setPath('uploads')); | ||
$globalConfig->addDatabaseObject((new Database())->setName('app')->setUrl('mysql://user:pw@host:3307/database')->setRemoveDefinerFromDump(false)); | ||
$globalConfig->addDatabaseObject((new Database())->setName('app')->setUrl('mysql://user:pw@host:3307/database')->setRemoveDefinerFromDump(false)->setAllowSandboxMode(true)); | ||
$globalConfig->addSshConnection('serverEu', '[email protected]'); | ||
$globalConfig->addSshConnectionObject((new SshConnection())->setHost('stagingServer')->setUrl('[email protected]')); | ||
$globalConfig->addAppInstanceObject((new AppInstance())->setName('production')->setHost('serverEu')->setPath('/var/www/production')->addFilesystemObject( | ||
(new FileSystem())->setName('fileadmin')->setPath('fileadmin2') | ||
)->addDatabaseObject( | ||
(new Database())->setName('app')->setUrl('mysql://root:root@appHost/appDatabase')->setRemoveDefinerFromDump(false) | ||
)); | ||
$globalConfig->addAppInstanceObject((new AppInstance())->setName('production')->setHost('serverEu')->setPath('/var/www/production') | ||
->addFilesystemObject((new FileSystem())->setName('fileadmin')->setPath('fileadmin2')) | ||
->addDatabaseObject((new Database())->setName('app')->setUrl('mysql://root:root@appHost/appDatabase')->setRemoveDefinerFromDump(false)->setAllowSandboxMode(true))); | ||
$globalConfig->addAppInstanceObject((new AppInstance())->setName('staging')->setHost('stagingServer')->setPath('/var/www/staging')); | ||
$globalConfig->addAppInstanceObject((new AppInstance())->setName('testing')->setHost('serverEu')->setPath('/var/www/testing')); | ||
$globalConfig->addAppInstanceObject((new AppInstance())->setName('local')->setHost('')->setPath('./')); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ public function testDatabaseCommandGenerate(): void | |
->setToDatabase($toConnection) | ||
->setToHost(''); | ||
$this->assertSame( | ||
"ssh -F 'php://temp' 'hostc' 'mysqldump " . ControllerTest::MYSQLDUMP_OPTIONS . " --host='\''database'\'' --user='\''root'\'' --password='\''root'\'' '\''sequelmovie'\'' | (echo '\''CREATE DATABASE IF NOT EXISTS `sequelmovie2`;USE `sequelmovie2`;'\'' && cat)" . ControllerTest::REMOVE_DEFINER_PART . "' | mysql --host='127.0.0.1' --port=2206 --user='root' --password='root'", | ||
"ssh -F 'php://temp' 'hostc' 'mysqldump " . ControllerTest::MYSQLDUMP_OPTIONS . " --host='\''database'\'' --user='\''root'\'' --password='\''root'\'' '\''sequelmovie'\'' | (echo '\''CREATE DATABASE IF NOT EXISTS `sequelmovie2`;USE `sequelmovie2`;'\'' && cat)" . ControllerTest::MYSQL_DUMP_MODIFICATION_PART . "' | mysql --host='127.0.0.1' --port=2206 --user='root' --password='root'", | ||
(string)$database->generate(ShellBuilder::new()) | ||
); | ||
} | ||
|
@@ -56,7 +56,7 @@ public function testDatabaseCommandWithoutDefinerInstructionsGenerate(): void | |
->setToDatabase($toConnection) | ||
->setToHost(''); | ||
$this->assertSame( | ||
"ssh -F 'php://temp' 'hostc' 'mysqldump " . ControllerTest::MYSQLDUMP_OPTIONS . " --host='\''database'\'' --user='\''root'\'' --password='\''root'\'' '\''sequelmovie'\'' | (echo '\''CREATE DATABASE IF NOT EXISTS `sequelmovie2`;USE `sequelmovie2`;'\'' && cat) | sed -e '\''s/DEFINER[ ]*=[ ]*[^*]*\*/\*/; s/DEFINER[ ]*=[ ]*[^*]*PROCEDURE/PROCEDURE/; s/DEFINER[ ]*=[ ]*[^*]*FUNCTION/FUNCTION/'\''' | mysql --host='127.0.0.1' --port=2206 --user='root' --password='root'", | ||
"ssh -F 'php://temp' 'hostc' 'mysqldump " . ControllerTest::MYSQLDUMP_OPTIONS . " --host='\''database'\'' --user='\''root'\'' --password='\''root'\'' '\''sequelmovie'\'' | (echo '\''CREATE DATABASE IF NOT EXISTS `sequelmovie2`;USE `sequelmovie2`;'\'' && cat)" . ControllerTest::MYSQL_DUMP_MODIFICATION_PART . "' | mysql --host='127.0.0.1' --port=2206 --user='root' --password='root'", | ||
(string)$database->generate(ShellBuilder::new()) | ||
); | ||
} | ||
|
@@ -68,7 +68,9 @@ public function testDatabaseCommandWithoutDefinerInstructionsLocallyGenerate(): | |
|
||
$database = new DatabaseCommand(); | ||
$fromConnection = (new Database())->setConnectionDetails(DatabaseConnectionDetails::fromUrlString('mysql://root:root@database/sequelmovie')); | ||
$fromConnection->setRemoveDefinerFromDump(true); | ||
$fromConnection | ||
->setRemoveDefinerFromDump(true) | ||
->setAllowSandboxMode(true); | ||
|
||
$toConnection = (new Database())->setConnectionDetails(DatabaseConnectionDetails::fromUrlString('mysql://root:[email protected]:2206/sequelmovie2')); | ||
$database->setSshConfig($sshConfig) | ||
|
@@ -91,6 +93,7 @@ public function testDatabaseCommandGenerateWithDocker(): void | |
$fromConnection = (new Database()) | ||
->setConnectionDetails(DatabaseConnectionDetails::fromUrlString('mysql://root:root@database/sequelmovie')) | ||
->setRemoveDefinerFromDump(false) | ||
->setAllowSandboxMode(true) | ||
->executeInDocker(true); | ||
$toConnection = (new Database())->setConnectionDetails(DatabaseConnectionDetails::fromUrlString('mysql://root:[email protected]:2206/sequelmovie2')); | ||
$database->setSshConfig($sshConfig) | ||
|
@@ -120,6 +123,7 @@ public function testDatabaseCommandGenerateWithDockerAndSudo(): void | |
$fromConnection = (new Database()) | ||
->setConnectionDetails(DatabaseConnectionDetails::fromUrlString('mysql://root:root@database/sequelmovie')) | ||
->setRemoveDefinerFromDump(false) | ||
->setAllowSandboxMode(true) | ||
->executeInDocker(true) | ||
->enableSudoForDocker(true); | ||
$toConnection = (new Database())->setConnectionDetails(DatabaseConnectionDetails::fromUrlString('mysql://root:[email protected]:2206/sequelmovie2')); | ||
|
@@ -154,6 +158,7 @@ public function testDatabaseCommandGenerateWithDockerOnBothSides(): void | |
$fromConnection = (new Database()) | ||
->setConnectionDetails(DatabaseConnectionDetails::fromUrlString('mysql://root:root@database/sequelmovie')) | ||
->setRemoveDefinerFromDump(false) | ||
->setAllowSandboxMode(true) | ||
->executeInDocker(true); | ||
$toConnection = (new Database()) | ||
->setConnectionDetails(DatabaseConnectionDetails::fromUrlString('mysql://root:[email protected]:2206/sequelmovie2')) | ||
|
@@ -255,7 +260,7 @@ public function testDatabaseCommandGzip(): void | |
->setCompression(new GzipCompression()); | ||
|
||
$this->assertSame( | ||
"ssh -F 'php://temp' 'hostc' 'mysqldump " . ControllerTest::MYSQLDUMP_OPTIONS . " --host='\''database'\'' --user='\''root'\'' --password='\''root'\'' '\''sequelmovie'\'' | (echo '\''CREATE DATABASE IF NOT EXISTS `sequelmovie2`;USE `sequelmovie2`;'\'' && cat)" . ControllerTest::REMOVE_DEFINER_PART . " | gzip' | gunzip | mysql --host='127.0.0.1' --port=2206 --user='root' --password='root'", | ||
"ssh -F 'php://temp' 'hostc' 'mysqldump " . ControllerTest::MYSQLDUMP_OPTIONS . " --host='\''database'\'' --user='\''root'\'' --password='\''root'\'' '\''sequelmovie'\'' | (echo '\''CREATE DATABASE IF NOT EXISTS `sequelmovie2`;USE `sequelmovie2`;'\'' && cat)" . ControllerTest::MYSQL_DUMP_MODIFICATION_PART . " | gzip' | gunzip | mysql --host='127.0.0.1' --port=2206 --user='root' --password='root'", | ||
(string)$database->generate(ShellBuilder::new()) | ||
); | ||
} | ||
|
@@ -276,7 +281,7 @@ public function testDatabaseCommandBzip2(): void | |
->setCompression(new Bzip2Compression()); | ||
|
||
$this->assertSame( | ||
"ssh -F 'php://temp' 'hostc' 'mysqldump " . ControllerTest::MYSQLDUMP_OPTIONS . " --host='\''database'\'' --user='\''root'\'' --password='\''root'\'' '\''sequelmovie'\'' | (echo '\''CREATE DATABASE IF NOT EXISTS `sequelmovie2`;USE `sequelmovie2`;'\'' && cat)" . ControllerTest::REMOVE_DEFINER_PART . " | bzip2' | bunzip2 | mysql --host='127.0.0.1' --port=2206 --user='root' --password='root'", | ||
"ssh -F 'php://temp' 'hostc' 'mysqldump " . ControllerTest::MYSQLDUMP_OPTIONS . " --host='\''database'\'' --user='\''root'\'' --password='\''root'\'' '\''sequelmovie'\'' | (echo '\''CREATE DATABASE IF NOT EXISTS `sequelmovie2`;USE `sequelmovie2`;'\'' && cat)" . ControllerTest::MYSQL_DUMP_MODIFICATION_PART . " | bzip2' | bunzip2 | mysql --host='127.0.0.1' --port=2206 --user='root' --password='root'", | ||
(string)$database->generate(ShellBuilder::new()) | ||
); | ||
} | ||
|
@@ -297,7 +302,7 @@ public function testDatabaseCommandQuiet(): void | |
->setVerbosity(OutputInterface::VERBOSITY_QUIET); | ||
|
||
$this->assertSame( | ||
"ssh -q -F 'php://temp' 'hostc' 'mysqldump -q " . ControllerTest::MYSQLDUMP_OPTIONS . " --host='\''database'\'' --user='\''root'\'' --password='\''root'\'' '\''sequelmovie'\'' | (echo '\''CREATE DATABASE IF NOT EXISTS `sequelmovie2`;USE `sequelmovie2`;'\'' && cat)" . ControllerTest::REMOVE_DEFINER_PART . "' | mysql --host='127.0.0.1' --port=2206 --user='root' --password='root'", | ||
"ssh -q -F 'php://temp' 'hostc' 'mysqldump -q " . ControllerTest::MYSQLDUMP_OPTIONS . " --host='\''database'\'' --user='\''root'\'' --password='\''root'\'' '\''sequelmovie'\'' | (echo '\''CREATE DATABASE IF NOT EXISTS `sequelmovie2`;USE `sequelmovie2`;'\'' && cat)" . ControllerTest::MYSQL_DUMP_MODIFICATION_PART . "' | mysql --host='127.0.0.1' --port=2206 --user='root' --password='root'", | ||
(string)$database->generate(ShellBuilder::new()) | ||
); | ||
} | ||
|
@@ -318,7 +323,7 @@ public function testDatabaseCommandVerbose(): void | |
->setVerbosity(OutputInterface::VERBOSITY_VERBOSE); | ||
|
||
$this->assertSame( | ||
"ssh -v -F 'php://temp' 'hostc' 'mysqldump -v " . ControllerTest::MYSQLDUMP_OPTIONS . " --host='\''database'\'' --user='\''root'\'' --password='\''root'\'' '\''sequelmovie'\'' | (echo '\''CREATE DATABASE IF NOT EXISTS `sequelmovie2`;USE `sequelmovie2`;'\'' && cat)" . ControllerTest::REMOVE_DEFINER_PART . "' | mysql --host='127.0.0.1' --port=2206 --user='root' --password='root'", | ||
"ssh -v -F 'php://temp' 'hostc' 'mysqldump -v " . ControllerTest::MYSQLDUMP_OPTIONS . " --host='\''database'\'' --user='\''root'\'' --password='\''root'\'' '\''sequelmovie'\'' | (echo '\''CREATE DATABASE IF NOT EXISTS `sequelmovie2`;USE `sequelmovie2`;'\'' && cat)" . ControllerTest::MYSQL_DUMP_MODIFICATION_PART . "' | mysql --host='127.0.0.1' --port=2206 --user='root' --password='root'", | ||
(string)$database->generate(ShellBuilder::new()) | ||
); | ||
} | ||
|
@@ -339,7 +344,7 @@ public function testDatabaseCommandVeryVerbose(): void | |
->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE); | ||
|
||
$this->assertSame( | ||
"ssh -vv -F 'php://temp' 'hostc' 'mysqldump -vv " . ControllerTest::MYSQLDUMP_OPTIONS . " --host='\''database'\'' --user='\''root'\'' --password='\''root'\'' '\''sequelmovie'\'' | (echo '\''CREATE DATABASE IF NOT EXISTS `sequelmovie2`;USE `sequelmovie2`;'\'' && cat)" . ControllerTest::REMOVE_DEFINER_PART . "' | mysql --host='127.0.0.1' --port=2206 --user='root' --password='root'", | ||
"ssh -vv -F 'php://temp' 'hostc' 'mysqldump -vv " . ControllerTest::MYSQLDUMP_OPTIONS . " --host='\''database'\'' --user='\''root'\'' --password='\''root'\'' '\''sequelmovie'\'' | (echo '\''CREATE DATABASE IF NOT EXISTS `sequelmovie2`;USE `sequelmovie2`;'\'' && cat)" . ControllerTest::MYSQL_DUMP_MODIFICATION_PART . "' | mysql --host='127.0.0.1' --port=2206 --user='root' --password='root'", | ||
(string)$database->generate(ShellBuilder::new()) | ||
); | ||
} | ||
|
@@ -360,7 +365,7 @@ public function testDatabaseCommandDebug(): void | |
->setVerbosity(OutputInterface::VERBOSITY_DEBUG); | ||
|
||
$this->assertSame( | ||
"ssh -vvv -F 'php://temp' 'hostc' 'mysqldump -vvv " . ControllerTest::MYSQLDUMP_OPTIONS . " --host='\''database'\'' --user='\''root'\'' --password='\''root'\'' '\''sequelmovie'\'' | (echo '\''CREATE DATABASE IF NOT EXISTS `sequelmovie2`;USE `sequelmovie2`;'\'' && cat)" . ControllerTest::REMOVE_DEFINER_PART . "' | mysql --host='127.0.0.1' --port=2206 --user='root' --password='root'", | ||
"ssh -vvv -F 'php://temp' 'hostc' 'mysqldump -vvv " . ControllerTest::MYSQLDUMP_OPTIONS . " --host='\''database'\'' --user='\''root'\'' --password='\''root'\'' '\''sequelmovie'\'' | (echo '\''CREATE DATABASE IF NOT EXISTS `sequelmovie2`;USE `sequelmovie2`;'\'' && cat)" . ControllerTest::MYSQL_DUMP_MODIFICATION_PART . "' | mysql --host='127.0.0.1' --port=2206 --user='root' --password='root'", | ||
(string)$database->generate(ShellBuilder::new()) | ||
); | ||
} | ||
|
@@ -379,7 +384,7 @@ public function testDatabaseCommandPasswordWithSpecialCharacters(): void | |
->setToDatabase($toConnection) | ||
->setToHost(''); | ||
$this->assertSame( | ||
"ssh -F 'php://temp' 'hostc' 'mysqldump " . ControllerTest::MYSQLDUMP_OPTIONS . " --host='\''database'\'' --user='\''root'\'' --password='\''root#password'\''\'\'''\''\"_!'\'' '\''sequelmovie'\'' | (echo '\''CREATE DATABASE IF NOT EXISTS `sequelmovie2`;USE `sequelmovie2`;'\'' && cat)" . ControllerTest::REMOVE_DEFINER_PART . "' | mysql --host='127.0.0.1' --port=2206 --user='root' --password='root'", | ||
"ssh -F 'php://temp' 'hostc' 'mysqldump " . ControllerTest::MYSQLDUMP_OPTIONS . " --host='\''database'\'' --user='\''root'\'' --password='\''root#password'\''\'\'''\''\"_!'\'' '\''sequelmovie'\'' | (echo '\''CREATE DATABASE IF NOT EXISTS `sequelmovie2`;USE `sequelmovie2`;'\'' && cat)" . ControllerTest::MYSQL_DUMP_MODIFICATION_PART . "' | mysql --host='127.0.0.1' --port=2206 --user='root' --password='root'", | ||
(string)$database->generate(ShellBuilder::new()) | ||
); | ||
} | ||
|
Oops, something went wrong.