API16:JStream/chmod
From Joomla! Documentation
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.
Contents |
Description
chmod wrapper
Syntax
chmod($filename='', $mode=0)
| Parameter Name | Default Value | Description |
|---|---|---|
| $filename | Mode to use | |
| $mode | 0 |
Defined in
libraries/joomla/filesystem/stream.php
Importing
jimport( 'joomla.filesystem.stream' );
Source Body
function chmod($filename='', $mode=0) { if(!$filename) { if(!isset($this->filename) || !$this->filename) { $this->setError(JText::_('Filename not set')); return false; } $filename = $this->filename; } // if no mode is set use the default if(!$mode) $mode = $this->filemode; $retval = false; // Capture PHP errors $php_errormsg = ''; $track_errors = ini_get('track_errors'); ini_set('track_errors', true); $sch = parse_url($filename, PHP_URL_SCHEME); // scheme specific options; ftp's chmod support is fun switch($sch) { case 'ftp': case 'ftps': $res = JFilesystemHelper::ftpChmod($filename, $mode); break; default: //echo '<p>Chmodding '. $filename . ' with ' . decoct($mode) .'</p>'; $res = chmod($filename, $mode); break; } // seek, interestingly returns 0 on success or -1 on failure if(!$res) { $this->setError($php_errormsg); } else { $retval = true; } // restore error tracking to what it was before ini_set('track_errors',$track_errors); // return the result return $retval; }
[Edit See Also] SeeAlso:JStream/chmod
Examples
<CodeExamplesForm />
