public function exportLogsToCsv($query)
    {
        // Initialize variables
        $query['limit'] = self::CSV_LOG_BATCH;
        $query['page'] = 0;
        $count = 0;
        $total = 0;

        // Prepare CSV file
        $handle = fopen('php://output', 'w+');
        fputcsv($handle, [
            $this->translator->trans('date', [], 'platform'),
            $this->translator->trans('action', [], 'platform'),
            $this->translator->trans('user', [], 'platform'),
            $this->translator->trans('description', [], 'platform'),
        ], ';', '"');

        // Get batched logs
        while ($count === 0 || $count < $total) {
            $logs = $logs = $this->finder->search('Claroline\CoreBundle\Entity\Log\Log', $query, []);
            $total = $logs['totalResults'];
            $count += self::CSV_LOG_BATCH;
            ++$query['page'];

            foreach ($logs['data'] as $log) {
                fputcsv($handle, [
                    $log['dateLog'],
                    $log['action'],
                    $log['doer'] ? $log['doer']['name'] : '',
                    $this->ut->html2Csv($log['description'], true),
                ], ';', '"');
            }

            $this->om->clear('Claroline\CoreBundle\Entity\Log\Log');
        }

        fclose($handle);

        return $handle;
    }
public function exportLogsToCsv($query)
    {
        // Initialize variables
        $query['limit'] = self::CSV_LOG_BATCH;
        $query['page'] = 0;
        $count = 0;
        $total = 0;

        // Prepare CSV file
        $handle = fopen('php://output', 'w+');
        fputcsv($handle, [
            $this->translator->trans('date', [], 'platform'),
            $this->translator->trans('action', [], 'platform'),
            $this->translator->trans('user', [], 'platform'),
            $this->translator->trans('description', [], 'platform'),
        ], ';', '"');

        // Get batched logs
        while ($count === 0 || $count < $total) {
            $logs = $logs = $this->finder->search('Claroline\CoreBundle\Entity\Log\Log', $query, []);
            $total = $logs['totalResults'];
            $count += self::CSV_LOG_BATCH;
            ++$query['page'];

            foreach ($logs['data'] as $log) {
                fputcsv($handle, [
                    $log['dateLog'],
                    $log['action'],
                    $log['doer'] ? $log['doer']['name'] : '',
                    $this->ut->html2Csv($log['description'], true),
                ], ';', '"');
            }

            $this->om->clear('Claroline\CoreBundle\Entity\Log\Log');
        }

        fclose($handle);

        return $handle;
    }
public function exportLogsToCsv ( $ query ) { // Initialize variables $ query [ 'limit' ] = self :: CSV_LOG_BATCH ; $ query [ 'page' ] = 0 ; $ count = 0 ; $ total = 0 ; // Prepare CSV file $ handle = fopen ( 'php://output' , 'w+' ) ; fputcsv ( $ handle , [ $ this -> translator -> trans ( 'date' , [ ] , 'platform' ) , $ this -> translator -> trans ( 'action' , [ ] , 'platform' ) , $ this -> translator -> trans ( 'user' , [ ] , 'platform' ) , $ this -> translator -> trans ( 'description' , [ ] , 'platform' ) , ] , ';' , '"' ) ; // Get batched logs while ( $ count === 0 || $ count < $ total ) { $ logs = $ logs = $ this -> finder -> search ( 'Claroline\CoreBundle\Entity\Log\Log' , $ query , [ ] ) ; $ total = $ logs [ 'totalResults' ] ; $ count += self :: CSV_LOG_BATCH ; ++ $ query [ 'page' ] ; foreach ( $ logs [ 'data' ] as $ log ) { fputcsv ( $ handle , [ $ log [ 'dateLog' ] , $ log [ 'action' ] , $ log [ 'doer' ] ? $ log [ 'doer' ] [ 'name' ] : '' , $ this -> ut -> html2Csv ( $ log [ 'description' ] , true ) , ] , ';' , '"' ) ; } $ this -> om -> clear ( 'Claroline\CoreBundle\Entity\Log\Log' ) ; } fclose ( $ handle ) ; return $ handle ; }
Given a query params, it exports all logs to a CSV file.

@param $query

@return bool|resource
Given a query params it exports all logs to a CSV file .