| API | Package | Subpackage | Class | Method | Reference | Last reviewed | Doc status |
|---|---|---|---|---|---|---|---|
Home |
Joomla.Framework |
FileSystem |
JPath |
setPermissions |
setPermissions() |
Never | Work in Progress |
Changes permissions (using the PHP chmod function) on files and folders recursively to the specified permissions.
boolean setPermissions ( $path, $filemode, $foldermode )
| $path | string | is a string containing the root path to begin changing permissions [without trailing slash]. |
| $filemode | string | is a string containing an octal representation of the value to change file permissions to. Null indicates that no change will be made to file permissions. This parameter is optional and if omitted will default to ‘0644’. |
| $foldermode | string | is a string containing an octal representation of the value to change folder permissions to. Null indicates that no change will be made to folder permissions. This parameter is optional and if omitted will default to ‘0755’. |
Example
jimport( 'joomla.filesystem.path' ); if (JPath::setPermissions( JPATH_ROOT . '/libraries', '222' ) ) { echo "Permissions changed!"; } else { echo "Could not set permissions!"; }
might produce:
Result
Permissions changed!