You are here

protected function elFinderVolumeDrupal::_drupalfileobject in elFinder file manager 6.2

Same name and namespace in other branches
  1. 8.2 src/Controller/elFinderVolumeDrupal.php \elFinderVolumeDrupal::_drupalfileobject()
  2. 7.3 inc/elfinder.drupalfs.driver.inc \elFinderVolumeDrupal::_drupalfileobject()
  3. 7.2 inc/elfinder.drupalfs.driver.inc \elFinderVolumeDrupal::_drupalfileobject()

* Create Drupal file object * *

Parameters

string $path file path: * @return object * @author Alexey Sukhotin *

9 calls to elFinderVolumeDrupal::_drupalfileobject()
elFinderVolumeDrupal::desc in inc/elfinder.drupalfs.driver.inc
elFinderVolumeDrupal::downloadcount in inc/elfinder.drupalfs.driver.inc
elFinderVolumeDrupal::DrupalDBAdd in inc/elfinder.drupalfs.driver.inc
elFinderVolumeDrupal::owner in inc/elfinder.drupalfs.driver.inc
elFinderVolumeDrupal::_archive in inc/elfinder.drupalfs.driver.inc

... See full list

File

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

Class

elFinderVolumeDrupal
elFinder driver for Drupal 6 filesystem.

Code

protected function _drupalfileobject($path) {
  global $user;
  $filepath = $this
    ->_relpathdrupal($path);
  $result = db_query("SELECT * FROM {files} f WHERE f.filepath = '%s'", $filepath);
  $file = db_fetch_object($result);
  if (!isset($file->fid)) {
    $file = new StdClass();
    $file->uid = $user->uid;
    $file->filename = basename($filepath);
    $file->filepath = $filepath;
    $file->filemime = file_get_mimetype($path);
    $file->filesize = is_readable($path) ? (int) filesize($path) : 0;
    $file->timestamp = time();
    $file->status = FILE_STATUS_PERMANENT;
  }
  return $file;
}