Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Filesystem.php

function Filesystem::copyThenRemove

Copy then delete is a non-atomic version of {@link rename}.

Some systems can't rename and also don't have proc_open, which requires this solution.

Return value

void

1 call to Filesystem::copyThenRemove()
Filesystem::rename in vendor/composer/composer/src/Composer/Util/Filesystem.php

File

vendor/composer/composer/src/Composer/Util/Filesystem.php, line 348

Class

Filesystem
@author Jordi Boggiano <j.boggiano@seld.be> @author Johannes M. Schmitt <schmittjoh@gmail.com>

Namespace

Composer\Util

Code

public function copyThenRemove(string $source, string $target) {
    $this->copy($source, $target);
    if (!is_dir($source)) {
        $this->unlink($source);
        return;
    }
    $this->removeDirectoryPhp($source);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal