WP_Filesystem_ftpsockets::exists() – Checks if a file or directory exists.

You appear to be a bot. Output may be restricted

Description

Checks if a file or directory exists.

Usage

$bool = WP_Filesystem_ftpsockets::exists( $path );

Parameters

$path
( string ) required – Path to file or directory.

Returns

bool Whether $path exists or not.

Source

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


Lines:

1 to 11 of 11
  public function exists( $path ) {
    $list = $this->ftp->nlist( $path );

    if ( empty( $list ) && $this->WP_Filesystem_ftpsockets::is_dir( $path ) ) {
      return true; // File is an empty directory.
    }

    return ! empty( $list ); // Empty list = no file, so invert.
    // Return $this->ftp->is_exists($file); has issues with ABOR+426 responses on the ncFTPd server.
  }
 

 View on GitHub View on Trac