JPath/canChmod: Difference between revisions
From Joomla! Documentation
m clean up |
m preparing for archive only |
||
Line 4: | Line 4: | ||
===Syntax=== | ===Syntax=== | ||
Line 46: | Line 46: | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=canChmod | category=canChmod | ||
category=JPath | category=JPath | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> |
Latest revision as of 01:58, 25 March 2017
Description
Checks if a path's permissions can be changed
Syntax
canChmod($path)
Parameter Name | Default Value | Description |
---|---|---|
$path | $path Path to check |
Returns
boolean True if path can have mode changed
Defined in
libraries/joomla/filesystem/path.php
Importing
jimport( 'joomla.filesystem.path' );
Source Body
function canChmod($path)
{
$perms = fileperms($path);
if ($perms !== false)
{
if (@ chmod($path, $perms ^ 0001))
{
@chmod($path, $perms);
return true;
}
}
return false;
}
Examples
Code Examples