-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from itx-informationssysteme/develop
2.0.0 - [BREAKING] TYPO3 11 support and new features - see changelog for more information * [BREAKING] added static coding analysis via phpstan * [FEATURE] upgrade to TYPO3 11. Removed support for older versions * [BREAKING] removed vhs dependency * make sure to compare the templates, if you have overrides * [FIX] fixed position of traits * [BREAKING] fixed filter and reworked pagination on postings list * make sure to compare the templates and css, if you have overrides * [FEATURE] added configurable page size via flexform to postings plugin * [FIX] refactoring of google jobs structured data * [BREAKING] replaced signal slots in favor of events * please change your implementations if you used signal slots previously * [FEATURE] use new language configuration in tca * [FIX]: fixed problems of postings filter caching in multilanguage setup * [BREAKING]: postings can have multiple locations now * make sure to use the upgrade wizard to migrate entries in the location field to the new locations field and its corresponding mm table * make sure to compare the templates, if you have overrides * [FEATURE]: redesigned posting tca (more place for slugs, etc) * [FIX]: fixed error where postings could not be translated when no contact was selected
- Loading branch information
Showing
102 changed files
with
2,047 additions
and
8,716 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Static analysis | ||
|
||
on: [ push, pull_request ] | ||
|
||
jobs: | ||
phpstan: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
- php-version: 7.4 | ||
- php-version: 8.0 | ||
- php-version: 8.1 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}-${{ matrix.php-version }} | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
- uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
coverage: none | ||
|
||
- run: composer install --no-progress | ||
|
||
- run: vendor/bin/phpstan analyse Classes -c phpstan.neon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
<?php | ||
|
||
namespace ITX\Jobapplications\Command; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2020 | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
* free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The GNU General Public License can be found at | ||
* http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This script 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 General Public License for more details. | ||
* | ||
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
|
||
use ITX\Jobapplications\Domain\Model\Application; | ||
use ITX\Jobapplications\Domain\Repository\ApplicationRepository; | ||
use ITX\Jobapplications\Service\ApplicationFileService; | ||
use Psr\Log\LoggerInterface; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use TYPO3\CMS\Core\Resource\Exception\InsufficientFolderAccessPermissionsException; | ||
use TYPO3\CMS\Core\Resource\Exception\InvalidFileNameException; | ||
use TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException; | ||
use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; | ||
|
||
/** | ||
* Task for deleting all applications older than a specific amount of time | ||
* | ||
* @package ITX\Jobapplications | ||
*/ | ||
class AnonymizeApplicationsCommand extends Command | ||
{ | ||
private LoggerInterface $logger; | ||
|
||
public int $days = 90; | ||
public int $status = 0; | ||
|
||
protected PersistenceManager $persistenceManager; | ||
protected ApplicationRepository $applicationRepository; | ||
protected ApplicationFileService $applicationFileService; | ||
|
||
public function __construct(PersistenceManager $persistenceManager, | ||
ApplicationRepository $applicationRepository, | ||
ApplicationFileService $applicationFileService, | ||
LoggerInterface $logger | ||
) | ||
{ | ||
$this->persistenceManager = $persistenceManager; | ||
$this->applicationRepository = $applicationRepository; | ||
$this->applicationFileService = $applicationFileService; | ||
$this->logger = $logger; | ||
|
||
parent::__construct(); | ||
} | ||
|
||
public function configure() | ||
{ | ||
$this | ||
->setDescription("Anonymizes applications that are older than the specified days.") | ||
->addArgument("days", InputArgument::OPTIONAL, "How old can an application be before is should be deleted?", 90) | ||
->addOption("withStatus", "s", InputOption::VALUE_NONE, "Should applications only be deleted if they are in an end status?"); | ||
} | ||
|
||
/** | ||
* This is the main method that is called when a task is executed | ||
* Should return TRUE on successful execution, FALSE on error. | ||
* | ||
* @return int Returns TRUE on successful execution, FALSE on error | ||
* @throws InvalidFileNameException | ||
* @throws InsufficientFolderAccessPermissionsException | ||
* @throws InvalidQueryException | ||
*/ | ||
public function execute($input, $output): int | ||
{ | ||
$anonymizeChars = "***"; | ||
$days = $input->getArgument('days') ?? 90; | ||
$withStatus = $input->getOption('withStatus') ?? false; | ||
|
||
$now = new \DateTime(); | ||
$timestamp = $now->modify("-".$days." days")->getTimestamp(); | ||
|
||
$applications = $this->applicationRepository->findOlderThan($timestamp, $withStatus, true); | ||
|
||
$resultCount = count($applications); | ||
|
||
/* @var Application $application */ | ||
foreach ($applications as $application) | ||
{ | ||
// Actual anonymization + deleting application files | ||
|
||
/* @var ApplicationFileService $applicationFileService */ | ||
$fileStorage = $this->applicationFileService->getFileStorage($application); | ||
|
||
$this->applicationFileService->deleteApplicationFolder($this->applicationFileService->getApplicantFolder($application), $fileStorage); | ||
|
||
$application->setFirstName($anonymizeChars); | ||
$application->setLastName($anonymizeChars); | ||
$application->setAddressStreetAndNumber($anonymizeChars); | ||
$application->setAddressAddition($anonymizeChars); | ||
$application->setAddressPostCode(0); | ||
$application->setEmail("[email protected]"); | ||
$application->setPhone($anonymizeChars); | ||
$application->setMessage($anonymizeChars); | ||
$application->setArchived(true); | ||
$application->setSalutation(""); | ||
$application->setSalaryExpectation($anonymizeChars); | ||
$application->setEarliestDateOfJoining(new \DateTime("@0")); | ||
$application->setAnonymized(true); | ||
|
||
$this->applicationRepository->update($application); | ||
} | ||
|
||
if ($resultCount > 0) | ||
{ | ||
$this->persistenceManager->persistAll(); | ||
} | ||
|
||
$this->logger->info('[ITX\\Jobapplications\\Task\\AnonymizeApplications]: '.$resultCount.' applications anonymized.'); | ||
$output->writeln("$resultCount applications anonymized."); | ||
|
||
return Command::SUCCESS; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<?php | ||
|
||
namespace ITX\Jobapplications\Command; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2020 | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
* free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The GNU General Public License can be found at | ||
* http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This script 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 General Public License for more details. | ||
* | ||
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
|
||
use ITX\Jobapplications\Domain\Repository\ApplicationRepository; | ||
use ITX\Jobapplications\Service\ApplicationFileService; | ||
use Psr\Log\LoggerInterface; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use TYPO3\CMS\Core\Resource\Exception\InsufficientFolderAccessPermissionsException; | ||
use TYPO3\CMS\Core\Resource\Exception\InvalidFileNameException; | ||
use TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException; | ||
use TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException; | ||
use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; | ||
|
||
/** | ||
* Task for deleting all applications older than a specific amount of time | ||
* | ||
* @package ITX\Jobapplications | ||
*/ | ||
class CleanUpApplicationsCommand extends Command | ||
{ | ||
private LoggerInterface $logger; | ||
|
||
protected PersistenceManager $persistenceManager; | ||
protected ApplicationRepository $applicationRepository; | ||
protected ApplicationFileService $applicationFileService; | ||
|
||
public function __construct(PersistenceManager $persistenceManager, | ||
ApplicationRepository $applicationRepository, | ||
ApplicationFileService $applicationFileService, | ||
LoggerInterface $logger) | ||
{ | ||
$this->persistenceManager = $persistenceManager; | ||
$this->applicationRepository = $applicationRepository; | ||
$this->applicationFileService = $applicationFileService; | ||
$this->logger = $logger; | ||
|
||
parent::__construct(); | ||
} | ||
|
||
public function configure() | ||
{ | ||
$this | ||
->setDescription("Deletes applications that are older than the specified days.") | ||
->addArgument("days", InputArgument::OPTIONAL, "How old can an application be before is should be deleted?", 90) | ||
->addOption("withStatus", "s", InputOption::VALUE_NONE, "Should applications only be deleted if they are in an end status?"); | ||
} | ||
|
||
/** | ||
* This is the main method that is called when a task is executed | ||
* Should return TRUE on successful execution, FALSE on error. | ||
* | ||
* @return int Returns TRUE on successful execution, FALSE on error | ||
* @throws InvalidFileNameException | ||
* @throws InsufficientFolderAccessPermissionsException | ||
* @throws InvalidQueryException | ||
* @throws IllegalObjectTypeException | ||
*/ | ||
public function execute($input, $output): int | ||
{ | ||
$days = $input->getArgument('days') ?? 90; | ||
$withStatus = $input->getOption('withStatus') ?? false; | ||
|
||
$now = new \DateTime(); | ||
$timestamp = $now->modify("-".$days." days")->getTimestamp(); | ||
|
||
$applications = $this->applicationRepository->findOlderThan($timestamp, $withStatus); | ||
|
||
$resultCount = count($applications); | ||
|
||
foreach ($applications as $application) | ||
{ | ||
$fileStorage = $this->applicationFileService->getFileStorage($application); | ||
$this->applicationRepository->remove($application); | ||
|
||
$this->applicationFileService->deleteApplicationFolder($this->applicationFileService->getApplicantFolder($application), $fileStorage); | ||
} | ||
|
||
if ($resultCount > 0) | ||
{ | ||
$this->persistenceManager->persistAll(); | ||
} | ||
|
||
$this->logger->info('[ITX\\Jobapplications\\Task\\CleanUpApplications]: '.$resultCount.' applications deleted.'); | ||
$output->writeln("$resultCount applications deleted."); | ||
|
||
return Command::SUCCESS; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.