WP_Filesystem_Direct::mkdir() – Creates a directory.

You appear to be a bot. Output may be restricted

Description

Creates a directory.

Usage

$bool = WP_Filesystem_Direct::mkdir( $path, $chmod, $chown, $chgrp );

Parameters

$path
( string ) required – Path for new directory.
$chmod
( int|false ) optional – Optional. The permissions as octal number (or false to skip chmod). Default false.
$chown
( string|int|false ) optional – Optional. A user name or number (or false to skip chown). Default false.
$chgrp
( string|int|false ) optional – Optional. A group name or number (or false to skip chgrp). Default false.

Returns

bool True on success, false on failure.

Source

File name: wordpress/wp-admin/includes/class-wp-filesystem-direct.php
Lines:

1 to 28 of 28
  public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) {
    // Safe mode fails with a trailing slash under certain PHP versions.
    $path = untrailingslashit( $path );

    if ( empty( $path ) ) {
      return false;
    }

    if ( ! $chmod ) {
      $chmod = FS_CHMOD_DIR;
    }

    if ( ! @mkdir( $path ) ) {
      return false;
    }

    $this->WP_Filesystem_Direct::chmod( $path, $chmod );

    if ( $chown ) {
      $this->WP_Filesystem_Direct::chown( $path, $chown );
    }

    if ( $chgrp ) {
      $this->WP_Filesystem_Direct::chgrp( $path, $chgrp );
    }

    return true;
  }
 

 View on GitHub View on Trac