1<?php 2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project 3// 4// All Rights Reserved. See copyright.txt for details and a complete list of authors. 5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. 6// $Id$ 7 8namespace Tiki\Command; 9 10use Symfony\Component\Console\Command\Command; 11use Symfony\Component\Console\Input\InputInterface; 12use Symfony\Component\Console\Output\OutputInterface; 13 14 15class OCRStatusCommand extends Command 16{ 17 protected function configure() 18 { 19 $this 20 ->setName('ocr:status') 21 ->setDescription('Give statistics on file OCR status (Queued, Processing, Finished, Skipped)'); 22 } 23 24 protected function execute(InputInterface $input, OutputInterface $output) 25 { 26 $ocrLib = \TikiLib::lib('ocr'); 27 28 //Retrieve the number of files marked as waiting to be processed. 29 $count = $ocrLib->table('tiki_files')->fetchCount( 30 ['ocr_state' => $ocrLib::OCR_STATUS_PENDING] 31 ); 32 $output->writeln("Queued files: $count"); 33 34 $count = $ocrLib->table('tiki_files')->fetchCount( 35 ['ocr_state' => $ocrLib::OCR_STATUS_STALLED] 36 ); 37 $output->writeln("Stalled files: $count"); 38 39 $count = $ocrLib->table('tiki_files')->fetchCount( 40 ['ocr_state' => $ocrLib::OCR_STATUS_PROCESSING] 41 ); 42 $output->writeln("Processing files: $count"); 43 44 $count = $ocrLib->table('tiki_files')->fetchCount( 45 ['ocr_state' => $ocrLib::OCR_STATUS_FINISHED] 46 ); 47 $output->writeln("Finished files: $count"); 48 49 $count = $ocrLib->table('tiki_files')->fetchCount( 50 ['ocr_state' => $ocrLib::OCR_STATUS_SKIP] 51 ); 52 $output->writeln("Will not OCR: $count"); 53 54 } 55} 56