From d025569f5e4c21ecfc251c95642640d35d9169a1 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Mon, 15 Jul 2019 14:38:21 +0200 Subject: Fixes the PostAttachment component: It now works. Note: This requires adding NoCSRFRequired in NavigationController' documentGet() function. It doesn't seem to raise any risk though. Signed-off-by: Cyrille Bollu --- lib/Controller/NavigationController.php | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/Controller/NavigationController.php b/lib/Controller/NavigationController.php index c4438e5a..331c7701 100644 --- a/lib/Controller/NavigationController.php +++ b/lib/Controller/NavigationController.php @@ -282,6 +282,7 @@ class NavigationController extends Controller { /** * @NoAdminRequired + * @NoCSRFRequired * * @param string $id * -- cgit v1.2.3 From 31a5b21a6ea85d28903e90ca05f4b3e5922cd053 Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Mon, 15 Jul 2019 18:04:27 -0100 Subject: resize attachments Signed-off-by: Maxence Lange cleaning Signed-off-by: Maxence Lange --- lib/Service/CacheDocumentService.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib') diff --git a/lib/Service/CacheDocumentService.php b/lib/Service/CacheDocumentService.php index 84aa32a2..567c934d 100644 --- a/lib/Service/CacheDocumentService.php +++ b/lib/Service/CacheDocumentService.php @@ -35,6 +35,8 @@ use daita\MySmallPhpTools\Model\Request; use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TStringTools; use Exception; +use Gumlet\ImageResize; +use Gumlet\ImageResizeException; use OCA\Social\Exceptions\CacheContentException; use OCA\Social\Exceptions\CacheContentMimeTypeException; use OCA\Social\Exceptions\CacheDocumentDoesNotExistException; @@ -131,6 +133,7 @@ class CacheDocumentService { fclose($tmpFile); $this->filterMimeTypes($mime); + $this->resizeImage($content); $cache = $folder->newFile($filename); $cache->putContent($content); @@ -160,6 +163,23 @@ class CacheDocumentService { throw new CacheContentMimeTypeException(); } + + /** + * @param $content + */ + private function resizeImage(&$content) { + try { + $image = ImageResize::createFromString($content); + $image->quality_jpg = 100; + $image->quality_png = 9; + + $image->resizeToBestFit(500, 300); + $content = $image->getImageAsString(); + } catch (ImageResizeException $e) { + } + } + + /** * @param string $path * -- cgit v1.2.3 From f41c7efdbe93ce4b4ffbe39ec00a023f5f91e192 Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Wed, 17 Jul 2019 20:34:28 -0100 Subject: 2 sizes available Signed-off-by: Maxence Lange --- lib/Controller/NavigationController.php | 48 ++++++++++- lib/Db/CacheDocumentsRequest.php | 3 + lib/Migration/Version0002Date20190717000001.php | 105 ++++++++++++++++++++++++ lib/Model/ActivityPub/Object/Document.php | 30 ++++++- lib/Service/CacheDocumentService.php | 49 +++++++---- lib/Service/DocumentService.php | 25 +++++- 6 files changed, 231 insertions(+), 29 deletions(-) create mode 100644 lib/Migration/Version0002Date20190717000001.php (limited to 'lib') diff --git a/lib/Controller/NavigationController.php b/lib/Controller/NavigationController.php index 331c7701..b9b256a0 100644 --- a/lib/Controller/NavigationController.php +++ b/lib/Controller/NavigationController.php @@ -34,6 +34,7 @@ use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse; use daita\MySmallPhpTools\Traits\TArrayTools; use Exception; use OC; +use OC\AppFramework\Http; use OC\User\NoUserException; use OCA\Social\AppInfo\Application; use OCA\Social\Exceptions\AccountAlreadyExistsException; @@ -139,7 +140,7 @@ class NavigationController extends Controller { 'firstrun' => false, 'setup' => false, 'isAdmin' => OC::$server->getGroupManager() - ->isAdmin($this->userId), + ->isAdmin($this->userId), 'cliUrl' => $this->getCliUrl() ] ]; @@ -289,18 +290,17 @@ class NavigationController extends Controller { * @return Response */ public function documentGet(string $id): Response { - try { $file = $this->documentService->getFromCache($id); - return new FileDisplayResponse($file); + return new FileDisplayResponse($file, Http::STATUS_OK); } catch (Exception $e) { return $this->fail($e); } } - /** + * * @PublicPage * @NoCSRFRequired * @@ -319,4 +319,44 @@ class NavigationController extends Controller { } } + + /** + * @NoAdminRequired + * @NoCSRFRequired + * + * @param string $id + * + * @return Response + */ + public function resizedGet(string $id): Response { + + try { + $file = $this->documentService->getResizedFromCache($id); + + return new FileDisplayResponse($file); + } catch (Exception $e) { + return $this->fail($e); + } + } + + + /** + * @PublicPage + * @NoCSRFRequired + * + * @param string $id + * + * @return Response + */ + public function resizedGetPublic(string $id): Response { + + try { + $file = $this->documentService->getResizedFromCache($id, true); + + return new FileDisplayResponse($file); + } catch (Exception $e) { + return $this->fail($e); + } + } + } diff --git a/lib/Db/CacheDocumentsRequest.php b/lib/Db/CacheDocumentsRequest.php index c8297599..bd7da9e9 100644 --- a/lib/Db/CacheDocumentsRequest.php +++ b/lib/Db/CacheDocumentsRequest.php @@ -56,6 +56,7 @@ class CacheDocumentsRequest extends CacheDocumentsRequestBuilder { ->setValue('mime_type', $qb->createNamedParameter($document->getMimeType())) ->setValue('error', $qb->createNamedParameter($document->getError())) ->setValue('local_copy', $qb->createNamedParameter($document->getLocalCopy())) + ->setValue('resized_copy', $qb->createNamedParameter($document->getResizedCopy())) ->setValue('parent_id', $qb->createNamedParameter($document->getParentId())) ->setValue('public', $qb->createNamedParameter(($document->isPublic()) ? '1' : '0')); @@ -86,6 +87,7 @@ class CacheDocumentsRequest extends CacheDocumentsRequestBuilder { ->set('mime_type', $qb->createNamedParameter($document->getMimeType())) ->set('error', $qb->createNamedParameter($document->getError())) ->set('local_copy', $qb->createNamedParameter($document->getLocalCopy())) + ->set('resized_copy', $qb->createNamedParameter($document->getResizedCopy())) ->set('parent_id', $qb->createNamedParameter($document->getParentId())) ->set('public', $qb->createNamedParameter(($document->isPublic()) ? '1' : '0')); @@ -127,6 +129,7 @@ class CacheDocumentsRequest extends CacheDocumentsRequestBuilder { $qb = $this->getCacheDocumentsUpdateSql(); $this->limitToIdString($qb, $document->getId()); $qb->set('local_copy', $qb->createNamedParameter($document->getLocalCopy())); + $qb->set('resized_copy', $qb->createNamedParameter($document->getResizedCopy())); $qb->set('error', $qb->createNamedParameter($document->getError())); $qb->execute(); diff --git a/lib/Migration/Version0002Date20190717000001.php b/lib/Migration/Version0002Date20190717000001.php new file mode 100644 index 00000000..7864e31b --- /dev/null +++ b/lib/Migration/Version0002Date20190717000001.php @@ -0,0 +1,105 @@ + + * @copyright 2018, Maxence Lange + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + + +namespace OCA\Social\Migration; + + +use Closure; +use Doctrine\DBAL\Schema\SchemaException; +use Doctrine\DBAL\Types\Type; +use Exception; +use OCP\DB\ISchemaWrapper; +use OCP\IDBConnection; +use OCP\Migration\IOutput; +use OCP\Migration\SimpleMigrationStep; + + +/** + * Class Version0002Date20190717000001 + * + * @package OCA\Social\Migration + */ +class Version0002Date20190717000001 extends SimpleMigrationStep { + + + /** @var IDBConnection */ + private $connection; + + + /** + * @param IDBConnection $connection + */ + public function __construct(IDBConnection $connection) { + $this->connection = $connection; + } + + + /** + * @param IOutput $output + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + * + * @return ISchemaWrapper + * @throws SchemaException + */ + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options + ): ISchemaWrapper { + /** @var ISchemaWrapper $schema */ + $schema = $schemaClosure(); + if (!$schema->hasTable('social_a2_cache_documts')) { + return $schema; + } + + $table = $schema->getTable('social_a2_cache_documts'); + if (!$table->hasColumn('resized_copy')) { + $table->addColumn( + 'resized_copy', Type::TEXT, + [ + 'notnull' => true + ] + ); + } + + return $schema; + } + + + /** + * @param IOutput $output + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + * + * @throws Exception + */ + public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { + } + +} + diff --git a/lib/Model/ActivityPub/Object/Document.php b/lib/Model/ActivityPub/Object/Document.php index ca6e4a6f..6685fb62 100644 --- a/lib/Model/ActivityPub/Object/Document.php +++ b/lib/Model/ActivityPub/Object/Document.php @@ -59,6 +59,9 @@ class Document extends ACore implements JsonSerializable { /** @var string */ private $localCopy = ''; + /** @var string */ + private $resizedCopy = ''; + /** @var int */ private $caching = 0; @@ -140,6 +143,25 @@ class Document extends ACore implements JsonSerializable { } + /** + * @return string + */ + public function getResizedCopy(): string { + return $this->resizedCopy; + } + + /** + * @param string $resizedCopy + * + * @return Document + */ + public function setResizedCopy(string $resizedCopy): Document { + $this->resizedCopy = $resizedCopy; + + return $this; + } + + /** * @return bool */ @@ -244,6 +266,7 @@ class Document extends ACore implements JsonSerializable { $this->setPublic(($this->getInt('public', $data, 0) === 1) ? true : false); $this->setError($this->getInt('error', $data, 0)); $this->setLocalCopy($this->get('local_copy', $data, '')); + $this->setResizedCopy($this->get('resized_copy', $data, '')); $this->setMediaType($this->get('media_type', $data, '')); $this->setMimeType($this->get('mime_type', $data, '')); $this->setParentId($this->get('parent_id', $data, '')); @@ -266,9 +289,10 @@ class Document extends ACore implements JsonSerializable { $result = array_merge( parent::jsonSerialize(), [ - 'mediaType' => $this->getMediaType(), - 'mimeType' => $this->getMimeType(), - 'localCopy' => $this->getLocalCopy() + 'mediaType' => $this->getMediaType(), + 'mimeType' => $this->getMimeType(), + 'localCopy' => $this->getLocalCopy(), + 'resizedCopy' => $this->getResizedCopy() ] ); diff --git a/lib/Service/CacheDocumentService.php b/lib/Service/CacheDocumentService.php index 567c934d..b50b827e 100644 --- a/lib/Service/CacheDocumentService.php +++ b/lib/Service/CacheDocumentService.php @@ -47,6 +47,7 @@ use OCA\Social\Exceptions\RequestResultSizeException; use OCA\Social\Exceptions\RequestServerException; use OCA\Social\Exceptions\SocialAppConfigException; use OCA\Social\Exceptions\UnauthorizedFediverseException; +use OCA\Social\Model\ActivityPub\Object\Document; use OCP\Files\IAppData; use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; @@ -93,11 +94,9 @@ class CacheDocumentService { /** - * @param string $url - * + * @param Document $document * @param string $mime * - * @return string * @throws CacheContentMimeTypeException * @throws MalformedArrayException * @throws NotFoundException @@ -110,20 +109,8 @@ class CacheDocumentService { * @throws SocialAppConfigException * @throws UnauthorizedFediverseException */ - public function saveRemoteFileToCache(string $url, &$mime = '') { - - $filename = $this->uuid(); - - // creating a path aa/bb/cc/dd/ from the filename aabbccdd-0123-[...] - $path = chunk_split(substr($filename, 0, 8), 2, '/'); - - try { - $folder = $this->appData->getFolder($path); - } catch (NotFoundException $e) { - $folder = $this->appData->newFolder($path); - } - - $content = $this->retrieveContent($url); + public function saveRemoteFileToCache(Document $document, &$mime = '') { + $content = $this->retrieveContent($document->getUrl()); // To get the mime type, we create a temp file $tmpFile = tmpfile(); @@ -133,7 +120,33 @@ class CacheDocumentService { fclose($tmpFile); $this->filterMimeTypes($mime); + + $filename = $this->saveContentToCache($content); + $document->setLocalCopy($filename); $this->resizeImage($content); + $resized = $this->saveContentToCache($content); + $document->setResizedCopy($resized); + } + + + /** + * @param string $content + * + * @return string + * @throws NotPermittedException + * @throws NotFoundException + */ + private function saveContentToCache(string $content): string { + + $filename = $this->uuid(); + // creating a path aa/bb/cc/dd/ from the filename aabbccdd-0123-[...] + $path = chunk_split(substr($filename, 0, 8), 2, '/'); + + try { + $folder = $this->appData->getFolder($path); + } catch (NotFoundException $e) { + $folder = $this->appData->newFolder($path); + } $cache = $folder->newFile($filename); $cache->putContent($content); @@ -187,7 +200,7 @@ class CacheDocumentService { * @throws CacheContentException * @throws CacheDocumentDoesNotExistException */ - public function getContentFromCache(string $path) { + public function getContentFromCache(string $path): ISimpleFile { if ($path === '') { throw new CacheDocumentDoesNotExistException(); } diff --git a/lib/Service/DocumentService.php b/lib/Service/DocumentService.php index 4fedac0c..d9630955 100644 --- a/lib/Service/DocumentService.php +++ b/lib/Service/DocumentService.php @@ -143,9 +143,7 @@ class DocumentService { $this->cacheDocumentsRequest->initCaching($document); try { - $localCopy = $this->cacheService->saveRemoteFileToCache($document->getUrl(), $mime); - $document->setMimeType($mime); - $document->setLocalCopy($localCopy); + $this->cacheService->saveRemoteFileToCache($document, $mime); $this->cacheDocumentsRequest->endCaching($document); $this->streamRequest->updateAttachments($document); @@ -192,8 +190,26 @@ class DocumentService { /** * @param string $id + * @param bool $public * + * @return ISimpleFile + * @throws CacheContentException + * @throws CacheDocumentDoesNotExistException + * @throws MalformedArrayException + * @throws RequestResultNotJsonException + * @throws SocialAppConfigException + */ + public function getResizedFromCache(string $id, bool $public = false) { + $document = $this->cacheRemoteDocument($id, $public); + + return $this->cacheService->getContentFromCache($document->getResizedCopy()); + } + + + /** + * @param string $id * @param bool $public + * @param string $mimeType * * @return ISimpleFile * @throws CacheContentException @@ -202,8 +218,9 @@ class DocumentService { * @throws RequestResultNotJsonException * @throws SocialAppConfigException */ - public function getFromCache(string $id, bool $public = false) { + public function getFromCache(string $id, bool $public = false, string &$mimeType = '') { $document = $this->cacheRemoteDocument($id, $public); + $mimeType = $document->getMimeType(); return $this->cacheService->getContentFromCache($document->getLocalCopy()); } -- cgit v1.2.3 From db7b4b3075ad8a6da3d3f9128795d0ece28bfbb5 Mon Sep 17 00:00:00 2001 From: Cyrille Bollu Date: Fri, 19 Jul 2019 13:18:56 +0200 Subject: Updates the getCacheDocumentsSelectSql function to also return the 'resized_copy' field. Signed-off-by: Cyrille Bollu --- lib/Db/CacheDocumentsRequestBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/Db/CacheDocumentsRequestBuilder.php b/lib/Db/CacheDocumentsRequestBuilder.php index a75c4a0a..10b91f79 100644 --- a/lib/Db/CacheDocumentsRequestBuilder.php +++ b/lib/Db/CacheDocumentsRequestBuilder.php @@ -77,7 +77,7 @@ class CacheDocumentsRequestBuilder extends CoreRequestBuilder { /** @noinspection PhpMethodParametersCountMismatchInspection */ $qb->select( 'cd.id', 'cd.type', 'cd.parent_id', 'cd.media_type', 'cd.mime_type', 'cd.url', - 'cd.local_copy', 'cd.public', 'cd.error', 'cd.creation', 'cd.caching' + 'cd.local_copy', 'cd.public', 'cd.error', 'cd.creation', 'cd.caching', 'cd.resized_copy' ) ->from(self::TABLE_CACHE_DOCUMENTS, 'cd'); -- cgit v1.2.3 From b90ddcda033ce882ce41e06e721832e1a87844dc Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Fri, 19 Jul 2019 12:53:28 -0100 Subject: /local/v1/post?id=Signed-off-by: Maxence Lange --- lib/Controller/LocalController.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib') diff --git a/lib/Controller/LocalController.php b/lib/Controller/LocalController.php index 69294bf8..9b91131c 100644 --- a/lib/Controller/LocalController.php +++ b/lib/Controller/LocalController.php @@ -182,6 +182,26 @@ class LocalController extends Controller { } + /** + * get info about a post (limited to viewer rights). + * + * @NoAdminRequired + * + * @param string $id + * + * @return DataResponse + */ + public function postData(string $id): DataResponse { + try { + $this->initViewer(true); + + return $this->directSuccess($this->noteService->getNoteById($id, true)); + } catch (Exception $e) { + return $this->fail($e); + } + } + + /** * Delete your own post. * -- cgit v1.2.3 From fff29cd492c33394ddd1b500741ce86ed1117cf9 Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Sat, 20 Jul 2019 15:34:02 -0100 Subject: smaller resize + lint errors Signed-off-by: Maxence Lange --- lib/Service/CacheDocumentService.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/Service/CacheDocumentService.php b/lib/Service/CacheDocumentService.php index b50b827e..78505637 100644 --- a/lib/Service/CacheDocumentService.php +++ b/lib/Service/CacheDocumentService.php @@ -61,6 +61,9 @@ class CacheDocumentService { use TStringTools; + const RESIZED_HEIGHT = 250; + const RESIZED_WIDTH = 350; + /** @var IAppData */ private $appData; @@ -186,7 +189,7 @@ class CacheDocumentService { $image->quality_jpg = 100; $image->quality_png = 9; - $image->resizeToBestFit(500, 300); + $image->resizeToBestFit(self::RESIZED_WIDTH, self::RESIZED_HEIGHT); $content = $image->getImageAsString(); } catch (ImageResizeException $e) { } -- cgit v1.2.3 From 2f5449580570b14cf181c24b8cd3dbd978666b91 Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Sat, 20 Jul 2019 17:19:59 -0100 Subject: send header on documentGet Signed-off-by: Maxence Lange --- lib/Controller/LocalController.php | 5 +++-- lib/Controller/NavigationController.php | 22 ++++++++++++++-------- lib/Service/CacheDocumentService.php | 4 ++-- lib/Service/DocumentService.php | 6 ++++-- 4 files changed, 23 insertions(+), 14 deletions(-) (limited to 'lib') diff --git a/lib/Controller/LocalController.php b/lib/Controller/LocalController.php index 9b91131c..e003ff84 100644 --- a/lib/Controller/LocalController.php +++ b/lib/Controller/LocalController.php @@ -701,9 +701,10 @@ class LocalController extends Controller { $actor = $this->cacheActorService->getFromId($id); if ($actor->gotIcon()) { $avatar = $actor->getIcon(); - $document = $this->documentService->getFromCache($avatar->getId()); + $document = $this->documentService->getFromCache($avatar->getId(), $mime); - $response = new FileDisplayResponse($document); + $response = + new FileDisplayResponse($document, Http::STATUS_OK, ['Content-Type' => $mime]); $response->cacheFor(86400); return $response; diff --git a/lib/Controller/NavigationController.php b/lib/Controller/NavigationController.php index b9b256a0..b613fb1e 100644 --- a/lib/Controller/NavigationController.php +++ b/lib/Controller/NavigationController.php @@ -291,9 +291,11 @@ class NavigationController extends Controller { */ public function documentGet(string $id): Response { try { - $file = $this->documentService->getFromCache($id); + $mime = ''; + $file = $this->documentService->getFromCache($id, $mime); + + return new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => $mime]); - return new FileDisplayResponse($file, Http::STATUS_OK); } catch (Exception $e) { return $this->fail($e); } @@ -311,9 +313,10 @@ class NavigationController extends Controller { public function documentGetPublic(string $id): Response { try { - $file = $this->documentService->getFromCache($id, true); + $mime = ''; + $file = $this->documentService->getFromCache($id, $mime, true); - return new FileDisplayResponse($file); + return new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => $mime]); } catch (Exception $e) { return $this->fail($e); } @@ -331,9 +334,10 @@ class NavigationController extends Controller { public function resizedGet(string $id): Response { try { - $file = $this->documentService->getResizedFromCache($id); + $mime = ''; + $file = $this->documentService->getResizedFromCache($id, $mime); - return new FileDisplayResponse($file); + return new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => $mime]); } catch (Exception $e) { return $this->fail($e); } @@ -351,12 +355,14 @@ class NavigationController extends Controller { public function resizedGetPublic(string $id): Response { try { - $file = $this->documentService->getResizedFromCache($id, true); + $mime = ''; + $file = $this->documentService->getResizedFromCache($id, $mime, true); - return new FileDisplayResponse($file); + return new FileDisplayResponse($file, Http::STATUS_OK, ['Content-Type' => $mime]); } catch (Exception $e) { return $this->fail($e); } } } + diff --git a/lib/Service/CacheDocumentService.php b/lib/Service/CacheDocumentService.php index 78505637..b147c8f6 100644 --- a/lib/Service/CacheDocumentService.php +++ b/lib/Service/CacheDocumentService.php @@ -61,8 +61,8 @@ class CacheDocumentService { use TStringTools; - const RESIZED_HEIGHT = 250; - const RESIZED_WIDTH = 350; + const RESIZED_WIDTH = 280; + const RESIZED_HEIGHT = 180; /** @var IAppData */ private $appData; diff --git a/lib/Service/DocumentService.php b/lib/Service/DocumentService.php index d9630955..c5318bc3 100644 --- a/lib/Service/DocumentService.php +++ b/lib/Service/DocumentService.php @@ -190,6 +190,7 @@ class DocumentService { /** * @param string $id + * @param string $mime * @param bool $public * * @return ISimpleFile @@ -199,8 +200,9 @@ class DocumentService { * @throws RequestResultNotJsonException * @throws SocialAppConfigException */ - public function getResizedFromCache(string $id, bool $public = false) { + public function getResizedFromCache(string $id, string &$mime = '', bool $public = false) { $document = $this->cacheRemoteDocument($id, $public); + $mime = $document->getMimeType(); return $this->cacheService->getContentFromCache($document->getResizedCopy()); } @@ -218,7 +220,7 @@ class DocumentService { * @throws RequestResultNotJsonException * @throws SocialAppConfigException */ - public function getFromCache(string $id, bool $public = false, string &$mimeType = '') { + public function getFromCache(string $id, string &$mimeType = '', bool $public = false) { $document = $this->cacheRemoteDocument($id, $public); $mimeType = $document->getMimeType(); -- cgit v1.2.3