WP_Filesystem_FTPext::copy() – Copies a file.

You appear to be a bot. Output may be restricted

Description

Copies a file.

Usage

$bool = WP_Filesystem_FTPext::copy( $source, $destination, $overwrite, $mode );

Parameters

$source
( string ) required – Path to the source file.
$destination
( string ) required – Path to the destination file.
$overwrite
( bool ) optional – Optional. Whether to overwrite the destination file if it exists. Default false.
$mode
( int|false ) optional – Optional. The permissions as octal number, usually 0644 for files,

  1. for dirs. Default false.

Returns

bool True on success, false on failure.

Source

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

1 to 13 of 13
  public function copy( $source, $destination, $overwrite = false, $mode = false ) {
    if ( ! $overwrite && $this->WP_Filesystem_FTPext::exists( $destination ) ) {
      return false;
    }

    $content = $this->WP_Filesystem_FTPext::get_contents( $source );

    if ( false === $content ) {
      return false;
    }

    return $this->WP_Filesystem_FTPext::put_contents( $destination, $content, $mode );
  }
 

 View on GitHub View on Trac