API16

API16:JPath/canChmod

From Joomla! Documentation

Revision as of 22:47, 22 March 2010 by 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...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

Checks if a path's permissions can be changed

[Edit Descripton]

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

[Edit See Also] Template:SeeAlso:JPath/canChmod

Examples

<CodeExamplesForm />