Fixes
Some checks failed
Gitea Actions / Run-Tests-On-Arm64 (push) Failing after 1m58s
Gitea Actions / Run-Tests-On-Amd64 (push) Failing after 3m33s

This commit is contained in:
Thomas 2025-05-23 15:21:45 +02:00
parent 70d096f866
commit 140badb63e
9 changed files with 105 additions and 84 deletions

View File

@ -8,7 +8,16 @@ services:
- ${APPLICATION_CODE_PATH_HOST?}:${APPLICATION_CODE_PATH_CONTAINER?}
php-cron:
environment:
- PHP_IDE_CONFIG=${PHP_IDE_CONFIG?}
- APP_ENV=dev
networks:
- network
cap_add:
- "SYS_PTRACE"
security_opt:
- "seccomp=unconfined"
extra_hosts:
- host.docker.internal:host-gateway
volumes:
- ${APP_CODE_PATH_HOST?}:${APP_CODE_PATH_CONTAINER?}
web:
@ -28,18 +37,6 @@ services:
volumes:
- ${APP_CODE_PATH_HOST?}:${APP_CODE_PATH_CONTAINER?}
php-cron:
environment:
- PHP_IDE_CONFIG=${PHP_IDE_CONFIG?}
networks:
- network
cap_add:
- "SYS_PTRACE"
security_opt:
- "seccomp=unconfined"
extra_hosts:
- host.docker.internal:host-gateway
chrome:
ports:
- "7900:7900"

View File

