webCOMAND

util::chmod()

Change permissions on a file or folder, including any contained files and subfolders recursively.

Prototype

chmod(string $path, int $permisions, bool $ismask = FALSE, bool $force = FALSE)

Parameters

  • path - The fully qualified path to a file or directory to delete.
  • permissions - The permissions to set on the folder(s) and/or file(s), typically expressed as an octal number (i.e. 0755), like PHP chmod().
  • is_mask - If TRUE, the permissions will add to those already set on matching folders/files.
  • force - If TRUE, the permissions will be updated on files and folders, even they are outside the configured webCOMAND Files, System and Temp folders.

Exceptions

The function will throw an exception if the path, files and subfolders cannot be modified.

Example

// recursively update the permissions of a folder under webCOMAND's Files path
try {
    \io_comand_file\util\chmod('/var/www/webcomand/files/test', 0755, TRUE);
} catch(\exception $e) {
    \comand::log_error("Could not update test dir: " . $e->getMessage());
}

Related

chown()