[TYPO3-english] Is there a condition to check the OS of the server?

Dmitry Dulepov dmitry at typo3.org
Wed Dec 17 10:37:49 CET 2008


Christopher wrote:
> The follwoing works:
> Add this to your localconf.php:
> function user_checkOS($os) {
>     if (TYPO3_OS == 'WIN') {
>         # return $os gives back the value,
>         # which was used to compare in the Typoscript-Condition
>         # (which is "Windows"; see below).
>         # So it makes the condition become true.
>         return $os;

It must not be $os :( It must be "true". You return the wrong thing. It may work but it is technically wrong.

> If I put the code into a file in fileadmin and use includeLibs like this:
> includeLibs.user_checkOS = fileadmin/user_checkOS.php
> it does not work on Windows.
> The condition in TypoScript does not match.
> But I think the file is included, because of the following:
> If I copy the function to localconf.php AND use includeLibs, I get a "Cannot 
> redeclare..."-error, ("previously declared in localconf.php") in FE.

This is totally wrong. You must not put such things in localconf.php, this is against every TYPO3 practice.

> Why does the condition not work with includeLibs on Windows?

I don't know. I have only Linux and Mac under hand.

Dmitry Dulepov
TYPO3 core team
In the blog: http://typo3bloke.net/post-details/how_will_i_fix_bugs_in_extensions_from_now_on/
My TYPO3 book: http://www.packtpub.com/typo3-extension-development/book

More information about the TYPO3-english mailing list