[TASK] Update and cleanup extension configuration 39/51439/2
authorStanislas Rolland <typo3@sjbr.ca>
Thu, 26 Jan 2017 20:08:48 +0000 (15:08 -0500)
committerStanislas Rolland <typo3@sjbr.ca>
Thu, 26 Jan 2017 20:13:36 +0000 (21:13 +0100)
Change-Id: I19ea9199ef24c1c7239cbb00aa11a35f0776312f
Reviewed-on: https://review.typo3.org/51439
Reviewed-by: Stanislas Rolland <typo3@sjbr.ca>
Tested-by: Stanislas Rolland <typo3@sjbr.ca>
ChangeLog
Configuration/TCA/Overrides/tt_address.php
doc/manual.sxw
ext_conf_template.txt
ext_localconf.php
ext_tables.sql

index 068e480..00322e7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2017-01-26 Stanislas Rolland  <typo3(arobas)sjbr.ca>
+       * Update and cleanup extension configuration
+
 2016-02-19 Stanislas Rolland  <typo3(arobas)sjbr.ca>
        * Update version to 4.0.2
 
index 27e183c..96a70a1 100644 (file)
@@ -68,29 +68,21 @@ if ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['sr_email_subscribe']['addressTable']
        $GLOBALS['TCA']['tt_address']['interface']['showRecordFieldList'] = preg_replace('/(^|,)\s*country\s*(,|$)/', '$1zone,static_info_country,country,language$2', $GLOBALS['TCA']['tt_address']['interface']['showRecordFieldList']);
        $GLOBALS['TCA']['tt_address']['interface']['showRecordFieldList'] = preg_replace('/(^|,)\s*title\s*(,|$)/', '$1date_of_birth,title$2', $GLOBALS['TCA']['tt_address']['interface']['showRecordFieldList']);
        $GLOBALS['TCA']['tt_address']['interface']['showRecordFieldList'] = preg_replace('/(^|,)\s*www\s*(,|$)/', '$1www,comments$2', $GLOBALS['TCA']['tt_address']['interface']['showRecordFieldList']);
-       
-       $GLOBALS['TCA']['tt_address']['feInterface']['fe_admin_fieldList'] = preg_replace('/(^|,)\s*country\s*(,|$)/', '$1zone,static_info_country,country,language,comments$2', $GLOBALS['TCA']['tt_address']['feInterface']['fe_admin_fieldList']);
-       $GLOBALS['TCA']['tt_address']['feInterface']['fe_admin_fieldList'] .= ',date_of_birth';
-
-       if (strstr($GLOBALS['TCA']['tt_address']['feInterface']['fe_admin_fieldList'], 'image') === false) {
-               $GLOBALS['TCA']['tt_address']['feInterface']['fe_admin_fieldList'] .= ',image';
-       }
 
        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('tt_address', 'comments');
-       $GLOBALS['TCA']['tt_address']['palettes']['3']['showitem'] = preg_replace('/(^|,)\s*country\s*(,|$)/', '$1zone,static_info_country,country,language$2', $GLOBALS['TCA']['tt_address']['palettes']['3']['showitem']);
+       $GLOBALS['TCA']['tt_address']['palettes']['address']['showitem'] = preg_replace('/(^|,)\s*country\s*(,|$)/', '$1zone,static_info_country,country,language$2', $GLOBALS['TCA']['tt_address']['palettes']['address']['showitem']);
 
        // tt_address modified
        if (!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('direct_mail')) {
                \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tt_address', array(
                        'module_sys_dmail_html' => array(
                                'label'=>'LLL:EXT:sr_email_subscribe/Resources/Private/Language/locallang_db.xlf:tt_address.module_sys_dmail_html',
-                               'exclude' => '1',
+                               'exclude' => '0',
                                'config'=> array(
                                        'type'=>'check'
                                        )
                                )
                ));
-               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCATypes('tt_address', '--div--;Direct mail,module_sys_dmail_html;;;;1-1-1');
-               $GLOBALS['TCA']['tt_address']['feInterface']['fe_admin_fieldList'] .= ',module_sys_dmail_html';
+               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCATypes('tt_address', '--div--;Direct mail,module_sys_dmail_html');
        }
 }
\ No newline at end of file
index f2759f3..9818ad3 100644 (file)
Binary files a/doc/manual.sxw and b/doc/manual.sxw differ
index e6f5690..6677fcd 100644 (file)
@@ -1,5 +1,5 @@
-  # cat=basic/enable; type=string; label=Image upload folder: This is the place where the images are stored.
-imageFolder = uploads/tx_sremailsubscribe
+  # cat=basic/enable; type=string; label=Image upload folder: This is the place where the images are stored. Default is 2:/tx_sremailsubscribe/ in TYPO3 CMS 8 LTS and uploads/tx_sremailsubscribe in TYPO3 CMS 7 LTS.
+imageFolder = 
   # cat=basic/enable; type=boolean; label=Use image folder: Enable the usage of imageFolder for the upload of images.
 useImageFolder = 0
   # cat=basic/enable; type=string; label=Address table: Name of the address table to be used
