I am looking for a way in PHP to detect the mode of a file prior to making mode changes to it.
I would like to perform the following (in pseudocode):
if (fileMode == "644") {
chmod(fileName, 0775);
make changes here
chmod(fileName, 0664);
else
do nothing
end if
I realize that this requires certain permissions to do this, so I also need assistance in determining what the PHP script's permissions are, so I can set them properly prior to running.