You are here

public function elFinderVolumeDrupal::downloadcount in elFinder file manager 7.2

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

File

inc/elfinder.drupalfs.driver.inc, line 435
elFinder driver for Drupal filesystem.

Class

elFinderVolumeDrupal
@file

Code

public function downloadcount($target) {
  $path = $this
    ->decode($target);
  $file = $this
    ->_drupalfileobject($path);
  if ($file->fid && module_exists('elfinder_stats')) {
    $downloads = db_select('elfinder_stats', 's')
      ->fields('s', array(
      'fid',
    ))
      ->condition('s.fid', $file->fid)
      ->condition('s.type', 'download')
      ->countQuery()
      ->execute()
      ->fetchField();
    return $downloads ? $downloads : 0;
  }
  return 0;
}