[TYPO3-core] Quickstart extension in TYPO3 4.0

Franz Holzinger franz at fholzinger.com
Sat Mar 18 08:25:17 CET 2006


Hello Karsten,

>Hej Kasper, hi list.
>
>On Thursday 16 March 2006 15:40, Kasper Skårhøj wrote:
>  
>
>>If you can explain the API when ready I could probably do that.
>>    
>>
>
>Great.
>
>This is what I coded today in SC_mod_tools_em_index:
> installExtension($extKey,$version=null,$mode=EM_INSTALL_VERSION_MIN) 
>
>  
>

some comments from me:

> return array(true, 'Extension already installed and loaded.');

Use a $rc variable to store the return codes and make one return at the
end of the function installExtension.


> $version = $latestVersion;

You are overwriting here a parameter which is nor reference variable.
This is a bit confusing. You should use a new variable for this.


> while(($v = array_pop($versions)) && version_compare($v, $version,
> '>=')) {}

Maybe it would be fine to store the version number in a binary format
which can be more easily compared. So a PHP array sort function could be
used. This code would not work if the $versions had not been sorted.


+                foreach($update_statements['create_table'] as $string)    {
+                    $GLOBALS['TYPO3_DB']->admin_query($string);
+                }
Create tables should come before add and change.


+            // Importing static tables?
Should come before updating tables and fields. Maybe an extension wants
to update the static tables like sr_static_info does.





- Franz



















More information about the TYPO3-team-core mailing list