Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/IBOC-99/obj…
Browse files Browse the repository at this point in the history
…ects-controller
  • Loading branch information
rubenvdlinde committed Jan 16, 2025
2 parents e52193e + d3953ca commit ba459f1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Create a [bug report](https://github.com/OpenCatalogi/.github/issues/new/choose)
Create a [feature request](https://github.com/OpenCatalogi/.github/issues/new/choose)
]]></description>
<version>0.6.53</version>
<version>0.6.56</version>
<licence>agpl</licence>
<author mail="[email protected]" homepage="https://www.conduction.nl/">Conduction</author>
<author mail="[email protected]" homepage="https://acato.nl/">Acato</author>
Expand Down
2 changes: 2 additions & 0 deletions lib/Controller/AttachmentsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace OCA\OpenCatalogi\Controller;

ini_set('memory_limit', '2048M');

use Exception;
use GuzzleHttp\Exception\GuzzleException;
use OCA\OpenCatalogi\Db\AttachmentMapper;
Expand Down
14 changes: 10 additions & 4 deletions lib/Service/DirectoryService.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Exception\ServerException;
use JsonSerializable;
use OCA\OpenCatalogi\Db\Catalog;
use OCA\OpenCatalogi\Db\CatalogMapper;
use OCA\OpenCatalogi\Db\Listing;
use OCA\OpenCatalogi\Db\ListingMapper;
use OCA\OpenCatalogi\Service\BroadcastService;
use OCA\OpenCatalogi\Exception\DirectoryUrlException;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\Entity;
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IAppConfig;
Expand Down Expand Up @@ -105,7 +107,7 @@ private function getDirectoryFromListing(Listing|array $listing): array
if (isset($listing['publicationTypes']) && is_array($listing['publicationTypes'])) {
foreach ($listing['publicationTypes'] as &$publicationType) {
// Convert publicationType to array if it's an object
if ($publicationType instanceof \JsonSerializable) {
if ($publicationType instanceof JsonSerializable) {
$publicationType = $publicationType->jsonSerialize();
}

Expand Down Expand Up @@ -169,7 +171,7 @@ private function getDirectoryFromCatalog(Catalog|array $catalog): array
if (isset($catalog['publicationTypes']) && is_array($catalog['publicationTypes'])) {
foreach ($catalog['publicationTypes'] as &$publicationType) {
// Convert publicationType to array if it's an object
if ($publicationType instanceof \JsonSerializable) {
if ($publicationType instanceof JsonSerializable) {
$publicationType = $publicationType->jsonSerialize();
}
$publicationType['listed'] = true;
Expand Down Expand Up @@ -295,7 +297,7 @@ public function updateListing(array $newListing, array $oldListing): array{
// Do not update version, because we copy the version from the source
$newListing = $this->objectService->saveObject('listing', $oldListing, false);

return $newListing->jsonSerialize();
return $newListing instanceof Listing === true ? $newListing->jsonSerialize() : $newListing;
}

/**
Expand Down Expand Up @@ -442,7 +444,11 @@ public function syncExternalDirectory(string $url): array

// Save the new listing
$listingObject = $this->objectService->saveObject('listing', $listing);
$listing = $listingObject->jsonSerialize();
if ($listing instanceof Entity) {
$listing = $listing->jsonSerialize();
} else {
$listing = $listingObject;
}
$foundDirectories[] = $listing['directory'];
$addedListings[] = $listing['directory'].'/'.$listing['id'];
}
Expand Down
1 change: 1 addition & 0 deletions lib/Service/FileService.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

namespace OCA\OpenCatalogi\Service;
ini_set('memory_limit', '2048M');

use DateTime;
use Exception;
Expand Down

0 comments on commit ba459f1

Please sign in to comment.