Skip to content

Commit

Permalink
Merge branch release/v2.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
roadiz-ci committed Dec 6, 2024
1 parent 5649308 commit 24ace94
Show file tree
Hide file tree
Showing 58 changed files with 1,397 additions and 1,070 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/run-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.1', '8.2', '8.3']
php-version: ['8.2', '8.3']
steps:
- uses: shivammathur/setup-php@v2
with:
Expand All @@ -35,7 +35,5 @@ jobs:
${{ runner.os }}-php-${{ matrix.php-version }}-
- name: Install Dependencies
run: composer install --no-scripts --no-ansi --no-interaction --no-progress
- name: Run PHP Code Sniffer
run: vendor/bin/phpcs -p ./src
- name: Run PHPStan
run: vendor/bin/phpstan analyse --no-progress -c phpstan.neon
3 changes: 0 additions & 3 deletions Makefile

This file was deleted.

24 changes: 10 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,18 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=8.1",
"symfony/framework-bundle": "6.4.*",
"roadiz/core-bundle": "2.3.*",
"roadiz/rozier": "2.3.*",
"roadiz/compat-bundle": "2.3.*",
"roadiz/openid": "2.3.*"
"php": ">=8.2",
"roadiz/compat-bundle": "2.4.*",
"roadiz/core-bundle": "2.4.*",
"roadiz/openid": "2.4.*",
"roadiz/rozier": "2.4.*",
"symfony/framework-bundle": "6.4.*"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.4",
"phpstan/phpstan": "^1.5.3",
"phpstan/phpstan-symfony": "^1.1.8",
"phpstan/phpstan-doctrine": "^1.3",
"squizlabs/php_codesniffer": "^3.5"
"phpstan/phpstan-symfony": "^1.1.8"
},
"config": {
"optimize-autoloader": true,
Expand All @@ -48,15 +47,12 @@
"autoload": {
"psr-4": {
"RZ\\Roadiz\\RozierBundle\\": "src/"
},
"files": [
"deprecated.php"
]
}
},
"extra": {
"branch-alias": {
"dev-main": "2.3.x-dev",
"dev-develop": "2.4.x-dev"
"dev-main": "2.4.x-dev",
"dev-develop": "2.5.x-dev"
}
}
}
2 changes: 1 addition & 1 deletion config/routing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ajaxSessionMessages:
ping:
path: /rz-admin/ping
methods: [GET]
controller: RZ\Roadiz\RozierBundle\Controller\PingController::indexAction
controller: RZ\Roadiz\RozierBundle\Controller\PingController::pingAction

# CACHES
deleteDoctrineCache:
Expand Down
13 changes: 13 additions & 0 deletions config/routing/login.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,16 @@ loginPage:
logoutPage:
path: /logout
controller: RZ\Roadiz\RozierBundle\Controller\SecurityController::logout

roadiz_rozier_login_link:
path: /login_link
controller: RZ\Roadiz\RozierBundle\Controller\SecurityController::requestLoginLink

roadiz_rozier_login_link_sent:
methods: [GET]
path: /login_link_sent
controller: RZ\Roadiz\RozierBundle\Controller\SecurityController::loginLinkSent

login_link_check:
path: /login_link_check
controller: RZ\Roadiz\RozierBundle\Controller\SecurityController::check
12 changes: 6 additions & 6 deletions config/routing/nodes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,17 @@ nodesUndeletePage:
_controller: Themes\Rozier\Controllers\Nodes\NodesController::undeleteAction
requirements: { nodeId : "[0-9]+" }

nodesExportAllXlsxPage:
path: /export/xlsx/{translationId}
nodesExportAllCsvPage:
path: /export/all-{translationId}.csv
defaults:
_controller: Themes\Rozier\Controllers\Nodes\ExportController::exportAllXlsxAction
_controller: Themes\Rozier\Controllers\Nodes\ExportController::exportAllAction
requirements:
translationId : "[0-9]+"

nodesExportNodeXlsxPage:
path: /export/{parentNodeId}/xlsx/{translationId}
nodesExportNodeCsvPage:
path: /export/node-{parentNodeId}-{translationId}.csv
defaults:
_controller: Themes\Rozier\Controllers\Nodes\ExportController::exportAllXlsxAction
_controller: Themes\Rozier\Controllers\Nodes\ExportController::exportAllAction
requirements:
translationId: "[0-9]+"
parentNodeId: "[0-9]+"
Expand Down
6 changes: 6 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ services:
Themes\Rozier\Explorer\UsersProvider:
public: true

