From 936ff0985a5ca30255d9e29c40e5cb2b8362af7f Mon Sep 17 00:00:00 2001 From: Yannick Gouez Date: Fri, 24 Feb 2017 23:56:48 -0500 Subject: [PATCH 1/2] Add support for clean legacy install --- bundle/Installer/CleanInstaller.php | 27 +++++++++++ bundle/Installer/DbBasedInstaller.php | 64 +++++++++++++++++++++++++++ bundle/Installer/Installer.php | 35 +++++++++++++++ bundle/Resources/config/services.yml | 9 ++++ 4 files changed, 135 insertions(+) create mode 100644 bundle/Installer/CleanInstaller.php create mode 100644 bundle/Installer/DbBasedInstaller.php create mode 100644 bundle/Installer/Installer.php 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 @@ + Date: Sat, 25 Feb 2017 12:17:30 -0500 Subject: [PATCH 2/2] Add support for ezxmltext field type --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 1c8ab494..8375eb30 100644 --- a/composer.json +++ b/composer.json @@ -12,6 +12,7 @@ "require": { "ezsystems/ezpublish-legacy": ">=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" },