Back to FtpClient class

Method syst

public string
syst
()
Method to system string from the FTP server
Returns
  • string System identifier string
Since
  • 1.5
Class: FtpClient
Project: Joomla

Method syst - Source code

/**
 * Method to system string from the FTP server
 *
 * @return  string   System identifier string
 *
 * @since   1.5
 */
public function syst()
{
    // If native FTP support is enabled lets use it...
    if (FTP_NATIVE) {
        if (($ret = @ftp_systype($this->_conn)) === false) {
            Log::add(Text::sprintf('JLIB_CLIENT_ERROR_FTP_BAD_RESPONSE', __METHOD__), Log::WARNING, 'jerror');
            return false;
        }
    } else {
        // Send print working directory command and verify success
        if (!$this->_putCmd('SYST', 215)) {
            Log::add(Text::sprintf('JLIB_CLIENT_ERROR_FTP_NOT_EXPECTED_RESPONSE', __METHOD__, $this->_response, 215), Log::WARNING, 'jerror');
            return false;
        }
        $ret = $this->_response;
    }
    // Match the system string to an OS
    if (strpos(strtoupper($ret), 'MAC') !== false) {
        $ret = 'MAC';
    } elseif (strpos(strtoupper($ret), 'WIN') !== false) {
        $ret = 'WIN';
    } else {
        $ret = 'UNIX';
    }
    // Return the os type
    return $ret;
}