RZ\Roadiz\CoreBundle\Explorer\ExplorerItemFactoryInterface:
class: Themes\Rozier\Explorer\ExplorerItemFactory
autowire: true
autoconfigure: true

# Since symfony/dependency-injection 5.1: The "Psr\Container\ContainerInterface" autowiring alias is deprecated.
# Define it explicitly in your app if you want to keep using it.
Themes\Rozier\Forms\NodeSource\NodeSourceProviderType:
Expand Down Expand Up @@ -86,6 +91,7 @@ services:
arguments:
- '@?roadiz_rozier.open_id.discovery'
- '@security.csrf.token_manager'
- '@RZ\Roadiz\Random\TokenGeneratorInterface'
- '%roadiz_rozier.open_id.hosted_domain%'
- '%roadiz_rozier.open_id.oauth_client_id%'
- '%roadiz_rozier.open_id.scopes%'
Expand Down
9 changes: 0 additions & 9 deletions deprecated.php

This file was deleted.

13 changes: 0 additions & 13 deletions phpcs.xml.dist

This file was deleted.

16 changes: 0 additions & 16 deletions src/Aliases.php

This file was deleted.

11 changes: 6 additions & 5 deletions src/Controller/CustomForm/CustomFormUsageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@
namespace RZ\Roadiz\RozierBundle\Controller\CustomForm;

use RZ\Roadiz\CoreBundle\Entity\CustomForm;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Themes\Rozier\RozierApp;

final class CustomFormUsageController extends RozierApp
final class CustomFormUsageController extends AbstractController
{
public function usageAction(CustomForm $id): Response
{
$this->denyAccessUnlessGranted('ROLE_ACCESS_CUSTOMFORMS');
$customForm = $id;
$this->assignation['customForm'] = $customForm;
$this->assignation['usages'] = $customForm->getNodes();

return $this->render('@RoadizRozier/custom-forms/usage.html.twig', $this->assignation);
return $this->render('@RoadizRozier/custom-forms/usage.html.twig', [
'customForm' => $customForm,
'usages' => $customForm->getNodes(),
]);
}
}
77 changes: 37 additions & 40 deletions src/Controller/Document/DocumentArchiveController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@

use Doctrine\Persistence\ManagerRegistry;
use League\Flysystem\FilesystemException;
use Psr\Log\LoggerInterface;
use RZ\Roadiz\CoreBundle\Entity\Document;
use RZ\Roadiz\CoreBundle\Security\LogTrail;
use RZ\Roadiz\Documents\DocumentArchiver;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
Expand All @@ -16,26 +19,20 @@
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\NotNull;
use Symfony\Contracts\Translation\TranslatorInterface;
use Themes\Rozier\RozierApp;
use Twig\Error\RuntimeError;

final class DocumentArchiveController extends RozierApp
final class DocumentArchiveController extends AbstractController
{
public function __construct(
private readonly ManagerRegistry $managerRegistry,
private readonly TranslatorInterface $translator,
private readonly DocumentArchiver $documentArchiver
private readonly DocumentArchiver $documentArchiver,
private readonly LoggerInterface $logger,
private readonly LogTrail $logTrail,
) {
}

/**
* Return an deletion form for multiple docs.
*
* @param Request $request
*
* @return Response
* @throws FilesystemException
* @throws RuntimeError
*/
public function bulkDownloadAction(Request $request): Response
{
Expand All @@ -53,49 +50,49 @@ public function bulkDownloadAction(Request $request): Response
'id' => $documentsIds,
]);

