API16

JPath/canChmod: Difference between revisions

From Joomla! Documentation

Doxiki (talk | contribs)
New page: ===Description=== Checks if a path's permissions can be changed <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowi...
 
m clean up
Line 2: Line 2:
Checks if a path's permissions can be changed
Checks if a path's permissions can be changed


<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JPath/canChmod|Edit Descripton]]<nowiki>]</nowiki>
</span>


{{Description:JPath/canChmod}}
 
{{subst:Description:JPath/canChmod}}


===Syntax===
===Syntax===
Line 47: Line 45:
</source>
</source>


<span class="editsection" style="font-size:76%;">
 
<nowiki>[</nowiki>[[SeeAlso:JPath/canChmod|Edit See Also]]<nowiki>]</nowiki>
{{subst:SeeAlso:JPath/canChmod}}
</span>
{{SeeAlso:JPath/canChmod}}


===Examples===
===Examples===

Revision as of 14:18, 24 March 2017

Description

Checks if a path's permissions can be changed


{{subst:Description:JPath/canChmod}}

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;
}


{{subst:SeeAlso:JPath/canChmod}}

Examples

<CodeExamplesForm />