[TASK] Remove unused EM_CONF variables 46/29746/6
authorBenjamin Mack <benni@typo3.org>
Wed, 30 Apr 2014 13:36:24 +0000 (15:36 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 6 Jul 2014 15:31:41 +0000 (17:31 +0200)
The ext_emconf.php are created when e.g. an extension
is downloaded from TER. Based on the data from TER the
extension information is built, but not needed anymore.

There are some values that are not in use in the current
6.2 system anymore, and just make ext_emconf.php
more complicated, as the current EM only runs with TER2
anyway.

The patch cleans up values when writing ext_emconf.php
for an extension. As soon as only 6.2+ is supported, the
TER could remove the values to be shipped in the
xml.gz files, thus saving resources (not much but I'm in
favor of a clean system).

Releases: 6.2,6.3
Resolves: #58365
Change-Id: Ic15247f57b557971e9a7c608e4dadd2080e976a3
Reviewed-on: https://review.typo3.org/29746
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/extensionmanager/Classes/Utility/EmConfUtility.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/EmConfUtilityTest.php

index cd75d56..197cd3b 100644 (file)
@@ -68,7 +68,7 @@ class EmConfUtility implements \TYPO3\CMS\Core\SingletonInterface {
 
 $EM_CONF[$_EXTKEY] = ' . $emConf . ';
 
 
 $EM_CONF[$_EXTKEY] = ' . $emConf . ';
 
-?>';
+';
                return str_replace('  ', TAB, $code);
        }
 
                return str_replace('  ', TAB, $code);
        }
 
@@ -98,38 +98,27 @@ $EM_CONF[$_EXTKEY] = ' . $emConf . ';
                        if (!isset($emConf['constraints']) || !isset($emConf['constraints']['suggests'])) {
                                $emConf['constraints']['suggests'] = array();
                        }
                        if (!isset($emConf['constraints']) || !isset($emConf['constraints']['suggests'])) {
                                $emConf['constraints']['suggests'] = array();
                        }
-               } elseif (isset($emConf['constraints']) && isset($emConf['dependencies'])) {
-                       $emConf['suggests'] = isset($emConf['suggests']) ? $emConf['suggests'] : array();
-                       $emConf['dependencies'] = $this->dependencyToString($emConf['constraints']);
-                       $emConf['conflicts'] = $this->dependencyToString($emConf['constraints'], 'conflicts');
                }
                }
+
+               // Remove TER v1-style entries
+               unset($emConf['dependencies']);
+               unset($emConf['conflicts']);
+               unset($emConf['suggests']);
                unset($emConf['private']);
                unset($emConf['download_password']);
                unset($emConf['TYPO3_version']);
                unset($emConf['PHP_version']);
                unset($emConf['private']);
                unset($emConf['download_password']);
                unset($emConf['TYPO3_version']);
                unset($emConf['PHP_version']);
-               return $emConf;
-       }
+               unset($emConf['internal']);
+               unset($emConf['module']);
+               unset($emConf['loadOrder']);
+               unset($emConf['lockType']);
+               unset($emConf['shy']);
+               unset($emConf['priority']);
+               unset($emConf['modify_tables']);
+               unset($emConf['CGLcompliance']);
+               unset($emConf['CGLcompliance_note']);
 
 
-       /**
-        * Checks whether the passed dependency is TER2-style (array) and returns a
-        * single string for displaying the dependencies.
-        *
-        * It leaves out all version numbers and the "php" and "typo3" dependencies,
-        * as they are implicit and of no interest without the version number.
-        *
-        * @param mixed $dependency Either a string or an array listing dependencies.
-        * @param string $type The dependency type to list if $dep is an array
-        * @return string A simple dependency list for display
-        */
-       static public function dependencyToString($dependency, $type = 'depends') {
-               if (!is_array($dependency) || !is_array($dependency[$type])) {
-                       return '';
-               }
-
-               unset($dependency[$type]['php']);
-               unset($dependency[$type]['typo3']);
-
-               return implode(',', array_keys($dependency[$type]));
+               return $emConf;
        }
 
        /**
        }
 
        /**
index be8af57..4c0ebb1 100644 (file)
@@ -42,7 +42,6 @@ class EmConfUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                );
                $expected = array(
                        'title' => 'a title',
                );
                $expected = array(
                        'title' => 'a title',
-                       'conflicts' => 'foo',
                        'constraints' => array(
                                'depends' => array(),
                                'conflicts' => array(
                        'constraints' => array(
                                'depends' => array(),
                                'conflicts' => array(
@@ -65,7 +64,6 @@ class EmConfUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                );
                $expected = array(
                        'title' => 'a title',
                );
                $expected = array(
                        'title' => 'a title',
-                       'conflicts' => 'foo,bar',
                        'constraints' => array(
                                'depends' => array(),
                                'conflicts' => array(
                        'constraints' => array(
                                'depends' => array(),
                                'conflicts' => array(
@@ -78,35 +76,4 @@ class EmConfUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $fixture = new \TYPO3\CMS\Extensionmanager\Utility\EmConfUtility();
                $this->assertEquals($expected, $fixture->fixEmConf($input));
        }
                $fixture = new \TYPO3\CMS\Extensionmanager\Utility\EmConfUtility();
                $this->assertEquals($expected, $fixture->fixEmConf($input));
        }
-
-       /**
-        * @test
-        */
-       public function dependencyToStringUnsetsDependencies() {
-               $config = array(
-                       'depends' => array(
-                               'php' => '5.0',
-                               'something' => 'foo',
-                               'anything' => 'bar'
-                       )
-               );
-               $expected = 'something,anything';
-
-               /** @var \TYPO3\CMS\Extensionmanager\Utility\EmConfUtility $fixture */
-               $fixture = $fixture = new \TYPO3\CMS\Extensionmanager\Utility\EmConfUtility();
-               $result = $fixture::dependencyToString($config);
-               $this->assertEquals($expected, $result);
-       }
-
-       /**
-        * @test
-        */
-       public function dependencyToStringDealsWithInvalidInput() {
-               $input = array(
-                       'depends' => 'hello world'
-               );
-               /** @var \TYPO3\CMS\Extensionmanager\Utility\EmConfUtility $fixture */
-               $fixture = $fixture = new \TYPO3\CMS\Extensionmanager\Utility\EmConfUtility();
-               $this->assertEquals('', $fixture::dependencyToString($input));
-       }
 }
 }