[TYPO3-core] Quickstart extension in TYPO3 4.0
Karsten Dambekalns
karsten at typo3.org
Sat Mar 18 09:43:27 CET 2006
Hi Franz.
On Saturday 18 March 2006 08:25, Franz Holzinger wrote:
> > 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.
Yes, that would be cleaner. I didn't do this yet, because I consider it a
cleanup, and I am yet not satisfied with the overall flow in the method
anyway.
> > $version = $latestVersion;
>
> You are overwriting here a parameter which is nor reference variable.
Good point, maybe I should make it a reference. Thus the calling code can
easily check what version actually got installed.
> This is a bit confusing. You should use a new variable for this.
No new variable in any case. Because that would mean that I'd have to add two
lines that assign the (unchanged) $version to that new variable, too. No
gain.
> 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
TYPO3 always uses version_compare() for comparing version numbers. Sounds
logical, too. And this code isn't about sorting, but about finding the
highest version that is just below or equal the requested maximum.
> used. This code would not work if the $versions had not been sorted.
$versions is always sorted, TER2 does this. It's precondition that just has
to be true.
> + 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.
I won't change the order of that code, as it has a proven record of working -
it is from checkDBupdates() a few lines up in the source. The generated
statements are independent by the way. So it is not needed to move the create
before the add/change, because there will never be an add statement for a
table thatstill has to be created. Similarly the static import is always for
the one extension, and if you install sr_static_info_tables *today*, it is
handled the same way, if you import static data.
Karsten
--
Karsten Dambekalns
TYPO3 Association - Active Member
http://association.typo3.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 309 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20060318/0096b365/attachment.pgp
More information about the TYPO3-team-core
mailing list