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( $file );

Parameters

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

Returns

bool Whether $file exists or not.

Source

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

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

    if ( empty( $list ) && $this->WP_Filesystem_ftpsockets::is_dir( $file ) ) {
      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