[TYPO3-core] Quickstart extension in TYPO3 4.0

Martin Kutschker Martin.Kutschker at blackbox.net
Sat Mar 18 10:25:30 CET 2006


Franz Holzinger <franz at fholzinger.com> writes on 
Sat, 18 Mar 2006 08:25:17 +0100 (MET):

> 
> > 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.


This is a matter of style. I hate code that has mutliple $ret = $val and only one rteurn at the end. I favour code where a return is there where it happens.

Really ugly and unreadable because of it's neverending indenting are if-orgys:

if (ok1) {
..
if (ok2) {
..
if (ok3) {
..
}
}
}
return;

I think this is more readable:

if (!ok1) return;
..
if (!ok2) return;
..
if (!ok3) return;
..
return;

But that's basically all style. And no, I don't thinik we need coding guidlines for this issue.

Masi


> 
> 
> 
> > $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
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> TYPO3-team-core mailing list
> TYPO3-team-core at lists.netfielders.de
> 
">http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-team-core




More information about the TYPO3-team-core mailing list