You are here

protected function elFinderVolumeDrupal::_copy in elFinder file manager 8.2

Same name and namespace in other branches
  1. 6.2 inc/elfinder.drupalfs.driver.inc \elFinderVolumeDrupal::_copy()
  2. 7.3 inc/elfinder.drupalfs.driver.inc \elFinderVolumeDrupal::_copy()
  3. 7.2 inc/elfinder.drupalfs.driver.inc \elFinderVolumeDrupal::_copy()

Copy file into another file

@author Alexey Sukhotin

Parameters

string $source source file path:

string $targetDir target directory path:

string $name new file name:

Return value

bool

File

src/Controller/elFinderVolumeDrupal.php, line 130
elFinder driver for Drupal filesystem.

Class

elFinderVolumeDrupal
@file

Code

protected function _copy($source, $targetDir, $name) {
  $target = $targetDir . DIRECTORY_SEPARATOR . (!empty($name) ? $name : basename($source));
  if (!is_dir($target) && !$this
    ->CheckExtension($this
    ->_drupalfileobject($target))) {
    return FALSE;
  }
  if (!$this
    ->CheckUserQuota()) {
    return FALSE;
  }
  if (file_copy($this
    ->_drupalfileobject($source), $this
    ->drupalpathtouri($target))) {
    $this
      ->FileUsageAdd($this
      ->_drupalfileobject($target));
    return TRUE;
  }
  return FALSE;
}