public function elFinderVolumeDrupal::downloadcount in elFinder file manager 7.2
Same name and namespace in other branches
- 8.2 src/Controller/elFinderVolumeDrupal.php \elFinderVolumeDrupal::downloadcount()
- 6.2 inc/elfinder.drupalfs.driver.inc \elFinderVolumeDrupal::downloadcount()
- 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;
}