diff --git a/Classes/Console/Command/Install/InstallFixFolderStructureCommand.php b/Classes/Console/Command/Install/InstallFixFolderStructureCommand.php
index 8f463935..343e2143 100644
--- a/Classes/Console/Command/Install/InstallFixFolderStructureCommand.php
+++ b/Classes/Console/Command/Install/InstallFixFolderStructureCommand.php
@@ -16,11 +16,10 @@
use Helhum\Typo3Console\Command\AbstractConvertedCommand;
use Helhum\Typo3Console\Command\RelatableCommandInterface;
-use Helhum\Typo3Console\Install\FolderStructure\ExtensionFactory;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
-use TYPO3\CMS\Core\Package\PackageManager;
use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Install\FolderStructure\DefaultFactory;
class InstallFixFolderStructureCommand extends AbstractConvertedCommand implements RelatableCommandInterface
{
@@ -72,16 +71,17 @@ protected function handleDeprecatedArgumentsAndOptions(InputInterface $input, Ou
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
- $folderStructureFactory = new ExtensionFactory(GeneralUtility::makeInstance(PackageManager::class));
- $fixedStatusObjects = $folderStructureFactory
+ $folderStructureFactory = GeneralUtility::makeInstance(DefaultFactory::class);
+ $messages = $folderStructureFactory
->getStructure()
- ->fix();
+ ->fix()
+ ->getAllMessagesAndFlush();
- if (empty($fixedStatusObjects)) {
+ if (empty($messages)) {
$output->writeln('No action performed!');
} else {
$output->writeln('The following directory structure has been fixed:');
- foreach ($fixedStatusObjects as $fixedStatusObject) {
+ foreach ($messages as $fixedStatusObject) {
$output->writeln($fixedStatusObject->getTitle());
}
}
diff --git a/Classes/Console/Extension/ExtensionSetup.php b/Classes/Console/Extension/ExtensionSetup.php
index a558c418..83604ea4 100644
--- a/Classes/Console/Extension/ExtensionSetup.php
+++ b/Classes/Console/Extension/ExtensionSetup.php
@@ -15,11 +15,9 @@
*/
use Helhum\Typo3Console\Database\Schema\SchemaUpdateType;
-use Helhum\Typo3Console\Install\FolderStructure\ExtensionFactory;
use Helhum\Typo3Console\Service\CacheService;
use Helhum\Typo3Console\Service\Database\SchemaService;
use TYPO3\CMS\Core\Package\PackageInterface;
-use TYPO3\CMS\Core\Package\PackageManager;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\PathUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager;
@@ -27,11 +25,6 @@
class ExtensionSetup
{
- /**
- * @var ExtensionFactory
- */
- private $extensionFactory;
-
/**
* @var InstallUtility
*/
@@ -48,12 +41,10 @@ class ExtensionSetup
private $extensionConfiguration;
public function __construct(
- ExtensionFactory $extensionFactory = null,
InstallUtility $extensionInstaller = null,
SchemaService $schemaService = null,
ExtensionConfiguration $extensionConfiguration = null
) {
- $this->extensionFactory = $extensionFactory ?? new ExtensionFactory(GeneralUtility::makeInstance(PackageManager::class));
$this->extensionInstaller = $extensionInstaller ?? GeneralUtility::makeInstance(ObjectManager::class)->get(InstallUtility::class);
$this->schemaService = $schemaService ?? GeneralUtility::makeInstance(ObjectManager::class)->get(SchemaService::class);
$this->extensionConfiguration = $extensionConfiguration ?? new ExtensionConfiguration();
@@ -83,7 +74,6 @@ public function deactivateExtensions(array $packageKeys)
public function setupExtensions(array $packages)
{
foreach ($packages as $package) {
- $this->extensionFactory->getExtensionStructure($package)->fix();
$this->callInstaller('importInitialFiles', [PathUtility::stripPathSitePrefix($package->getPackagePath()), $package->getPackageKey()]);
$this->extensionConfiguration->saveDefaultConfiguration($package->getPackageKey());
}
diff --git a/Classes/Console/Install/FolderStructure/ExtensionFactory.php b/Classes/Console/Install/FolderStructure/ExtensionFactory.php
deleted file mode 100644
index f1f3681d..00000000
--- a/Classes/Console/Install/FolderStructure/ExtensionFactory.php
+++ /dev/null
@@ -1,188 +0,0 @@
-packageManager = $packageManager;
- }
-
- /**
- * Get default structure object hierarchy
- *
- * @throws \TYPO3\CMS\Install\FolderStructure\Exception\RootNodeException
- * @throws \TYPO3\CMS\Install\FolderStructure\Exception\InvalidArgumentException
- * @return StructureFacade
- */
- public function getStructure()
- {
- $structure = $this->getDefaultStructureDefinition();
- $structure['children'] = $this->appendStructureDefinition($structure['children'], $this->createExtensionStructureDefinition($this->packageManager->getActivePackages()));
-
- return new StructureFacade(new RootNode($structure));
- }
-
- /**
- * Creates the folder structure for one extension
- *
- * @param PackageInterface $package
- * @return StructureFacade
- */
- public function getExtensionStructure(PackageInterface $package)
- {
- $structure = [
- 'name' => Environment::getPublicPath(),
- 'targetPermission' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'],
- 'children' => $this->appendStructureDefinition([], $this->createExtensionStructureDefinition([$package])),
- ];
-
- return new StructureFacade(new RootNode($structure));
- }
-
- /**
- * Default definition of folder and file structure with dynamic
- * permission settings
- *
- * @param PackageInterface[] $packages
- * @return array
- */
- private function createExtensionStructureDefinition(array $packages)
- {
- $structureBase = [];
- foreach ($packages as $package) {
- $extensionConfiguration = \Closure::bind(function () use ($package) {
- return $this->getExtensionEmConf($package->getPackagePath());
- }, $this->packageManager, get_class($this->packageManager))();
-
- if (isset($extensionConfiguration['uploadfolder']) && (bool)$extensionConfiguration['uploadfolder']) {
- $structureBase[] = $this->getExtensionUploadDirectory($package->getPackageKey());
- }
-
- if (!empty($extensionConfiguration['createDirs'])) {
- foreach (explode(',', $extensionConfiguration['createDirs']) as $directoryToCreate) {
- $absolutePath = GeneralUtility::getFileAbsFileName(trim($directoryToCreate));
- // Only create valid paths.
- if (!empty($absolutePath)) {
- $structureBase[] = $this->getDirectoryNodeByPath(PathUtility::stripPathSitePrefix($absolutePath));
- }
- }
- }
- }
-
- return $structureBase;
- }
-
- /**
- * Extension uploads directory.
- *
- * @param string $extension Extension key
- * @return array
- */
- private function getExtensionUploadDirectory($extension)
- {
- return $this->getDirectoryNodeByPath('uploads/tx_' . str_replace('_', '', $extension));
- }
-
- /**
- * Build directory nodes by given $path
- *
- * @param string $path Path to directory
- * @return array
- */
- private function getDirectoryNodeByPath($path)
- {
- $baseNode = [];
- $parts = explode('/', $path);
- $node = &$baseNode;
- foreach ($parts as $part) {
- $node[0] = [
- 'name' => $part,
- 'type' => DirectoryNode::class,
- 'targetPermission' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'],
- 'children' => [],
- ];
- // Add next directory as children of current node
- $node = &$node[0]['children'];
- }
-
- return isset($baseNode[0]) ? $baseNode[0] : [];
- }
-
- /**
- * Append $original structure definition with $additional structure definition.
- * Only add missing nodes.
- *
- * @param array $original
- * @param array $additional
- * @return array
- */
- private function appendStructureDefinition(array $original, array $additional)
- {
- foreach ($additional as $additionalStructure) {
- $structureKey = false;
- foreach ($original as $key => $originalStructure) {
- if ($originalStructure['name'] === $additionalStructure['name']) {
- $structureKey = $key;
- }
- }
-
- if ($structureKey === false) {
- // Append key to original
- $original[] = $additionalStructure;
- } else {
- // Append children, if necessary
- if (isset($additionalStructure['children'])) {
- if (isset($original[$structureKey]['children'])) {
- $original[$structureKey]['children'] = $this->appendStructureDefinition(
- $original[$structureKey]['children'],
- $additionalStructure['children']
- );
- } else {
- $original[$structureKey]['children'] = $additionalStructure['children'];
- }
- }
- }
- }
-
- return $original;
- }
-}
diff --git a/Resources/Private/ExtensionArtifacts/ext_emconf.php b/Resources/Private/ExtensionArtifacts/ext_emconf.php
index 883d3ff0..48cd5337 100644
--- a/Resources/Private/ExtensionArtifacts/ext_emconf.php
+++ b/Resources/Private/ExtensionArtifacts/ext_emconf.php
@@ -4,8 +4,6 @@
'description' => 'A reliable and powerful command line interface for TYPO3 CMS',
'category' => 'cli',
'state' => 'stable',
- 'uploadfolder' => 0,
- 'createDirs' => '',
'modify_tables' => '',
'clearCacheOnLoad' => 0,
'author' => 'Helmut Hummel',
diff --git a/Tests/Console/Functional/Fixtures/Extensions/ext_broken_ext_tables/ext_emconf.php b/Tests/Console/Functional/Fixtures/Extensions/ext_broken_ext_tables/ext_emconf.php
index 9d9f41df..6c43fe73 100644
--- a/Tests/Console/Functional/Fixtures/Extensions/ext_broken_ext_tables/ext_emconf.php
+++ b/Tests/Console/Functional/Fixtures/Extensions/ext_broken_ext_tables/ext_emconf.php
@@ -4,8 +4,6 @@
'description' => 'Extension fixture to prove extension compat check is working correctly',
'category' => 'cli',
'state' => 'stable',
- 'uploadfolder' => 0,
- 'createDirs' => '',
'modify_tables' => '',
'clearCacheOnLoad' => 0,
'author' => 'Helmut Hummel',
diff --git a/Tests/Console/Functional/Fixtures/Extensions/ext_broken_sql/ext_emconf.php b/Tests/Console/Functional/Fixtures/Extensions/ext_broken_sql/ext_emconf.php
index be9d5698..c2610847 100644
--- a/Tests/Console/Functional/Fixtures/Extensions/ext_broken_sql/ext_emconf.php
+++ b/Tests/Console/Functional/Fixtures/Extensions/ext_broken_sql/ext_emconf.php
@@ -4,8 +4,6 @@
'description' => 'Extension fixture to prove extension setup working correctly',
'category' => 'cli',
'state' => 'stable',
- 'uploadfolder' => 0,
- 'createDirs' => '',
'modify_tables' => '',
'clearCacheOnLoad' => 0,
'author' => 'Helmut Hummel',
diff --git a/Tests/Console/Functional/Fixtures/Extensions/ext_config/ext_emconf.php b/Tests/Console/Functional/Fixtures/Extensions/ext_config/ext_emconf.php
index e96d8318..d34d830d 100644
--- a/Tests/Console/Functional/Fixtures/Extensions/ext_config/ext_emconf.php
+++ b/Tests/Console/Functional/Fixtures/Extensions/ext_config/ext_emconf.php
@@ -4,8 +4,6 @@
'description' => 'Extension fixture to prove extension setup working correctly',
'category' => 'cli',
'state' => 'stable',
- 'uploadfolder' => 0,
- 'createDirs' => '',
'modify_tables' => '',
'clearCacheOnLoad' => 0,
'author' => 'Helmut Hummel',
diff --git a/Tests/Console/Functional/Fixtures/Extensions/ext_no_dep/ext_emconf.php b/Tests/Console/Functional/Fixtures/Extensions/ext_no_dep/ext_emconf.php
index 2681fb5e..1eb14019 100644
--- a/Tests/Console/Functional/Fixtures/Extensions/ext_no_dep/ext_emconf.php
+++ b/Tests/Console/Functional/Fixtures/Extensions/ext_no_dep/ext_emconf.php
@@ -4,8 +4,6 @@
'description' => 'Extension fixture to prove generating package states working correctly',
'category' => 'cli',
'state' => 'stable',
- 'uploadfolder' => 0,
- 'createDirs' => '',
'modify_tables' => '',
'clearCacheOnLoad' => 0,
'author' => 'Helmut Hummel',
diff --git a/Tests/Console/Functional/Fixtures/Extensions/ext_test/ext_emconf.php b/Tests/Console/Functional/Fixtures/Extensions/ext_test/ext_emconf.php
index be9d5698..c2610847 100644
--- a/Tests/Console/Functional/Fixtures/Extensions/ext_test/ext_emconf.php
+++ b/Tests/Console/Functional/Fixtures/Extensions/ext_test/ext_emconf.php
@@ -4,8 +4,6 @@
'description' => 'Extension fixture to prove extension setup working correctly',
'category' => 'cli',
'state' => 'stable',
- 'uploadfolder' => 0,
- 'createDirs' => '',
'modify_tables' => '',
'clearCacheOnLoad' => 0,
'author' => 'Helmut Hummel',
diff --git a/Tests/Console/Functional/Fixtures/Extensions/ext_test_cache/ext_emconf.php b/Tests/Console/Functional/Fixtures/Extensions/ext_test_cache/ext_emconf.php
index be9d5698..c2610847 100644
--- a/Tests/Console/Functional/Fixtures/Extensions/ext_test_cache/ext_emconf.php
+++ b/Tests/Console/Functional/Fixtures/Extensions/ext_test_cache/ext_emconf.php
@@ -4,8 +4,6 @@
'description' => 'Extension fixture to prove extension setup working correctly',
'category' => 'cli',
'state' => 'stable',
- 'uploadfolder' => 0,
- 'createDirs' => '',
'modify_tables' => '',
'clearCacheOnLoad' => 0,
'author' => 'Helmut Hummel',
diff --git a/Tests/Console/Functional/Fixtures/Extensions/ext_upgrade/ext_emconf.php b/Tests/Console/Functional/Fixtures/Extensions/ext_upgrade/ext_emconf.php
index 07bd8348..887ba8d5 100644
--- a/Tests/Console/Functional/Fixtures/Extensions/ext_upgrade/ext_emconf.php
+++ b/Tests/Console/Functional/Fixtures/Extensions/ext_upgrade/ext_emconf.php
@@ -4,8 +4,6 @@
'description' => 'Extension fixture to prove upgrade working correctly',
'category' => 'cli',
'state' => 'stable',
- 'uploadfolder' => 0,
- 'createDirs' => '',
'modify_tables' => '',
'clearCacheOnLoad' => 0,
'author' => 'Helmut Hummel',
diff --git a/Tests/Console/Functional/Fixtures/Extensions/ext_with_dep/ext_emconf.php b/Tests/Console/Functional/Fixtures/Extensions/ext_with_dep/ext_emconf.php
index eff99c4e..9fdf5240 100644
--- a/Tests/Console/Functional/Fixtures/Extensions/ext_with_dep/ext_emconf.php
+++ b/Tests/Console/Functional/Fixtures/Extensions/ext_with_dep/ext_emconf.php
@@ -4,8 +4,6 @@
'description' => 'Extension fixture to prove generating package states working correctly',
'category' => 'cli',
'state' => 'stable',
- 'uploadfolder' => 0,
- 'createDirs' => '',
'modify_tables' => '',
'clearCacheOnLoad' => 0,
'author' => 'Helmut Hummel',