if (count($documents) > 0) {
$this->assignation['documents'] = $documents;
$form = $this->buildBulkDownloadForm($documentsIds);
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {
try {
return $this->documentArchiver->archiveAndServe($documents, 'Documents archive');
} catch (\Exception $e) {
$this->getLogger()->error($e->getMessage());
$msg = $this->translator->trans('documents.cannot_download');
$this->publishErrorMessage($request, $msg);
}
if (0 === count($documents)) {
throw new ResourceNotFoundException();
}

return $this->redirectToRoute('documentsHomePage');
$assignation = [];
$assignation['documents'] = $documents;
$form = $this->buildBulkDownloadForm($documentsIds);
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {
try {
return $this->documentArchiver->archiveAndServe($documents, 'Documents archive');
} catch (\Exception $e) {
$this->logger->error($e->getMessage());
$msg = $this->translator->trans('documents.cannot_download');
$this->logTrail->publishErrorMessage($request, $msg);
}

$this->assignation['form'] = $form->createView();
$this->assignation['action'] = '?' . http_build_query(['documents' => $documentsIds]);
$this->assignation['thumbnailFormat'] = [
'quality' => 50,
'fit' => '128x128',
'sharpen' => 5,
'inline' => false,
'picture' => true,
'controls' => false,
'loading' => 'lazy',
];

return $this->render('@RoadizRozier/documents/bulkDownload.html.twig', $this->assignation);
return $this->redirectToRoute('documentsHomePage');
}

throw new ResourceNotFoundException();
}
$assignation['form'] = $form->createView();
$assignation['action'] = '?'.http_build_query(['documents' => $documentsIds]);
$assignation['thumbnailFormat'] = [
'quality' => 50,
'fit' => '128x128',
'sharpen' => 5,
'inline' => false,
'picture' => true,
'controls' => false,
'loading' => 'lazy',
];

return $this->render('@RoadizRozier/documents/bulkDownload.html.twig', $assignation);
}

private function buildBulkDownloadForm(array $documentsIds): FormInterface
{
$defaults = [
'checksum' => md5(serialize($documentsIds)),
];
$builder = $this->createFormBuilder($defaults, [
'action' => '?' . http_build_query(['documents' => $documentsIds]),
'action' => '?'.http_build_query(['documents' => $documentsIds]),
])
->add('checksum', HiddenType::class, [
'constraints' => [
Expand Down
20 changes: 9 additions & 11 deletions src/Controller/Document/DocumentDuplicatesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,23 @@
use RZ\Roadiz\CoreBundle\ListManager\QueryBuilderListManager;
use RZ\Roadiz\CoreBundle\ListManager\SessionListFilters;
use RZ\Roadiz\CoreBundle\Repository\DocumentRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Themes\Rozier\RozierApp;

final class DocumentDuplicatesController extends RozierApp
final class DocumentDuplicatesController extends AbstractController
{
public function __construct(private readonly ManagerRegistry $managerRegistry)
{
}

/**
* @param Request $request
* @return Response
*/
public function duplicatedAction(Request $request): Response
{
$this->denyAccessUnlessGranted('ROLE_ACCESS_DOCUMENTS');

$this->assignation['duplicates'] = true;
$assignation = [];
$assignation['duplicates'] = true;
/** @var DocumentRepository $documentRepository */
$documentRepository = $this->managerRegistry->getRepository(Document::class);

Expand All @@ -36,7 +34,7 @@ public function duplicatedAction(Request $request): Response
$documentRepository->getDuplicatesQueryBuilder(),
'd'
);
$listManager->setItemPerPage(static::DEFAULT_ITEM_PER_PAGE);
$listManager->setItemPerPage(RozierApp::DEFAULT_ITEM_PER_PAGE);

/*
* Stored in session
Expand All @@ -46,9 +44,9 @@ public function duplicatedAction(Request $request): Response

$listManager->handle();

$this->assignation['filters'] = $listManager->getAssignation();
$this->assignation['documents'] = $listManager->getEntities();
$this->assignation['thumbnailFormat'] = [
$assignation['filters'] = $listManager->getAssignation();
$assignation['documents'] = $listManager->getEntities();
$assignation['thumbnailFormat'] = [
'quality' => 50,
'fit' => '128x128',
'sharpen' => 5,
Expand All @@ -58,6 +56,6 @@ public function duplicatedAction(Request $request): Response
'loading' => 'lazy',
];

return $this->render('@RoadizRozier/documents/duplicated.html.twig', $this->assignation);
return $this->render('@RoadizRozier/documents/duplicated.html.twig', $assignation);
}
}
Loading

0 comments on commit 24ace94

Please sign in to comment.