API16

Difference between revisions of "JFTP/chmod"

From Joomla! Documentation

< API16:JFTP
(New page: ===Description=== Method to change mode for a path on the FTP server <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<now...)
 
m (preparing for archive only)
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
Method to change mode for a path on the FTP server
 
Method to change mode for a path on the FTP server
  
<span class="editsection" style="font-size:76%;">
 
<nowiki>[</nowiki>[[Description:JFTP/chmod|Edit Descripton]]<nowiki>]</nowiki>
 
</span>
 
  
{{Description:JFTP/chmod}}
+
 
 +
<! removed transcluded page call, red link never existed >
  
 
===Syntax===
 
===Syntax===
Line 70: Line 68:
 
</source>
 
</source>
  
<span class="editsection" style="font-size:76%;">
+
 
<nowiki>[</nowiki>[[SeeAlso:JFTP/chmod|Edit See Also]]<nowiki>]</nowiki>
+
<! removed transcluded page call, red link never existed >
</span>
 
{{SeeAlso:JFTP/chmod}}
 
  
 
===Examples===
 
===Examples===
<CodeExamplesForm />
+
=== Code Examples ===
 
<dpl>
 
<dpl>
 
  noresultsheader=\n
 
  noresultsheader=\n
 
  category=chmod
 
  category=chmod
 
  category=JFTP
 
  category=JFTP
  category=CodeExample
+
  namespace=CodeExample
 
  category=MethodExample
 
  category=MethodExample
 
  include=*
 
  include=*
 
  format= ,,,
 
  format= ,,,
 
</dpl>
 
</dpl>
 +
[[Category:Archived pages API16]]

Latest revision as of 20:38, 24 March 2017

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Method to change mode for a path on the FTP server


<! removed transcluded page call, red link never existed >

Syntax[edit]

chmod($path, $mode)
Parameter Name Default Value Description
$path $path Path to change mode on
$mode $mode Octal value to change mode to, e.g. '0777', 0777 or 511

Returns[edit]

boolean True if successful

Defined in[edit]

libraries/joomla/client/ftp.php

Importing[edit]

jimport( 'joomla.client.ftp' );

Source Body[edit]

function chmod($path, $mode) {

        // If no filename is given, we assume the current directory is the target
        if ($path == '') {
                $path = '.';
        }

        // Convert the mode to a string
        if (is_int($mode)) {
                $mode = decoct($mode);
        }

        // If native FTP support is enabled lets use it...
        if (FTP_NATIVE) {
                if (@ftp_site($this->_conn, 'CHMOD '.$mode.' '.$path) === false) {
                        if ($this->_OS != 'WIN') {
                                JError::raiseWarning('35', 'JFTP::chmod: Bad response');
                        }
                        return false;
                }
                return true;
        }

        // Send change mode command and verify success [must convert mode from octal]
        if (!$this->_putCmd('SITE CHMOD '.$mode.' '.$path, array(200, 250))) {
                if ($this->_OS != 'WIN') {
                        JError::raiseWarning('35', 'JFTP::chmod: Bad response', 'Server response: '.$this->_response.' [Expected: 200 or 250] Path sent: '.$path.' Mode sent: '.$mode);
                }
                return false;
        }
        return true;
}


<! removed transcluded page call, red link never existed >

Examples[edit]

Code Examples[edit]