Skip to content

Commit

Permalink
Merge branch 'in2code-de:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
svewap authored Oct 16, 2024
2 parents 7e7aaac + 95c948b commit bf09eca
Show file tree
Hide file tree
Showing 79 changed files with 5,382 additions and 918 deletions.
1 change: 0 additions & 1 deletion .ddev/docker-compose.browser.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.6'
services:
chrome:
container_name: ddev-${DDEV_SITENAME}-chromedriver
Expand Down
1 change: 0 additions & 1 deletion .ddev/docker-compose.typo3.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.6'
services:
web:
environment:
Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/.gitattributes export-ignore
/.gitignore export-ignore
/.project export-ignore
/Tests export-ignore
/Resources/Private/Sass/
/Resources/Private/gulpfile.js
Expand Down
32 changes: 29 additions & 3 deletions .github/workflows/ter-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,44 @@ jobs:
TYPO3_API_PASSWORD: ${{ secrets.TYPO3_API_PASSWORD }}

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Check tag
run: |
if ! [[ ${{ github.ref }} =~ ^refs/tags/[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$ ]]; then
exit 1
fi
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
run: echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV

- name: Get comment
id: get-comment
run: |
readonly local comment=$(git tag -n10 -l ${{ env.version }} | sed "s/^[0-9.]*[ ]*//g")
if [[ -z "${comment// }" ]]; then
echo "comment=Released version ${{ env.version }} of ${{ env.TYPO3_EXTENSION_KEY }}" >> $GITHUB_ENV
else
{
echo 'comment<<EOF'
echo "$comment"
echo EOF
} >> "$GITHUB_ENV"
fi
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: intl, mbstring, xml, soap, zip, curl
tools: composer:v2

- name: Install EXT:tailor
run: composer global require typo3/tailor --prefer-dist --no-progress --no-suggest

- name: Upload EXT:${{ env.EXTENSION_KEY }} as ${{ steps.get_version.outputs.VERSION }} to TER
run: php ~/.composer/vendor/bin/tailor ter:publish ${{ steps.get_version.outputs.VERSION }} --artefact=${{ env.REPOSITORY_URL }}/archive/${{ steps.get_version.outputs.VERSION }}.zip --comment="New release of version ${{ steps.get_version.outputs.VERSION }} - see details, changelog and documentation on ${{ env.REPOSITORY_URL }}"
- name: Publish to TER
run: php ~/.composer/vendor/bin/tailor ter:publish --comment "${{ env.comment }}" ${{ env.version }}

15 changes: 15 additions & 0 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ jobs:
run: "composer install"
- name: "Run PHP CS Fixer"
run: "composer test:php:cs"
phpstan:
name: "PHPstan"
runs-on: ubuntu-20.04
needs: php-lint
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
- name: "Composer Install"
run: "composer install"
- name: "Run PHPstan"
run: "composer test:php:phpstan"
unit-tests:
name: "PHP Unit Tests"
runs-on: ubuntu-20.04
Expand Down
4 changes: 2 additions & 2 deletions .project/data/db.sql.gz
Git LFS file not shown
4,591 changes: 4,591 additions & 0 deletions .project/tests/phpstan-baseline.neon

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions .project/tests/phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
includes:
- phpstan-baseline.neon
parameters:
level: 8
paths:
- ../../Classes

# ToDo: fix ../../Tests for inclusion in phpstan
3 changes: 3 additions & 0 deletions .project/typo3/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@
'scheduler' => [
'maxLifetime' => '1440',
],
'static_info_tables' => [
'enableManager' => '0',
],
],
'FE' => [
'debug' => true,
Expand Down
47 changes: 7 additions & 40 deletions Classes/Controller/FormController.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,26 +95,16 @@ public function formAction(): ResponseInterface
}

