function logUsageEvent($hookName, $args)
{
$hookName = $args[0];
$usageEvent = $args[1];
// Check the statistics opt-out.
if ($this->_optedOut) {
return false;
}
if ($hookName == 'FileManager::downloadFileFinished' && !$usageEvent && $this->_currentUsageEvent) {
// File download is finished, try to log the current usage event.
$downloadSuccess = $args[2];
if ($downloadSuccess && !connection_aborted()) {
$this->_currentUsageEvent['downloadSuccess'] = true;
$usageEvent = $this->_currentUsageEvent;
}
}
if ($usageEvent && !$usageEvent['downloadSuccess']) {
// Don't log until we get the download finished hook call.
$this->_currentUsageEvent = $usageEvent;
return false;
}
if ($usageEvent) {
$this->_writeUsageEventInLogFile($usageEvent);
}
return false;
}