You are here

protected function elFinderVolumeDrupal::_copy in elFinder file manager 6.2

Same name and namespace in other branches
  1. 8.2 src/Controller/elFinderVolumeDrupal.php \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 * *

Parameters

string $source source file path: * @param string $targetDir target directory path * @param string $name new file name * @return bool * @author Alexey Sukhotin *

File

inc/elfinder.drupalfs.driver.inc, line 131

Class

elFinderVolumeDrupal
elFinder driver for Drupal 6 filesystem.

Code

protected function _copy($source, $targetDir, $name) {
  $sourceFile = $this
    ->_drupalfileobject($source);
  $destFile = $sourceFile;
  $destFile->filepath = $this
    ->_relpathdrupal($targetDir) . DIRECTORY_SEPARATOR . $destFile->filename;
  $destFile->timestamp = time();
  if (!$this
    ->CheckExtension($destFile)) {
    return FALSE;
  }
  if (!$this
    ->CheckUserQuota()) {
    return FALSE;
  }
  if (file_copy($sourceFile, $targetDir)) {
    if (drupal_write_record('files', $destFile) != 0) {
      return TRUE;
    }
  }
  return FALSE;
}