@@ -18,8 +18,8 @@ |
||
| 18 | 18 | * it's instantiated in there |
| 19 | 19 | */ |
| 20 | 20 | return [ |
| 21 | - 'routes' => [ |
|
| 21 | + 'routes' => [ |
|
| 22 | 22 | ['name' => 'ocr#process', 'url' => '/process', 'verb' => 'GET'], |
| 23 | 23 | ['name' => 'ocr#languages', 'url' => '/languages', 'verb' => 'GET'], |
| 24 | - ] |
|
| 24 | + ] |
|
| 25 | 25 | ]; |
| 26 | 26 | \ No newline at end of file |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | $this->service = $service; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @NoAdminRequired |
|
| 51 | - * |
|
| 52 | - * @return Template |
|
| 53 | - */ |
|
| 49 | + /** |
|
| 50 | + * @NoAdminRequired |
|
| 51 | + * |
|
| 52 | + * @return Template |
|
| 53 | + */ |
|
| 54 | 54 | public function displayPanel() { |
| 55 | 55 | $tmpl = new Template('ocr', 'settings-personal'); |
| 56 | 56 | return $tmpl; |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function getAll() { |
| 65 | 65 | return $this->handleNotFound(function () { |
| 66 | - return $this->service->getAllForPersonal($this->userId); |
|
| 66 | + return $this->service->getAllForPersonal($this->userId); |
|
| 67 | 67 | }); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -41,16 +41,16 @@ |
||
| 41 | 41 | return $this->findEntity($sql, [$id]); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Finds all user specific status entities |
|
| 46 | - * |
|
| 47 | - * @param $userId |
|
| 48 | - * @return OcrStatus[] |
|
| 49 | - */ |
|
| 50 | - public function findAll($userId) { |
|
| 51 | - $sql = 'SELECT * FROM *PREFIX*ocr_status WHERE user_id = ?'; |
|
| 52 | - return $this->findEntities($sql, [$userId]); |
|
| 53 | - } |
|
| 44 | + /** |
|
| 45 | + * Finds all user specific status entities |
|
| 46 | + * |
|
| 47 | + * @param $userId |
|
| 48 | + * @return OcrStatus[] |
|
| 49 | + */ |
|
| 50 | + public function findAll($userId) { |
|
| 51 | + $sql = 'SELECT * FROM *PREFIX*ocr_status WHERE user_id = ?'; |
|
| 52 | + return $this->findEntities($sql, [$userId]); |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * Finds all status PROCESSED entities for a given userid |
@@ -72,9 +72,9 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | - * TODO: in the future this function could be used to give an admin information |
|
| 75 | + * TODO: in the future this function could be used to give an admin information |
|
| 76 | 76 | * Counts the messages in the message queue. |
| 77 | - * |
|
| 77 | + * |
|
| 78 | 78 | * @return mixed |
| 79 | 79 | */ |
| 80 | 80 | public function countMessages() { |
@@ -87,13 +87,13 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * TODO: in the future this function could be used to give an admin information |
|
| 92 | - * Counts the at this point processed files |
|
| 93 | - * |
|
| 94 | - * @return mixed |
|
| 95 | - */ |
|
| 96 | - public function countActiveProcesses() { |
|
| 90 | + /** |
|
| 91 | + * TODO: in the future this function could be used to give an admin information |
|
| 92 | + * Counts the at this point processed files |
|
| 93 | + * |
|
| 94 | + * @return mixed |
|
| 95 | + */ |
|
| 96 | + public function countActiveProcesses() { |
|
| 97 | 97 | try { |
| 98 | 98 | $stats = msg_stat_queue($this->statusqueue); |
| 99 | 99 | $this->logger->debug('Current active processing count: ' . json_encode($stats['msg_qnum']), ['app' => 'ocr']); |
@@ -73,13 +73,13 @@ |
||
| 73 | 73 | /** |
| 74 | 74 | * OcrStatus constructor. |
| 75 | 75 | * |
| 76 | - * @param null $status |
|
| 77 | - * @param null $source |
|
| 78 | - * @param null $target |
|
| 76 | + * @param string $status |
|
| 77 | + * @param string $source |
|
| 78 | + * @param string $target |
|
| 79 | 79 | * @param null $tempFile |
| 80 | - * @param null $type |
|
| 80 | + * @param string $type |
|
| 81 | 81 | * @param null $userId |
| 82 | - * @param null $errorDisplayed |
|
| 82 | + * @param boolean $errorDisplayed |
|
| 83 | 83 | */ |
| 84 | 84 | public function __construct($status = null, $source = null, $target = null, $tempFile = null, $type = null, $userId = null, $errorDisplayed = null) { |
| 85 | 85 | $this->setStatus($status); |
@@ -91,24 +91,24 @@ |
||
| 91 | 91 | $this->setErrorDisplayed($errorDisplayed); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - /** |
|
| 95 | - * Specify data which should be serialized to JSON |
|
| 96 | - * @link http://php.net/manual/en/jsonserializable.jsonserialize.php |
|
| 97 | - * @return mixed data which can be serialized by <b>json_encode</b>, |
|
| 98 | - * which is a value of any type other than a resource. |
|
| 99 | - * @since 5.4.0 |
|
| 100 | - */ |
|
| 101 | - function jsonSerialize() |
|
| 102 | - { |
|
| 103 | - return [ |
|
| 104 | - 'id' => $this->id, |
|
| 105 | - 'status' => $this->status, |
|
| 106 | - 'source' => $this->source, |
|
| 107 | - 'target' => $this->target, |
|
| 108 | - 'tempFile' => $this->tempFile, |
|
| 109 | - 'type' => $this->type, |
|
| 110 | - 'userId' => $this->userId, |
|
| 111 | - 'errorDisplayed' => $this->errorDisplayed |
|
| 112 | - ]; |
|
| 113 | - } |
|
| 94 | + /** |
|
| 95 | + * Specify data which should be serialized to JSON |
|
| 96 | + * @link http://php.net/manual/en/jsonserializable.jsonserialize.php |
|
| 97 | + * @return mixed data which can be serialized by <b>json_encode</b>, |
|
| 98 | + * which is a value of any type other than a resource. |
|
| 99 | + * @since 5.4.0 |
|
| 100 | + */ |
|
| 101 | + function jsonSerialize() |
|
| 102 | + { |
|
| 103 | + return [ |
|
| 104 | + 'id' => $this->id, |
|
| 105 | + 'status' => $this->status, |
|
| 106 | + 'source' => $this->source, |
|
| 107 | + 'target' => $this->target, |
|
| 108 | + 'tempFile' => $this->tempFile, |
|
| 109 | + 'type' => $this->type, |
|
| 110 | + 'userId' => $this->userId, |
|
| 111 | + 'errorDisplayed' => $this->errorDisplayed |
|
| 112 | + ]; |
|
| 113 | + } |
|
| 114 | 114 | } |
| 115 | 115 | \ No newline at end of file |
@@ -252,6 +252,7 @@ discard block |
||
| 252 | 252 | * The PersonalSettingsController will have the opportunity to delete ocr status objects. |
| 253 | 253 | * |
| 254 | 254 | * @param $statusId |
| 255 | + * @param string $userId |
|
| 255 | 256 | * @return OcrStatus |
| 256 | 257 | */ |
| 257 | 258 | public function deleteStatus($statusId, $userId) { |
@@ -281,7 +282,7 @@ discard block |
||
| 281 | 282 | /** |
| 282 | 283 | * Gets all status objects for a specific user in order to list them on the personal settings page. |
| 283 | 284 | * |
| 284 | - * @param $userId |
|
| 285 | + * @param string $userId |
|
| 285 | 286 | * @return array |
| 286 | 287 | */ |
| 287 | 288 | public function getAllForPersonal($userId) { |
@@ -429,7 +430,7 @@ discard block |
||
| 429 | 430 | |
| 430 | 431 | /** |
| 431 | 432 | * @param File $fileInfo |
| 432 | - * @return bool |
|
| 433 | + * @return boolean|null |
|
| 433 | 434 | */ |
| 434 | 435 | private function checkSharedWithInitiator($fileInfo) { |
| 435 | 436 | try { |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | try { |
| 213 | 213 | // TODO: release lock |
| 214 | 214 | |
| 215 | - // returns user specific processed files |
|
| 215 | + // returns user specific processed files |
|
| 216 | 216 | $processed = $this->handleProcessed(); |
| 217 | 217 | |
| 218 | 218 | $pending = $this->statusMapper->findAllPending($this->userId); |
@@ -263,18 +263,18 @@ discard block |
||
| 263 | 263 | $status = $this->statusMapper->delete($status); |
| 264 | 264 | } |
| 265 | 265 | $status->setTarget($this->removeFileExtension($status)); |
| 266 | - $status->setSource(null); |
|
| 267 | - $status->setTempFile(null); |
|
| 268 | - $status->setType(null); |
|
| 269 | - $status->setErrorDisplayed(null); |
|
| 266 | + $status->setSource(null); |
|
| 267 | + $status->setTempFile(null); |
|
| 268 | + $status->setType(null); |
|
| 269 | + $status->setErrorDisplayed(null); |
|
| 270 | 270 | return $status; |
| 271 | 271 | } catch (Exception $e) { |
| 272 | - if ($e instanceof DoesNotExistException) { |
|
| 273 | - $ex = new NotFoundException($this->l10n->t('Cannot delete. Wrong id.')); |
|
| 274 | - $this->handleException($ex); |
|
| 275 | - } else { |
|
| 276 | - $this->handleException($e); |
|
| 277 | - } |
|
| 272 | + if ($e instanceof DoesNotExistException) { |
|
| 273 | + $ex = new NotFoundException($this->l10n->t('Cannot delete. Wrong id.')); |
|
| 274 | + $this->handleException($ex); |
|
| 275 | + } else { |
|
| 276 | + $this->handleException($e); |
|
| 277 | + } |
|
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | 280 | |
@@ -285,9 +285,9 @@ discard block |
||
| 285 | 285 | * @return array |
| 286 | 286 | */ |
| 287 | 287 | public function getAllForPersonal($userId) { |
| 288 | - try { |
|
| 289 | - $status = $this->statusMapper->findAll($userId); |
|
| 290 | - $statusNew = array(); |
|
| 288 | + try { |
|
| 289 | + $status = $this->statusMapper->findAll($userId); |
|
| 290 | + $statusNew = array(); |
|
| 291 | 291 | for ($x = 0; $x < count($status); $x++) { |
| 292 | 292 | $newName = $this->removeFileExtension($status[$x]); |
| 293 | 293 | $status[$x]->setTarget($newName); |
@@ -297,11 +297,11 @@ discard block |
||
| 297 | 297 | $status[$x]->setErrorDisplayed(null); |
| 298 | 298 | array_push($statusNew, $status[$x]); |
| 299 | 299 | } |
| 300 | - return $statusNew; |
|
| 301 | - } catch (Exception $e) { |
|
| 302 | - $this->handleException($e); |
|
| 303 | - } |
|
| 304 | - } |
|
| 300 | + return $statusNew; |
|
| 301 | + } catch (Exception $e) { |
|
| 302 | + $this->handleException($e); |
|
| 303 | + } |
|
| 304 | + } |
|
| 305 | 305 | |
| 306 | 306 | /** |
| 307 | 307 | * Returns a not existing file name for pdf or image processing |