-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create new command for initilizing folder structure for migrations
Move creation of intial structure for migration to own command to also cover needs for creating extension folder.
- Loading branch information
Showing
3 changed files
with
96 additions
and
17 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 |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?php | ||
/** | ||
* File containing the LegacySrcSymlinkCommand class. | ||
* | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
namespace eZ\Bundle\EzPublishLegacyBundle\Command; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Filesystem\Exception\IOException; | ||
use Symfony\Component\Filesystem\Filesystem; | ||
use Symfony\Component\Finder\Finder; | ||
|
||
class LegacySrcSymlinkCommand extends ContainerAwareCommand | ||
{ | ||
protected function configure() | ||
{ | ||
$this | ||
->setName('ezpublish:legacy:init') | ||
->setDefinition( | ||
array( | ||
new InputArgument('src', InputArgument::OPTIONAL, 'The src directory for legacy files', 'src/legacy_files'), | ||
) | ||
) | ||
->setDescription('Inits folders you can use when migrating from eZ Publihs install to eZ Platform with Legacy Bridge') | ||
->setHelp( | ||
<<<EOT | ||
The command <info>%command.name%</info> creates the following folders for migration usage: | ||
- src/AppBundle/ezpublish_legacy => Optionaly for extensions you want to version in your project source (as opposed to install using composer) | ||
- src/legacy_files/design => Optionally for cusotm designs not already made part of an extension | ||
- src/legacy_files/settings/override => Folder for override settings for legacy | ||
- src/legacy_files/settings/siteaccess => Folder for siteaccess settings for legacy | ||
<info>src/legacy_files</info> stored in your root project for | ||
any design/extension/settings project files, and symlinks these into <info>ezpublish_legacy/</info> which is installed by composer. | ||
The benefit of this is: | ||
1. Being able to version your design/extension/settings files in git without versioning legacy itself | ||
2. A predefined convention for where to place these files when migrating from older versions | ||
3. Placing these files directly in ezpublish_legacy folder will lead to them getting removed in some cases when composer | ||
needs to completely replace ezpublish-legacy package for different reasons. | ||
<comment>NOTE: Look towards 'ezpublish:legacybundles:install_extensions' command for how you handle legacy extensions.</comment> | ||
EOT | ||
); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$srcArg = rtrim($input->getArgument('src'), '/'); | ||
|
||
/** | ||
* @var \Symfony\Component\Filesystem\Filesystem | ||
*/ | ||
$filesystem = $this->getContainer()->get('filesystem'); | ||
|
||
$filesystem->mkdir([ | ||
$srcArg, | ||
"$srcArg/design", | ||
//"$srcArg/AppBundle", | ||
"$srcArg/AppBundle/ezpublish_legacy", | ||
"$srcArg/settings", | ||
"$srcArg/settings/override", | ||
"$srcArg/settings/siteaccess", | ||
]); | ||
|
||
|
||
$output->writeln(<<<EOT | ||
The following folders should have been created (or where already present): | ||
- src/AppBundle/ezpublish_legacy _(for extensions)_ | ||
- src/legacy_files/design | ||
- src/legacy_files/settings/override | ||
- src/legacy_files/settings/siteaccess | ||
Move over files and directories from older installation and afterwards run the folling commands to setup symlinks into | ||
legacy install: | ||
- <info>ezpublish:legacy:symlink</info> | ||
- <info>ezpublish:legacybundles:install_extensions</info> | ||
- <info>ezpublish:legacy:assets_install</info> | ||
EOT | ||
); | ||
} | ||
} |
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