Syntax of FS_CHMOD_DIR and FS_CHMOD_FILE

The basic syntax for define() is:

define ( $name, $value )

In the above definition, the value is:

( 0755 & ~ umask() )

The ‘&’ (ampersand) is the ‘And’ bitwise operator,
the ‘~’ (tilde) is the ‘Not’ bitwise operator, and
the umask() function returns the current umask.

To answer your question in short (if your are interested in learning bitwise operations, there are plenty of resources on that), the above “syntax” is in fact an operation, that substracts the current umask from the definition you provide.

So, for example, if you provide 0644 and the current umask is 0640, then the effective permissions set will be 640. Why or when would you do that? Well, you would in the cases where you want to specify certain permissions, but not being more permissive than the default umask.

Leave a Comment