You are here

public function elFinderVolumeDrupal::downloadcount in elFinder file manager 6.2

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

File

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

Class

elFinderVolumeDrupal
elFinder driver for Drupal 6 filesystem.

Code

public function downloadcount($target) {
  $path = $this
    ->decode($target);
  $file = $this
    ->_drupalfileobject($path);
  if ($file->fid && module_exists('elfinder_stats')) {
    $downloads = db_result(db_query("SELECT count(*) FROM {elfinder_stats} WHERE fid = '%d' AND `type` = '%s'", $file->fid, 'download'));
    return isset($downloads) ? $downloads : 0;
  }
  return 0;
}