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

Dmitry Dulepov dmitry at typo3.org
Mon Dec 15 08:33:09 CET 2008


Hi!

Christopher wrote:
> What is the right syntax for this condition?

There is no such condition in TS but it is possible with userFunc.

For example, you can put the lines below (except ======) to user_checkOS.php inside fileadmin/:

=================
<?php                                                                                                                                                 
                                                                                                                                                      
function user_checkOS($os) {                                                                                                                          
    if ($os == 'Windows') {                                                                                                                           
        return TYPO3_OS == 'WIN';                                                                                                                     
    }                                                                                                                                                 
    $sysinfo = posix_uname();                                                                                                                         
    return $os == $sysinfo['sysname'];                                                                                                                
}                                                                                                                                                     
                                                                                                                                                      
?>
=================

Next you do this in TS:

includeLibs.user_checkOS = fileadmin/user_checkOS.php

And here is conditions:

10 = TEXT
10.value = Who knows?
10.noTrimWrap = |Server OS is: ||
[userFunc = user_checkOS('Windows')]
10.value = Windows
[userFunc = user_checkOS('Linux')]
10.value = Linux
[userFunc = user_checkOS('Darwin')]
10.value = Mac OS X
[global]

Untested but should work.

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