@ -21,7 +21,11 @@ class Kernel extends BaseKernel
try {
if (extension_loaded('mongodb')) {
$collection = (new \MongoDB\Client('mongodb://mongodb/'))->psc->Plugin;
if ($_ENV['APP_ENV'] == 'test') {
$collection = (new \MongoDB\Client('mongodb://mongodb/'))->psc_test->Plugin;
} else {
$collection = (new \MongoDB\Client('mongodb://mongodb/'))->psc->Plugin;
}
$plugins = $collection->find(array('installed' => true));

View File

@ -25,7 +25,6 @@ use Symfony\Component\HttpKernel\Bundle\Bundle;
*/
class PSCShopThemeBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
parent::build($container);
@ -33,7 +32,12 @@ class PSCShopThemeBundle extends Bundle
try {
if (extension_loaded('mongodb')) {
$collection = (new \MongoDB\Client('mongodb://mongodb/'))->psc->Plugin;
if ($_ENV['APP_ENV'] == 'test') {
$collection = (new \MongoDB\Client('mongodb://mongodb/'))->psc_test->Plugin;
} else {
$collection = (new \MongoDB\Client('mongodb://mongodb/'))->psc->Plugin;
}
$plugins = $collection->find(array('installed' => true));
foreach ($plugins as $plugin) {

View File

@ -18,13 +18,18 @@ class PluginCompiler implements CompilerPassInterface
public function process(ContainerBuilder $container)
{
try {
$collection = (new \MongoDB\Client('mongodb://mongodb/'))->psc->Plugin;
if ($_ENV['APP_ENV'] == 'test') {
$collection = (new \MongoDB\Client('mongodb://mongodb/'))->psc_test->Plugin;
} else {
$collection = (new \MongoDB\Client('mongodb://mongodb/'))->psc->Plugin;
}
$plugins = $collection->find(array('installed' => true));
/**
* @var Plugin $plugin
* @var Plugin $plugin
*/
foreach ($plugins as $plugin) {
$container->get('doctrine_mongodb.odm.default_metadata_driver')->addDriver(new AnnotationDriver(new AnnotationReader(), $container->getParameter('kernel.project_dir') . '/var/plugins/' . $plugin['path'] . '/Document'), $plugin['path']);
$container->get('doctrine_mongodb.odm.default_metadata_driver')->addDriver(new AnnotationDriver(new AnnotationReader(), $container->getParameter('kernel.project_dir') . '/var/plugins/' . $plugin['path'] . '/Document'), $plugin['path']);
}
} catch (\Exception $e) {
var_dump($e->getMessage());

View File

@ -47,7 +47,12 @@ class PSCSystemPluginExtension extends Extension implements PrependExtensionInte
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.yml');
try {
$collection = (new \MongoDB\Client('mongodb://mongodb/'))->psc->Plugin;
if ($_ENV['APP_ENV'] == 'test') {
$collection = (new \MongoDB\Client('mongodb://mongodb/'))->psc_test->Plugin;
} else {
$collection = (new \MongoDB\Client('mongodb://mongodb/'))->psc->Plugin;
}
$plugins = $collection->find(array('installed' => true));
foreach ($plugins as $plugin) {
if (file_exists($container->getParameter('kernel.project_dir') . '/var/plugins/' . $plugin['path'] . '/Resources/config/services.yml')) {

View File

@ -25,7 +25,12 @@ class RequestListener
public function onKernelRequest(RequestEvent $event)
{
try {
$collection = (new \MongoDB\Client('mongodb://mongodb/'))->psc->Plugin;
if ($_ENV['APP_ENV'] == 'test') {
$collection = (new \MongoDB\Client('mongodb://mongodb/'))->psc_test->Plugin;
} else {
$collection = (new \MongoDB\Client('mongodb://mongodb/'))->psc->Plugin;
}
} catch (\Exception $e) {
return;
}

View File

@ -15,10 +15,10 @@ use Symfony\Component\Yaml\Yaml;
class PluginRouteLoader extends Loader
{
protected $rootDir;
/**
* DynamicRouteLoader constructor.
*
*/
/**
* DynamicRouteLoader constructor.
*
*/
public function __construct($rootDir)
{
$this->rootDir = $rootDir;
@ -37,9 +37,14 @@ class PluginRouteLoader extends Loader
{
$routes = new RouteCollection();
try {
$collection = (new \MongoDB\Client('mongodb://mongodb/'))->psc->Plugin;
if ($_ENV['APP_ENV'] == 'test') {
$collection = (new \MongoDB\Client('mongodb://mongodb/'))->psc_test->Plugin;
} else {
$collection = (new \MongoDB\Client('mongodb://mongodb/'))->psc->Plugin;
}
$plugins = $collection->find(array('installed' => true));
/** @var Plugin $plugin */
/** @var Plugin $plugin */
foreach ($plugins as $plugin) {
if (file_exists($this->rootDir . '/var/plugins/' . $plugin['path'] . '/Resources/config/routing.yml')) {
$importedRoutes = $this->import($this->rootDir . '/var/plugins/' . $plugin['path'] . '/Resources/config/routing.yml', 'yaml');

View File

@ -157,8 +157,6 @@ trait RefreshDatabaseTrait
$doc->clear();
}
return $kernel;
}

View File

@ -35,7 +35,6 @@
*/
class PreflightController extends TP_Controller_Action
{
protected $_extAllow = 'ppt,inx,idml,indd,qxd,ps,cdr,cdx,jpg,gif,pdf,xls,docx,png,doc,jpeg,tif,tiff,ai,eps,psd,phtml,zip,jrxml,ttf,otf,plt,csv,docx,xlsx,pptx,svg';
protected function FileSize($file, $setup = null)
@ -47,8 +46,7 @@ class PreflightController extends TP_Controller_Action
return number_format($FZ / pow(1024, $I = floor(log($FZ, 1024))), ($i >= 1) ? 2 : 0) . ' ' . $FS[$I];
} elseif ($setup == 'INT') {
return number_format($FZ);
}
else {
} else {
return number_format($FZ / pow(1024, $setup), ($setup >= 1) ? 2 : 0) . ' ' . $FS[$setup];
}
}
@ -142,10 +140,10 @@ class PreflightController extends TP_Controller_Action
$xml = file_get_contents(APPLICATION_PATH . '/articles/' . $this->frontend, null);
}
if($article->typ == 100) {
if ($article->typ == 100) {
$xml = $article->getPluginSettings('saxoprint', 'uploadXML');
}
if($article->typ == 101) {
if ($article->typ == 101) {
$xml = $article->getPluginSettings('wmd', 'uploadXML');
}
@ -162,7 +160,7 @@ class PreflightController extends TP_Controller_Action
$checksMessages = array();
foreach ($xml as $article) {
if((string)$article->name != $this->_getParam('kalk_artikel') || !$this->_getParam('kalk_artikel', false)) {
if ((string)$article->name != $this->_getParam('kalk_artikel') || !$this->_getParam('kalk_artikel', false)) {
continue;
}
foreach ($article->uploads->children() as $upload) {
@ -193,7 +191,7 @@ class PreflightController extends TP_Controller_Action
}
}
if ($isPdf && ((int)$check->check_site_count > 0 || $check->check_site_count_rel != "")) {
if (false && $isPdf && ((int)$check->check_site_count > 0 || $check->check_site_count_rel != "")) {
try {
$p = new pdflib();
@ -221,10 +219,10 @@ class PreflightController extends TP_Controller_Action
} elseif (strpos($check->check_site_count_rel, '+')) {
$sum = explode("+", $check->check_site_count_rel);
$seitenCount = 0;
foreach($sum as $sumKey) {
foreach ($sum as $sumKey) {
$seitenCount += $this->_getParam($sumKey);
}
if($seitenCount != $anzahlSeiten) {
if ($seitenCount != $anzahlSeiten) {
$checksMessages[] = array(
'message' => str_replace("{value}", $seitenCount, $check->check_site_count_error_message),
'nr' => $check->nr
@ -234,14 +232,14 @@ class PreflightController extends TP_Controller_Action
} elseif (strpos($check->check_site_count_rel, '*')) {
$sum = explode("*", $check->check_site_count_rel);
$seitenCount = 0;
foreach($sum as $sumKey) {
if($seitenCount == 0) {
foreach ($sum as $sumKey) {
if ($seitenCount == 0) {
$seitenCount = $this->_getParam($sumKey);
}else{
} else {
$seitenCount = $seitenCount * $this->_getParam($sumKey);
}
}
if($seitenCount != $anzahlSeiten) {
if ($seitenCount != $anzahlSeiten) {
$checksMessages[] = array(
'message' => str_replace("{value}", $seitenCount, $check->check_site_count_error_message),
'nr' => $check->nr
@ -372,7 +370,7 @@ class PreflightController extends TP_Controller_Action
$boxes[] = "ArtBox";
}
if ($isPdf && $check->check_fonts_embedded) {
if (false && $isPdf && $check->check_fonts_embedded) {
$p = new pdflib();
$indoc = $p->open_pdi_document($file, "");
@ -380,7 +378,7 @@ class PreflightController extends TP_Controller_Action
for ($i = 0; $i < $fontcount; $i++) {
if($p->pcos_get_number($indoc, "fonts[" . $i . "]/embedded") == 0) {
if ($p->pcos_get_number($indoc, "fonts[" . $i . "]/embedded") == 0) {
$checksMessages[] = array(
'message' => $check->check_fonts_embedded_error_message,
'nr' => $check->nr
@ -391,7 +389,7 @@ class PreflightController extends TP_Controller_Action
}
}
if ($isPdf && count($boxes) > 0 && count($checks) > 0) {
if (false && $isPdf && count($boxes) > 0 && count($checks) > 0) {
$isFormat = false;
@ -404,10 +402,10 @@ class PreflightController extends TP_Controller_Action
foreach ($checks as $ck) {
if (!$isFormat
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/width")) >= $ck['width_from']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/width")) <= $ck['width_to']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/height")) >= $ck['height_from']
if (!$isFormat
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/width")) >= $ck['width_from']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/width")) <= $ck['width_to']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/height")) >= $ck['height_from']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/height")) <= $ck['height_to']
) {
@ -416,14 +414,14 @@ class PreflightController extends TP_Controller_Action
foreach ($boxes as $key => $box) {
try {
if (!$isFormat && ((round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[2]")) >= $ck['width_from']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[2]")) <= $ck['width_to']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[3]")) >= $ck['height_from']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[3]")) <= $ck['height_to'])
|| (round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[2]")-$p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[0]")) >= $ck['width_from']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[2]")-$p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[0]")) <= $ck['width_to']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[3]")-$p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[1]")) >= $ck['height_from']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[3]")-$p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[1]")) <= $ck['height_to']))
if (!$isFormat && ((round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[2]")) >= $ck['width_from']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[2]")) <= $ck['width_to']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[3]")) >= $ck['height_from']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[3]")) <= $ck['height_to'])
|| (round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[2]") - $p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[0]")) >= $ck['width_from']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[2]") - $p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[0]")) <= $ck['width_to']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[3]") - $p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[1]")) >= $ck['height_from']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[3]") - $p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[1]")) <= $ck['height_to']))
) {
$isFormat = true;
@ -529,7 +527,7 @@ class PreflightController extends TP_Controller_Action
}
}
if ($isPdf && ((int)$check->check_site_count || $check->check_site_count_rel)) {
if (false && $isPdf && ((int)$check->check_site_count || $check->check_site_count_rel)) {
$p = new pdflib();
$indoc = $p->open_pdi_document($file, "");
@ -673,7 +671,7 @@ class PreflightController extends TP_Controller_Action
$boxes[] = "ArtBox";
}
if ($isPdf && $check->check_fonts_embedded) {
if (false && $isPdf && $check->check_fonts_embedded) {
$p = new pdflib();
$indoc = $p->open_pdi_document($file, "");
@ -681,7 +679,7 @@ class PreflightController extends TP_Controller_Action
for ($i = 0; $i < $fontcount; $i++) {
if($p->pcos_get_number($indoc, "fonts[" . $i . "]/embedded") == 0) {
if ($p->pcos_get_number($indoc, "fonts[" . $i . "]/embedded") == 0) {
$checksMessages[] = array(
'message' => $check->check_fonts_embedded_error_message,
'nr' => $check->nr
@ -692,7 +690,7 @@ class PreflightController extends TP_Controller_Action
}
}
if ($isPdf && count($boxes) > 0 && count($checks) > 0) {
if (false && $isPdf && count($boxes) > 0 && count($checks) > 0) {
$isFormat = false;
@ -705,10 +703,10 @@ class PreflightController extends TP_Controller_Action
foreach ($checks as $ck) {
if (!$isFormat
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/width")) >= $ck['width_from']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/width")) <= $ck['width_to']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/height")) >= $ck['height_from']
if (!$isFormat
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/width")) >= $ck['width_from']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/width")) <= $ck['width_to']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/height")) >= $ck['height_from']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/height")) <= $ck['height_to']
) {
@ -717,14 +715,14 @@ class PreflightController extends TP_Controller_Action
foreach ($boxes as $key => $box) {
try {
if (!$isFormat && (( round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[2]")) >= $ck['width_from']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[2]")) <= $ck['width_to']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[3]")) >= $ck['height_from']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[3]")) <= $ck['height_to'])
|| (round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[2]")-$p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[0]")) >= $ck['width_from']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[2]")-$p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[0]")) <= $ck['width_to']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[3]")-$p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[1]")) >= $ck['height_from']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[3]")-$p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[1]")) <= $ck['height_to']))
if (!$isFormat && ((round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[2]")) >= $ck['width_from']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[2]")) <= $ck['width_to']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[3]")) >= $ck['height_from']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[3]")) <= $ck['height_to'])
|| (round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[2]") - $p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[0]")) >= $ck['width_from']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[2]") - $p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[0]")) <= $ck['width_to']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[3]") - $p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[1]")) >= $ck['height_from']
&& round($p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[3]") - $p->pcos_get_number($indoc, "pages[" . 0 . "]/" . $box . "[1]")) <= $ck['height_to']))
) {
$isFormat = true;
@ -1009,10 +1007,10 @@ class PreflightController extends TP_Controller_Action
if($article->typ == 100) {
if ($article->typ == 100) {
$xml = $article->getPluginSettings('saxoprint', 'uploadXML');
}
if($article->typ == 101) {
if ($article->typ == 101) {
$xml = $article->getPluginSettings('wmd', 'uploadXML');
}
@ -1021,25 +1019,25 @@ class PreflightController extends TP_Controller_Action
$uploads = array();
$params = $this->_getAllParams();
if($config = $article->getPluginSettings('uploads', 'config')) {
if ($config = $article->getPluginSettings('uploads', 'config')) {
$config = json_decode($config, true);
if(is_array($config['uploads'])) {
if (is_array($config['uploads'])) {
foreach ($config['uploads'] as $upload) {
$up[] = array(
'id' => (string)$upload['id'],
'name' => (string)$upload['name'],
'description' => (string)$upload['description']??''
'description' => (string)$upload['description'] ?? ''
);
if($this->_getParam('which', false)) {
if ($this->_getParam('which', false)) {
$uploads[$this->_getParam('which', 'false')] = $up;
}else{
} else {
$uploads['Kalk'] = $up;
}
}
}
}
if(empty($uploads)) {
if (empty($uploads)) {
foreach ($xml as $article) {
$up = array();
foreach ($article->uploads->children() as $upload) {
@ -1057,13 +1055,13 @@ class PreflightController extends TP_Controller_Action
}
}
$this->view->clearVars();
if($this->_getParam('which', false)) {
if ($this->_getParam('which', false)) {
$this->view->uploads = $uploads[$this->_getParam('which')];
}elseif(count($uploads) > 0) {
} elseif (count($uploads) > 0) {
$this->view->uploads = array_shift($uploads);
}else{
} else {
$this->view->uploads = [];
}
$this->view->success = true;