/**
* Workaround for TYPO3 v12
* It turned out that it does not cover all use cases
* Will be removed for TYPO3 v13 without any replacement. Functionality is already in `initializeConfirmationAction`
*
* @param Mail $mail
* @return ResponseInterface
* @throws DeprecatedException
* @throws ExtensionConfigurationExtensionNotConfiguredException
* @throws ExtensionConfigurationPathDoesNotExistException
* @throws InvalidQueryException
* @throws NoSuchArgumentException
* @deprecated since version 12.3.2, will be removed in version 13.0.0
*/
public function checkConfirmationAction(Mail $mail): ResponseInterface
{
trigger_error(
'EXT:powermail -- Method "checkConfirmationAction" is deprecated since version 12.3.2, will be removed in version 13.0.0',
E_USER_DEPRECATED
);

$response = $this->forwardIfFormParamsDoNotMatch();

if ($response !== null) {
Expand Down Expand Up @@ -188,6 +178,10 @@ public function initializeConfirmationAction(): void
*/
public function confirmationAction(Mail $mail): ResponseInterface
{
if ($mail->getUid() !== null) {
return (new ForwardResponse('form'))->withoutArguments();
}

$event = GeneralUtility::makeInstance(FormControllerConfirmationActionEvent::class, $mail, $this);
$this->eventDispatcher->dispatch($event);
$mail = $event->getMail();
Expand All @@ -205,36 +199,6 @@ public function confirmationAction(Mail $mail): ResponseInterface
}

/**
* Workaround for TYPO3 v12
* It turned out that it does not cover all use cases
* Will be removed for TYPO3 v13 without any replacement. Functionality is already in `initializeCreateAction`
*
* @return void
* @throws DeprecatedException
* @throws ExtensionConfigurationExtensionNotConfiguredException
* @throws ExtensionConfigurationPathDoesNotExistException
* @throws InvalidQueryException
* @throws NoSuchArgumentException
*/
public function initializeCheckCreateAction(): void
{
// ToDo -- v13: move exceptions to methods
$response = $this->forwardIfMailParamEmpty();
if ($response !== null) {
throw new PropagateResponseException($response);
}

$response = $this->forwardIfFormParamsDoNotMatch();
if ($response !== null) {
throw new PropagateResponseException($response);
}
}

/**
* Workaround for TYPO3 v12
* It turned out that it does not cover all use cases
* Will be removed for TYPO3 v13 without any replacement. Functionality is already in `initializeConformationAction`
*
* @param Mail $mail
* @return ResponseInterface
* @throws DeprecatedException
Expand Down Expand Up @@ -310,6 +274,9 @@ public function initializeCreateAction(): void
*/
public function createAction(Mail $mail, string $hash = ''): ResponseInterface
{
if ($mail->getUid() !== null && !HashUtility::isHashValid($hash, $mail)) {
return (new ForwardResponse('form'))->withoutArguments();
}
$event = GeneralUtility::makeInstance(FormControllerCreateActionBeforeRenderViewEvent::class, $mail, $hash, $this);
$this->eventDispatcher->dispatch($event);
$mail = $event->getMail();
Expand Down
28 changes: 12 additions & 16 deletions Classes/Controller/ModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function initializeAction(): void
}

/**
* @return void
* @return ResponseInterface
* @noinspection PhpUnused
*/
public function dispatchAction(string $forwardToAction = 'list'): ResponseInterface
Expand All @@ -93,15 +93,10 @@ public function listAction(): ResponseInterface
$formUids = $this->mailRepository->findGroupedFormUidsToGivenPageUid((int)$this->id);
$mails = $this->mailRepository->findAllInPid((int)$this->id, $this->settings, $this->piVars);

$currentPage = 1;
if ($this->request->hasArgument('tx_powermail_web_powermailm1')) {
$moduleArguments = $this->request->getArgument('tx_powermail_web_powermailm1');
if (array_key_exists('currentPage', $moduleArguments)) {
$currentPage = (int)$moduleArguments['currentPage'];
}
}
$currentPage = (int)($this->request->getQueryParams()['currentPage'] ?? 1);
$currentPage = $currentPage > 0 ? $currentPage : 1;

$itemsPerPage = $this->settings['perPage'] ?? 10;
$itemsPerPage = (int)($this->settings['perPage'] ?? 10);
$paginator = GeneralUtility::makeInstance(QueryResultPaginator::class, $mails, $currentPage, $itemsPerPage);
$pagination = GeneralUtility::makeInstance(SlidingWindowPagination::class, $paginator, 15);

Expand Down Expand Up @@ -130,11 +125,11 @@ public function listAction(): ResponseInterface
}

/**
* @return void
* @return ResponseInterface|null
* @throws InvalidQueryException
* @noinspection PhpUnused
*/
public function exportXlsAction(): ResponseInterface
public function exportXlsAction(): ?ResponseInterface
{
if ($this->isPhpSpreadsheetInstalled) {
$this->view->assignMultiple(
Expand Down Expand Up @@ -164,10 +159,11 @@ public function exportXlsAction(): ResponseInterface
->withAddedHeader('Pragma', 'no-cache')
->withBody($this->streamFactory->createStreamFromFile($tmpFilename));
}
return null;
}

/**
* @return void
* @return ResponseInterface
* @throws InvalidQueryException
* @noinspection PhpUnused
*/
Expand All @@ -193,7 +189,7 @@ public function exportCsvAction(): ResponseInterface
}

/**
* @return void
* @return ResponseInterface
* @throws InvalidQueryException
* @throws RouteNotFoundException
* @noinspection PhpUnused
Expand All @@ -219,7 +215,7 @@ public function reportingFormBeAction(): ResponseInterface
}

/**
* @return void
* @return ResponseInterface
* @throws InvalidQueryException
* @throws RouteNotFoundException
* @throws PropertyNotAccessibleException
Expand All @@ -246,7 +242,7 @@ public function reportingMarketingBeAction(): ResponseInterface
}

/**
* @return void
* @return ResponseInterface
* @throws InvalidQueryException
* @throws ExceptionExtbaseObject
* @noinspection PhpUnused
Expand Down Expand Up @@ -289,7 +285,7 @@ protected function sendTestEmail($email = null): void
$body = 'New Test Email from User ' . BackendUtility::getPropertyFromBackendUser('username');
$body .= ' (' . GeneralUtility::getIndpEnv('HTTP_HOST') . ')';
$senderEmail = ConfigurationUtility::getDefaultMailFromAddress('powermail@domain.net');
$this->view->assignMultiple(
$this->moduleTemplate->assignMultiple(
[
'issent' => MailUtility::sendPlainMail($email, $senderEmail, 'New Powermail Test Email', $body),
'email' => $email,
Expand Down
Loading

0 comments on commit bf09eca

Please sign in to comment.