Skip to content
Snippets Groups Projects
Commit 2127527a authored by Patrick Schriner's avatar Patrick Schriner
Browse files

Merge branch 'main' into 'release'

ci: extension pipeline

See merge request gsb11/extensions/gsb_metadata_cleaner!64
parents 6330eb99 61e33e0e
No related branches found
Tags v1.3.5
No related merge requests found
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
# TS/JS-Files
[*.{ts,js}]
indent_size = 2
# JSON-Files
[*.json]
indent_style = tab
# ReST-Files
[*.{rst,rst.txt}]
indent_size = 4
max_line_length = 80
# Markdown-Files
[*.md]
max_line_length = 80
# YAML-Files
[*.{yaml,yml}]
indent_size = 2
# CSS/SCSS-Files
[*.{css,scss}]
indent_size = 2
# NEON-Files
[*.neon]
indent_size = 2
indent_style = tab
# package.json
[package.json]
indent_size = 2
# TypoScript
[*.{typoscript,tsconfig}]
indent_size = 2
# XLF-Files
[*.xlf]
indent_style = tab
# SQL-Files
[*.sql]
indent_style = tab
indent_size = 2
# .htaccess
[{_.htaccess,.htaccess}]
indent_style = tab
---
stages:
- build
- lint
- build-app
- test
- semver
- release
- trigger
include:
- project: 'gsb11/gitlab-scripts'
ref: main
file: 'default-extension.yml'
- component: ${CI_SERVER_HOST}/gsb11/gitlab-ci-cd-components/gsb-extensions/build@1.0.4
---
plugins:
- - "@semantic-release/commit-analyzer"
- preset: 'conventionalcommits'
......
......@@ -26,7 +26,6 @@ namespace ITZBund\GsbMetadataCleaner\Configuration;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
use RuntimeException;
use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException;
use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration as CoreExtensionConfiguration;
......@@ -55,7 +54,7 @@ final class ExtensionConfiguration
$exifToolPath = trim($this->extensionConfiguration->get('gsb_metadata_cleaner', 'exifToolPath'));
if (!$this->utilityExistsAndIsSafe($exifToolPath, self::EXIFTOOL_BINARY)) {
throw new RuntimeException('exitfool path not properly configured', 1710517552);
throw new \RuntimeException('exitfool path not properly configured', 1710517552);
}
return $exifToolPath . self::EXIFTOOL_BINARY;
......@@ -71,7 +70,7 @@ final class ExtensionConfiguration
$qpdfToolPath = trim($this->extensionConfiguration->get('gsb_metadata_cleaner', 'qpdfToolPath'));
if (!$this->utilityExistsAndIsSafe($qpdfToolPath, self::QPDF_BINARY)) {
throw new RuntimeException('qpdf path not properly configured', 1710517551);
throw new \RuntimeException('qpdf path not properly configured', 1710517551);
}
return $qpdfToolPath . self::QPDF_BINARY;
......
......@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace ITZBund\GsbMetadataCleaner\EventListener;
use Exception;
use ITZBund\GsbMetadataCleaner\Service\ExifToolService;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
......@@ -46,7 +45,7 @@ class BeforeFileAddedEventListener
if ($this->exifToolService->canProcessFile($file)) {
try {
$this->exifToolService->removeMetadata($file);
} catch (Exception $re) {
} catch (\Exception $re) {
$this->logger->log(LogLevel::ERROR, $re->getMessage());
}
}
......
......@@ -25,7 +25,6 @@ declare(strict_types=1);
namespace ITZBund\GsbMetadataCleaner\Service;
use Doctrine\DBAL\Exception;
use InvalidArgumentException;
use ITZBund\GsbMetadataCleaner\Configuration\ExtensionConfiguration as GsbMetadataCleanerExtensionConfiguration;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
......@@ -34,7 +33,6 @@ use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Resource\FileInterface;
use TYPO3\CMS\Core\Utility\CommandUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use UnexpectedValueException;
class ExifToolService
{
......@@ -82,13 +80,13 @@ class ExifToolService
*
* @param FileInterface $file the file to be processesed
*
* @throws InvalidArgumentException
* @throws \InvalidArgumentException
*/
public function removeMetadata(FileInterface $file): void
{
$filePath = $file->getStorage()->getFileForLocalProcessing($file, false);
if (!is_file($filePath) && !is_writable($filePath)) {
throw new InvalidArgumentException('File not writeable', 1701857184);
throw new \InvalidArgumentException('File not writeable', 1701857184);
}
$command = sprintf(
'%s -overwrite_original -all= -tagsFromFile @ %s %s',
......@@ -128,13 +126,13 @@ class ExifToolService
* This results in old tags beeing deleted for good and the pdf getting optimized for the web
*
* @param FileInterface $file the file to be processed
* @throws InvalidArgumentException
* @throws \InvalidArgumentException
*/
protected function linearizePdf(FileInterface $file): void
{
$filePath = $file->getStorage()->getFileForLocalProcessing($file, false);
if (!is_file($filePath) && !is_writable($filePath)) {
throw new InvalidArgumentException('File not writeable', 1701857185);
throw new \InvalidArgumentException('File not writeable', 1701857185);
}
$command = sprintf(
'%s --replace-input --linearize %s',
......@@ -156,8 +154,8 @@ class ExifToolService
*
* @param FileInterface $file the processed file
* @return string
* @throws InvalidArgumentException
* @throws UnexpectedValueException
* @throws \InvalidArgumentException
* @throws \UnexpectedValueException
* @throws Exception
*/
protected function getEscapedTagArguments(FileInterface $file): string
......@@ -180,8 +178,8 @@ class ExifToolService
* Get the exiftool_keep_pd_tags value of the file's storage as an array
*
* @return array<string>
* @throws InvalidArgumentException
* @throws UnexpectedValueException
* @throws \InvalidArgumentException
* @throws \UnexpectedValueException
* @throws Exception
*/
protected function getKeepTagsForPdfFromStorage(FileInterface $file): array
......@@ -203,8 +201,8 @@ class ExifToolService
* Get the exiftool_keep_image_tags value of the file's storage as an array
*
* @return array<string>
* @throws InvalidArgumentException
* @throws UnexpectedValueException
* @throws \InvalidArgumentException
* @throws \UnexpectedValueException
* @throws Exception
*/
protected function getKeepTagsForImageFromStorage(FileInterface $file): array
......
......@@ -45,7 +45,7 @@
"squizlabs/php_codesniffer": "^3.7",
"ssch/typo3-rector": "^1.1",
"symfony/yaml": "^6.1",
"typo3/coding-standards": "^0.7",
"typo3/coding-standards": "^0.8",
"typo3/testing-framework": "^8.1"
},
"repositories": [
......
<?xml version="1.0"?>
<phpmd-baseline>
<violation rule="PHPMD\Rule\Naming\LongVariable" file="Classes/Configuration/ExtensionConfiguration.php"/>
<violation rule="PHPMD\Rule\CleanCode\MissingImport" file="Classes/Configuration/ExtensionConfiguration.php"/>
<violation rule="PHPMD\Rule\CleanCode\StaticAccess" file="Classes/Configuration/ExtensionConfiguration.php"/>
<violation rule="PHPMD\Rule\Naming\LongVariable" file="Classes/Service/ExifToolService.php"/>
<violation rule="PHPMD\Rule\CleanCode\MissingImport" file="Classes/Service/ExifToolService.php"/>
<violation rule="PHPMD\Rule\CleanCode\StaticAccess" file="Classes/Service/ExifToolService.php"/>
<violation rule="PHPMD\Rule\CleanCode\ElseExpression" file="Classes/Service/ExifToolService.php"/>
</phpmd-baseline>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.