index 2623dba..3ee6a7c 100644 (file)
@@ -1,43 +1,30 @@
 <?php
 defined('TYPO3_MODE') or die();
 
-$_EXTCONF = unserialize($_EXTCONF);    // unserializing the configuration so we can use it here:
-$GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['imagefolder'] = $_EXTCONF['imageFolder'] ? $_EXTCONF['imageFolder'] : 'uploads/tx_sremailsubscribe';
-$GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['useImageFolder'] = !empty($_EXTCONF['useImageFolder']) ? $_EXTCONF['useImageFolder'] : '0';
-$GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['addressTable'] = $_EXTCONF['addressTable'] ?: 'tt_address';
+// Get the extensions's configuration
+$extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['sr_email_subscribe']);
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['sr_email_subscribe']['imagefolder'] = $extConf['imageFolder'] ? $extConf['imageFolder'] : '2:/tx_sremailsubscribe/';
+if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version()) < 8000000) {
+       $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['sr_email_subscribe']['imagefolder'] = $extConf['imagefolder'] ? $extConf['imagefolder'] : 'uploads/tx_sremailsubscribe';
+}
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['sr_email_subscribe']['useImageFolder'] = !empty($extConf['useImageFolder']) ? $extConf['useImageFolder'] : '0';
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['sr_email_subscribe']['addressTable'] = $extConf['addressTable'] ?: 'tt_address';
 
 // Save extension version and constraints
-require_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'ext_emconf.php');
-$GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['version'] = $EM_CONF[$_EXTKEY]['version'];
-$GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['constraints'] = $EM_CONF[$_EXTKEY]['constraints'];
+$emConfUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extensionmanager\Utility\EmConfUtility::class);
+$emConf = $emConfUtility->includeEmConf(['key' => 'sr_email_subscribe', 'siteRelPath' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('sr_email_subscribe')]);
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['sr_email_subscribe']['version'] = $emConf['sr_email_subscribe']['version'];
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['sr_email_subscribe']['constraints'] = $emConf['sr_email_subscribe']['constraints'];
 
 // Captcha hooks
-if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['captcha'])) {
-       $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['captcha'] = array();
+if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['sr_email_subscribe']['captcha'])) {
+       $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['sr_email_subscribe']['captcha'] = [];
 }
-$GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['captcha'][] = 'SJBR\\SrFeuserRegister\\Captcha\\Captcha';
-$GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['captcha'][] = 'SJBR\\SrFeuserRegister\\Captcha\\Freecap';
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['sr_email_subscribe']['captcha'][] = \SJBR\SrFeuserRegister\Captcha\Captcha::class;
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['sr_email_subscribe']['captcha'][] = \SJBR\SrFeuserRegister\Captcha\Freecap::class;
+
+$addressTable = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['sr_email_subscribe']['addressTable'];
 
-$addressTable = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$_EXTKEY]['addressTable'];
-if (TYPO3_MODE === 'BE') {
-       if (!defined($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['addTables']['tt_address']['MENU']) && $addressTable === 'tt_address') {
-               $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['LLFile'][$addressTable] = 'EXT:sr_email_subscribe/Resources/Private/Language/locallang_db_layout.xlf';
-               $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['addTables'][$addressTable] = array (
-                       'default' => array(
-                               'MENU' => 'm_default',
-                               'fList' =>  'first_name,middle_name,last_name,title,address,zip,city,country,gender,image,uid',
-                               'icon' => true
-                       ),
-                       'ext' => array (
-                               'MENU' => 'm_ext',
-                               'fList' =>  'name,description,email,phone,mobile,fax,www,birthday',
-                               'icon' => true
-                       ),
-                       'company' => array (
-                               'MENU' => 'm_company',
-                               'fList' =>  'name,city,company,building,room,addressgroup',
-                               'icon' => true
-                       )
-               );
-       }
-}
\ No newline at end of file
+unset($extConf);
+unset($emConfUtility);
+unset($emConf);
\ No newline at end of file
index 0df7254..d1f60fd 100644 (file)
@@ -4,10 +4,10 @@
 
 
 CREATE TABLE tt_address (
-       static_info_country char(3) DEFAULT '' NOT NULL,
+       static_info_country varchar(3) DEFAULT '' NOT NULL,
        zone varchar(45) DEFAULT '' NOT NULL,
-       language char(5) DEFAULT '' NOT NULL,
+       language varchar(5) DEFAULT '' NOT NULL,
        date_of_birth int(11) DEFAULT '0' NOT NULL,
        comments text NOT NULL,
-       module_sys_dmail_html tinyint(3) unsigned DEFAULT '0' NOT NULL
-);
+       module_sys_dmail_html tinyint(3) DEFAULT '0' NOT NULL
+);
\ No newline at end of file