Merge branch 'master' into php81-migration

This commit is contained in:
Jan Böhmer 2023-06-11 12:20:02 +02:00
commit 624696711d
9 changed files with 671 additions and 646 deletions

2
.gitattributes vendored Normal file
View file

@ -0,0 +1,2 @@
# For sh files, always use LF line endings
*.sh text eol=lf

View file

@ -34,12 +34,25 @@ RUN sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS"
ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log"; \ ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log"; \
ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log"; \ ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log"; \
ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"; \ ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"; \
ln -sfT /dev/stderr /var/log/php8.1-fpm.log; \
chown -R --no-dereference "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$APACHE_LOG_DIR"; chown -R --no-dereference "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$APACHE_LOG_DIR";
# Enable php-fpm # Enable php-fpm
RUN a2enmod proxy_fcgi setenvif && a2enconf php8.1-fpm RUN a2enmod proxy_fcgi setenvif && a2enconf php8.1-fpm
# Configure php-fpm to log to stdout of the container (stdout of PID 1)
# We have to use /proc/1/fd/1 because /dev/stdout or /proc/self/fd/1 does not point to the container stdout (because we use apache as entrypoint)
# We also disable the clear_env option to allow the use of environment variables in php-fpm
RUN { \
echo '[global]'; \
echo 'error_log = /proc/1/fd/1'; \
echo; \
echo '[www]'; \
echo 'access.log = /proc/1/fd/1'; \
echo 'catch_workers_output = yes'; \
echo 'decorate_workers_output = no'; \
echo 'clear_env = no'; \
} | tee "/etc/php/8.1/fpm/pool.d/zz-docker.conf"
# PHP files should be handled by PHP, and should be preferred over any other file type # PHP files should be handled by PHP, and should be preferred over any other file type
RUN { \ RUN { \
echo '<FilesMatch \.php$>'; \ echo '<FilesMatch \.php$>'; \

View file

@ -1 +1 @@
1.4.1 1.4.2

58
composer.lock generated
View file

@ -2392,16 +2392,16 @@
}, },
{ {
"name": "imagine/imagine", "name": "imagine/imagine",
"version": "1.3.4", "version": "1.3.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-imagine/Imagine.git", "url": "https://github.com/php-imagine/Imagine.git",
"reference": "c9ba67d2f1dc0785187261a656cb55ff01f594be" "reference": "7151d553edec4dc2bbac60419f7a74ff34700e7f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-imagine/Imagine/zipball/c9ba67d2f1dc0785187261a656cb55ff01f594be", "url": "https://api.github.com/repos/php-imagine/Imagine/zipball/7151d553edec4dc2bbac60419f7a74ff34700e7f",
"reference": "c9ba67d2f1dc0785187261a656cb55ff01f594be", "reference": "7151d553edec4dc2bbac60419f7a74ff34700e7f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2448,9 +2448,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/php-imagine/Imagine/issues", "issues": "https://github.com/php-imagine/Imagine/issues",
"source": "https://github.com/php-imagine/Imagine/tree/1.3.4" "source": "https://github.com/php-imagine/Imagine/tree/1.3.5"
}, },
"time": "2023-04-17T15:21:07+00:00" "time": "2023-06-07T14:49:52+00:00"
}, },
{ {
"name": "jbtronics/2fa-webauthn", "name": "jbtronics/2fa-webauthn",
@ -12404,16 +12404,16 @@
}, },
{ {
"name": "twig/extra-bundle", "name": "twig/extra-bundle",
"version": "v3.6.0", "version": "v3.6.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/twigphp/twig-extra-bundle.git", "url": "https://github.com/twigphp/twig-extra-bundle.git",
"reference": "4a9674e775f49a9df5e26da66546e8f3364afe67" "reference": "802cc2dd46ec88285d6c7fa85c26ab7f2cd5bc49"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/twigphp/twig-extra-bundle/zipball/4a9674e775f49a9df5e26da66546e8f3364afe67", "url": "https://api.github.com/repos/twigphp/twig-extra-bundle/zipball/802cc2dd46ec88285d6c7fa85c26ab7f2cd5bc49",
"reference": "4a9674e775f49a9df5e26da66546e8f3364afe67", "reference": "802cc2dd46ec88285d6c7fa85c26ab7f2cd5bc49",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -12462,7 +12462,7 @@
"twig" "twig"
], ],
"support": { "support": {
"source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.6.0" "source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.6.1"
}, },
"funding": [ "funding": [
{ {
@ -12474,7 +12474,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-04-14T11:03:02+00:00" "time": "2023-05-06T11:11:46+00:00"
}, },
{ {
"name": "twig/html-extra", "name": "twig/html-extra",
@ -12740,16 +12740,16 @@
}, },
{ {
"name": "twig/twig", "name": "twig/twig",
"version": "v3.6.0", "version": "v3.6.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/twigphp/Twig.git", "url": "https://github.com/twigphp/Twig.git",
"reference": "106c170d08e8415d78be2d16c3d057d0d108262b" "reference": "7e7d5839d4bec168dfeef0ac66d5c5a2edbabffd"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/106c170d08e8415d78be2d16c3d057d0d108262b", "url": "https://api.github.com/repos/twigphp/Twig/zipball/7e7d5839d4bec168dfeef0ac66d5c5a2edbabffd",
"reference": "106c170d08e8415d78be2d16c3d057d0d108262b", "reference": "7e7d5839d4bec168dfeef0ac66d5c5a2edbabffd",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -12795,7 +12795,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/twigphp/Twig/issues", "issues": "https://github.com/twigphp/Twig/issues",
"source": "https://github.com/twigphp/Twig/tree/v3.6.0" "source": "https://github.com/twigphp/Twig/tree/v3.6.1"
}, },
"funding": [ "funding": [
{ {
@ -12807,7 +12807,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-05-03T19:06:57+00:00" "time": "2023-06-08T12:52:13+00:00"
}, },
{ {
"name": "ua-parser/uap-php", "name": "ua-parser/uap-php",
@ -14293,16 +14293,16 @@
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.10.16", "version": "1.10.18",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "352bdbb960bb523e3d71b834862589f910921c23" "reference": "52b6416c579663eebdd2f1d97df21971daf3b43f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/352bdbb960bb523e3d71b834862589f910921c23", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/52b6416c579663eebdd2f1d97df21971daf3b43f",
"reference": "352bdbb960bb523e3d71b834862589f910921c23", "reference": "52b6416c579663eebdd2f1d97df21971daf3b43f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -14351,7 +14351,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-06-05T08:21:46+00:00" "time": "2023-06-07T22:00:43+00:00"
}, },
{ {
"name": "phpstan/phpstan-doctrine", "name": "phpstan/phpstan-doctrine",
@ -14626,12 +14626,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/Roave/SecurityAdvisories.git", "url": "https://github.com/Roave/SecurityAdvisories.git",
"reference": "9c9ca2f0d98a07cd23c775deba37639036cfd00a" "reference": "22b763b5abdc69572b66c462cd85c2b2135f56aa"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/9c9ca2f0d98a07cd23c775deba37639036cfd00a", "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/22b763b5abdc69572b66c462cd85c2b2135f56aa",
"reference": "9c9ca2f0d98a07cd23c775deba37639036cfd00a", "reference": "22b763b5abdc69572b66c462cd85c2b2135f56aa",
"shasum": "" "shasum": ""
}, },
"conflict": { "conflict": {
@ -14787,7 +14787,7 @@
"friendsofsymfony/user-bundle": ">=1.2,<1.3.5", "friendsofsymfony/user-bundle": ">=1.2,<1.3.5",
"friendsoftypo3/mediace": ">=7.6.2,<7.6.5", "friendsoftypo3/mediace": ">=7.6.2,<7.6.5",
"froala/wysiwyg-editor": "<3.2.7", "froala/wysiwyg-editor": "<3.2.7",
"froxlor/froxlor": "<2.0.16", "froxlor/froxlor": "<2.0.20",
"fuel/core": "<1.8.1", "fuel/core": "<1.8.1",
"funadmin/funadmin": "<=3.2", "funadmin/funadmin": "<=3.2",
"gaoming13/wechat-php-sdk": "<=1.10.2", "gaoming13/wechat-php-sdk": "<=1.10.2",
@ -14889,7 +14889,7 @@
"melisplatform/melis-front": "<5.0.1", "melisplatform/melis-front": "<5.0.1",
"mezzio/mezzio-swoole": "<3.7|>=4,<4.3", "mezzio/mezzio-swoole": "<3.7|>=4,<4.3",
"mgallegos/laravel-jqgrid": "<=1.3", "mgallegos/laravel-jqgrid": "<=1.3",
"microweber/microweber": "<1.3.4", "microweber/microweber": "<=1.3.4",
"miniorange/miniorange-saml": "<1.4.3", "miniorange/miniorange-saml": "<1.4.3",
"mittwald/typo3_forum": "<1.2.1", "mittwald/typo3_forum": "<1.2.1",
"mobiledetect/mobiledetectlib": "<2.8.32", "mobiledetect/mobiledetectlib": "<2.8.32",
@ -15227,7 +15227,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-06-06T21:04:56+00:00" "time": "2023-06-09T23:04:09+00:00"
}, },
{ {
"name": "sebastian/diff", "name": "sebastian/diff",

View file

@ -176,6 +176,11 @@ class ResetAutoIncrementORMPurger implements PurgerInterface, ORMPurgerInterface
continue; continue;
} }
// The table name might be quoted, we have to trim it
// See https://github.com/Part-DB/Part-DB-server/issues/299
$tbl = trim($tbl, '"');
$tbl = trim($tbl, '`');
// If the table is excluded, skip it as well // If the table is excluded, skip it as well
if (in_array($tbl, $this->excluded, true)) { if (in_array($tbl, $this->excluded, true)) {
continue; continue;

View file

@ -43,8 +43,8 @@ class PKImportHelper
*/ */
public function purgeDatabaseForImport(): void public function purgeDatabaseForImport(): void
{ {
//Versions with "" are needed !! //We use the ResetAutoIncrementORMPurger to reset the auto increment values of the tables. Also it normalizes table names before checking for exclusion.
$purger = new ResetAutoIncrementORMPurger($this->em, ['users', '"users"', 'groups', '"groups"', 'u2f_keys', 'internal', 'migration_versions']); $purger = new ResetAutoIncrementORMPurger($this->em, ['users', 'groups', 'u2f_keys', 'internal', 'migration_versions']);
$purger->purge(); $purger->purge();
} }

View file

@ -33,7 +33,7 @@
{% block admin_info %} {% block admin_info %}
You could try to do following things, if this error is unexpected: You could try to do following things, if this error is unexpected:
<ul> <ul>
<li>Check <code>var/log/prod.log</code> for additional informations</li> <li>Check <code>var/log/prod.log</code> (or <code>docker logs</code> when Part-DB is running inside a docker container) for additional informations</li>
<li>Run <kbd>php bin/console cache:clear</kbd> to clear cache</li> <li>Run <kbd>php bin/console cache:clear</kbd> to clear cache</li>
</ul> </ul>
{% endblock %} {% endblock %}

View file

@ -19,17 +19,27 @@
<li>Run <kbd>yarn install</kbd> and <kbd>yarn build</kbd> in Part-DB folder.</li> <li>Run <kbd>yarn install</kbd> and <kbd>yarn build</kbd> in Part-DB folder.</li>
<li>Run <kbd>php bin/console cache:clear</kbd></li> <li>Run <kbd>php bin/console cache:clear</kbd></li>
</ul> </ul>
{% elseif exception.class == "Doctrine\\DBAL\\Exception\\InvalidFieldNameException" or exception.class == "Doctrine\\DBAL\\Exception\\TableNotFoundException" %} {% elseif exception.class == "Doctrine\\DBAL\\Exception\\InvalidFieldNameException"
or exception.class == "Doctrine\\DBAL\\Exception\\TableNotFoundException"
%}
<b><i>Invalid or not existing database schema.</i></b><br><p>Try following things:</p> <b><i>Invalid or not existing database schema.</i></b><br><p>Try following things:</p>
<ul> <ul>
<li>Check if the <code>DATABASE_URL</code> in <code>.env.local</code> is correct</li> <li>Check if the <code>DATABASE_URL</code> in <code>.env.local</code> (or docker configure) is correct</li>
<li>Run <kbd>php bin/console doctrine:migrations:migrate</kbd> to upgrade database schema</li> <li>Run <kbd>php bin/console doctrine:migrations:migrate</kbd> to upgrade database schema</li>
<li>Run <kbd>php bin/console cache:clear</kbd></li> <li>Run <kbd>php bin/console cache:clear</kbd></li>
</ul> </ul>
{% elseif exception.class == "Doctrine\\DBAL\\Exception\\DriverException" %}
<b><i>Error while executing database query.</i></b><br>This is maybe caused by an old database schema.<br><p>Try following things:</p>
<ul>
<li>Check if the <code>DATABASE_URL</code> in <code>.env.local</code> (or docker configure) is correct</li>
<li>Run <kbd>php bin/console doctrine:migrations:migrate</kbd> to upgrade database schema (if upgrade is available)</li>
<li>Run <kbd>php bin/console cache:clear</kbd></li>
<li>If this issue persist, create a ticket at <a href="https://github.com/Part-DB/Part-DB-symfony/issues" rel="noopener">GitHub</a>.</li>
</ul>
{% else %} {% else %}
You could try following things, if this error is unexpected: You could try following things, if this error is unexpected:
<ul> <ul>
<li>Check <code>var/log/prod.log</code> for additional informations</li> <li>Check <code>var/log/prod.log</code> (or <code>docker logs</code> when Part-DB is running inside a docker container) for additional informations</li>
<li>Run <kbd>php bin/console cache:clear</kbd> to clear cache</li> <li>Run <kbd>php bin/console cache:clear</kbd> to clear cache</li>
</ul> </ul>
{% endif %} {% endif %}

1213
yarn.lock

File diff suppressed because it is too large Load diff