WP_Filesystem_Direct::getchmod
Gets the permissions of the specified file or filepath in their octal format.
Method of the class: WP_Filesystem_Direct{}
No Hooks.
Returns
String. Mode of the file (the last 3 digits), or the string "0" on failure.
Usage
$WP_Filesystem_Direct = new WP_Filesystem_Direct(); $WP_Filesystem_Direct->getchmod( $file );
- $file(string) (required)
- Path to the file.
Changelog
| Since 2.5.0 | Introduced. |
WP_Filesystem_Direct::getchmod() WP Filesystem Direct::getchmod code WP 7.0
public function getchmod( $file ) {
$perms = @fileperms( $file );
if ( false === $perms ) {
return '0';
}
return substr( decoct( $perms ), -3 );
}