[TYPO3-mvc] Where / how to store extension related data?

Stig Nørgaard Færch snf at dkm.dk
Wed Feb 15 16:49:22 CET 2012


Den 15-02-2012 16:25, Xavier Perseguers skrev:
> Hi,
>
>>>> Check "image_autoresize" ext and see how Xavier made use of flexform to
>>>> store user settings.
>>>
>>> OT: I like so much how I could hack the (old) EM to do that... :)
>>
>> This is how I intend to do it:
>>
>> $key = '$TYPO3_CONF_VARS[\'EXT\'][\'extConf\'][\'extName\']';
>> $value = '\'' . serialize(array('someKey'=>'someValue')) . '\'';
>> $instObj = t3lib_div::makeInstance('t3lib_install');
>> $instObj->allowUpdateLocalConf = 1;
>> $instObj->updateIdentity = 'EXT:extName';
>> $lines = $instObj->writeToLocalconf_control();
>> $instObj->setValueInLocalconfFile($lines, $key, $value, FALSE);
>> $result = $instObj->writeToLocalconf_control($lines);
>>
>> Do you think this would be ok?
>> I tried it, and it seemed to work alright.
>
> This really looks like what I used in the aforementioned extension and
> as it works, then it's OK of course :)

No, it doesn't seem like you made use of it :-)
You did try to use the tx_install class. I use t3lib_install instead.
the tx_install class makes a redirect, which makes it impossible to use 
in a good way.

     /**
      * Writes a configuration line to localconf.php.
      * We don't use the <code>tx_install</code> methods as they add 
unneeded
      * comments at the end of the file.
      *
      * @param string $key
      * @param string $value
      * @return boolean
      */
     protected function writeToLocalconf($key, $value) {
         //$instObj = t3lib_div::makeInstance('tx_install');
         //$instObj->allowUpdateLocalConf = 1;
         //$instObj->updateIdentity = 'TYPO3 Core Update Manager';
         //$lines = $instObj->writeToLocalconf_control();
         //$instObj->setValueInLocalconfFile($lines, $key, $value, FALSE);
         //$result = $instObj->writeToLocalconf_control($lines);
         //if ($result !== 'nochange') {
         //    $this->config = $newConfig;
         //    t3lib_extMgm::removeCacheFiles();
         //}
         //$instObj = null;


More information about the TYPO3-project-typo3v4mvc mailing list