diff --git a/bundle/Installer/CleanInstaller.php b/bundle/Installer/CleanInstaller.php new file mode 100644 index 00000000..a57d69d1 --- /dev/null +++ b/bundle/Installer/CleanInstaller.php @@ -0,0 +1,27 @@ +runQueriesFromFile('ezpublish_legacy/kernel/sql/mysql/kernel_schema.sql'); + $this->runQueriesFromFile('ezpublish_legacy/kernel/sql/mysql/cluster_dfs_schema.sql'); + } + + public function importData() + { + $this->runQueriesFromFile( + 'ezpublish_legacy/kernel/sql/common/cleandata.sql' + ); + } + + public function importBinaries() + { + } +} diff --git a/bundle/Installer/DbBasedInstaller.php b/bundle/Installer/DbBasedInstaller.php new file mode 100644 index 00000000..c9d1306e --- /dev/null +++ b/bundle/Installer/DbBasedInstaller.php @@ -0,0 +1,64 @@ +db = $db; + } + + /** + * @param \Symfony\Component\Console\Output\OutputInterface $output + */ + public function setOutput($output) + { + $this->output = $output; + } + + /** + * Copy and override configuration file. + * + * @param string $source + * @param string $target + */ + protected function copyConfigurationFile($source, $target) + { + $fs = new Filesystem(); + $fs->copy($source, $target, true); + + if (!$this->output->isQuiet()) { + $this->output->writeln("Copied $source to $target"); + } + } + + protected function runQueriesFromFile($file) + { + $queries = array_filter(preg_split('(;\\s*$)m', file_get_contents($file))); + + if (!$this->output->isQuiet()) { + $this->output->writeln( + sprintf( + 'Executing %d queries from %s on database %s', + count($queries), + $file, + $this->db->getDatabase() + ) + ); + } + + foreach ($queries as $query) { + $this->db->exec($query); + } + } +} diff --git a/bundle/Installer/Installer.php b/bundle/Installer/Installer.php new file mode 100644 index 00000000..6db01ef9 --- /dev/null +++ b/bundle/Installer/Installer.php @@ -0,0 +1,35 @@ +=2014.11", "ezsystems/ezpublish-kernel": "~6.0@dev", + "ezsystems/ezplatform-xmltext-fieldtype": "^1.1", "sensio/distribution-bundle": "^3.0|^4.0|^5.0", "twig/twig": "^1.27 | ^2.0" },