Completed
Pull Request — master (#6)
by Janis
340:04 queued 336:33
created
lib/Service/OcrService.php 1 patch
Braces   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 			} else {
122 122
 				throw new NotFoundException('No languages found.');
123 123
 			}
124
-		}catch(Exception $e){
124
+		} catch(Exception $e){
125 125
 			$this->handleException($e);
126 126
 		}
127 127
 	}
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 					// set the gearman running type
154 154
 					if($fInfo->getMimetype() == $this::MIMETYPE_PDF){
155 155
 						$ftype = 'mypdf';
156
-					}else{
156
+					} else{
157 157
 						$ftype = 'tess';
158 158
 					}
159 159
 
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
 					$this->sendGearmanJob($ftype, $this->config->getSystemValue('datadirectory'), $fInfo->getPath(), $tempFile, $language, $status, \OC::$SERVERROOT);
166 166
 				}
167 167
 				return 'PROCESSING';
168
-			}else{
168
+			} else{
169 169
 				throw new NotFoundException('Empty parameters.');
170 170
 			}
171
-		}catch(Exception $e){
171
+		} catch(Exception $e){
172 172
 			$this->handleException($e);
173 173
 		}
174 174
 	}
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 			$pending = count($this->statusMapper->findAllPending($this->userId));
190 190
 
191 191
 			return ['processed' => $processed, 'failed' => $failed, 'pending' => $pending];
192
-		}catch (Exception $e){
192
+		} catch (Exception $e){
193 193
 			$this->handleException($e);
194 194
 		}
195 195
 	}
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 			if(!$failed) {
208 208
 				$status->setStatus('PROCESSED');
209 209
 				$this->statusMapper->update($status);
210
-			}else{
210
+			} else{
211 211
 				$status->setStatus('FAILED');
212 212
 				$this->statusMapper->update($status);
213 213
 			}
@@ -243,12 +243,12 @@  discard block
 block discarded – undo
243 243
 					$this->view->file_put_contents($status->getNewName(), file_get_contents($status->getTempFile()));// don't need to extend with .pdf / it uses the tmp file to save
244 244
 					$this->statusMapper->delete($status);
245 245
 					exec('rm ' . $status->getTempFile());
246
-				}else{
246
+				} else{
247 247
 					throw new NotFoundException('Temp file does not exist.');
248 248
 				}
249 249
 			}
250 250
 			return count($processed);
251
-		}catch (Exception $e){
251
+		} catch (Exception $e){
252 252
 			$this->handleException($e);
253 253
 		}
254 254
 	}
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 			}
270 270
 			$this->logger->debug('Following status objects failed: '.json_encode($failed), ['app' => 'ocr']);
271 271
 			return $failed;
272
-		}catch (Exception $e){
272
+		} catch (Exception $e){
273 273
 			$this->handleException($e);
274 274
 		}
275 275
 	}
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 					if(empty($file['path'])){ $file['path'] = $file['directory']; } //Because new updated files have the property directory instead of path
314 314
 					if($file['path'] == '/'){
315 315
 						$path = ''. '/' . $file['name'];
316
-					}else{
316
+					} else{
317 317
 						$path = $file['path']. '/' . $file['name'];
318 318
 					}
319 319
 					$fileInfo = $this->view->getFileInfo($path);
Please login to merge, or discard this patch.
lib/Command/CompleteOCR.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 		try{
72 72
 			if($failed == 'false'){
73 73
 				$failed = false;
74
-			}elseif ($failed == 'true'){
74
+			} elseif ($failed == 'true'){
75 75
 				$failed = true;
76
-			}else{
76
+			} else{
77 77
 				throw new ServiceException('Wrong Arguments.');
78 78
 			}
79 79
 			$this->ocrService->complete($statusId, $failed);
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 				$output->writeln('<error>Could not complete ocr for status id ' . $statusId .
83 83
 					': ' . $e->getMessage() .
84 84
 					'</error> ');
85
-			}else{
85
+			} else{
86 86
 				$output->writeln('<error>Unexpected error for status id ' . $statusId .
87 87
 					': ' . $e->getMessage() .
88 88
 					'</error> ');
Please login to merge, or discard this patch.
worker/GearmanOCRWorker.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
 		if ($success == 0 && !isset($_out[1])) {
17 17
 			//occ command which puts the file and cleans the tempfile
18 18
 			exec('php '.$workload->occdir.'/occ ocr:complete '.$workload->statusid.' false');
19
-		}else{
19
+		} else{
20 20
 			//update status failed.
21 21
 			exec('php '.$workload->occdir.'/occ ocr:complete '.$workload->statusid.' true');
22 22
 		}
23
-	}else{
23
+	} else{
24 24
 		//ocrmypdf
25 25
 		$command = 'ocrmypdf "' . $workload->datadirectory . $workload->path . '" "' . $workload->tempfile . '" -l ' . $workload->language . ' --skip-text';
26 26
 		$success = -1;
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 		if ($success == 0 && !isset($_out[0])) {
30 30
 			//occ command which puts the file and cleans the tempfile
31 31
 			exec('php '.$workload->occdir.'/occ ocr:complete '.$workload->statusid.' false');
32
-		}else{
32
+		} else{
33 33
 			//update status failed.
34 34
 			exec('php '.$workload->occdir.'/occ ocr:complete '.$workload->statusid.' true');
35 35
 		}
Please login to merge, or discard this patch.