@@ -62,7 +62,7 @@ |
||
62 | 62 | */ |
63 | 63 | public static function delete_metadata_hook($params) { |
64 | 64 | $path = $params[\OC\Files\Filesystem::signal_param_path]; |
65 | - if ($path<>'') { |
|
65 | + if ($path <> '') { |
|
66 | 66 | $hook = self::createForStaticLegacyCode(); |
67 | 67 | $hook->deleteBookMetadata($path); |
68 | 68 | } |
@@ -57,7 +57,7 @@ |
||
57 | 57 | |
58 | 58 | /** |
59 | 59 | * @param $fileId |
60 | - * @param $docId |
|
60 | + * @param string $docId |
|
61 | 61 | * @return bool |
62 | 62 | */ |
63 | 63 | public function insertBookID($fileId, $docId) { |
@@ -145,6 +145,10 @@ discard block |
||
145 | 145 | return new DataResponse($disscussionCount, Http::STATUS_OK); |
146 | 146 | } |
147 | 147 | |
148 | + /** |
|
149 | + * @param string $dir |
|
150 | + * @param string $filename |
|
151 | + */ |
|
148 | 152 | private function getBookIdforPath($dir, $filename){ |
149 | 153 | if (!empty($filename)) { |
150 | 154 | if($dir == '/') { |
@@ -185,7 +189,7 @@ discard block |
||
185 | 189 | * @NoAdminRequired |
186 | 190 | * |
187 | 191 | * @param string $bookID |
188 | - * @return string/boolean |
|
192 | + * @return string |
|
189 | 193 | */ |
190 | 194 | private function fetchDocument($bookID) { |
191 | 195 | $urlDocument = $this->paperhive_base_url . $this->paperhive_api_documents . $bookID; |
@@ -145,16 +145,16 @@ discard block |
||
145 | 145 | return new DataResponse($disscussionCount, Http::STATUS_OK); |
146 | 146 | } |
147 | 147 | |
148 | - private function getBookIdforPath($dir, $filename){ |
|
148 | + private function getBookIdforPath($dir, $filename) { |
|
149 | 149 | if (!empty($filename)) { |
150 | - if($dir == '/') { |
|
150 | + if ($dir == '/') { |
|
151 | 151 | $path = $dir . $filename; |
152 | 152 | } else { |
153 | 153 | $path = $dir . '/' . $filename; |
154 | 154 | } |
155 | 155 | |
156 | 156 | $fileInfo = $this->view->getFileInfo($path); |
157 | - if($fileInfo && $bookId = $this->paperHiveMetadata->getBookID($fileInfo['fileid'])) { |
|
157 | + if ($fileInfo && $bookId = $this->paperHiveMetadata->getBookID($fileInfo['fileid'])) { |
|
158 | 158 | return $bookId; |
159 | 159 | } |
160 | 160 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | // Save the file |
243 | 243 | $title = $paperHiveObject['metadata']['title']; |
244 | 244 | $filename = $title . $this->paperhive_file_extension; |
245 | - if($dir == '/') { |
|
245 | + if ($dir == '/') { |
|
246 | 246 | $path = $dir . $filename; |
247 | 247 | } else { |
248 | 248 | $path = $dir . '/' . $filename; |
@@ -250,26 +250,26 @@ discard block |
||
250 | 250 | |
251 | 251 | $exists = $this->view->file_exists($path); |
252 | 252 | if ($exists) { |
253 | - $message = (string) $this->l->t('The file already exists.'); |
|
253 | + $message = (string)$this->l->t('The file already exists.'); |
|
254 | 254 | return new DataResponse(['message' => $message], Http::STATUS_BAD_REQUEST); |
255 | 255 | } |
256 | 256 | |
257 | 257 | try { |
258 | 258 | $created = $this->view->touch($path); |
259 | - if(!$created) { |
|
260 | - $message = (string) $this->l->t('Could not save document.'); |
|
259 | + if (!$created) { |
|
260 | + $message = (string)$this->l->t('Could not save document.'); |
|
261 | 261 | return new DataResponse(['message' => $message], Http::STATUS_BAD_REQUEST); |
262 | 262 | } |
263 | 263 | |
264 | 264 | $fileInfo = $this->view->getFileInfo($path); |
265 | 265 | $inserted = $this->paperHiveMetadata->insertBookID($fileInfo['fileid'], $bookID); |
266 | - if(!$inserted) { |
|
266 | + if (!$inserted) { |
|
267 | 267 | $this->view->unlink($path); |
268 | - $message = (string) $this->l->t('Could not save document metadata.'); |
|
268 | + $message = (string)$this->l->t('Could not save document metadata.'); |
|
269 | 269 | return new DataResponse(['message' => $message], Http::STATUS_BAD_REQUEST); |
270 | 270 | } |
271 | 271 | } catch (LockedException $e) { |
272 | - $message = (string) $this->l->t('The file is locked.'); |
|
272 | + $message = (string)$this->l->t('The file is locked.'); |
|
273 | 273 | return new DataResponse(['message' => $message], Http::STATUS_BAD_REQUEST); |
274 | 274 | } catch (ForbiddenException $e) { |
275 | 275 | return new DataResponse(['message' => $e->getMessage()], Http::STATUS_BAD_REQUEST); |