From 4f5aeaa392ffb6a41595f235ce499bcf8facd0e9 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 17 Mar 2021 08:32:51 +0100 Subject: use static proxy files to fix multi-users issue https://github.com/llaville/php-compatinfo-db/issues/71 --- php-bartlett-php-compatinfo-db-3.4-rpm.patch | 22 ++++++++++++++++++++++ php-bartlett-php-compatinfo-db.spec | 9 ++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/php-bartlett-php-compatinfo-db-3.4-rpm.patch b/php-bartlett-php-compatinfo-db-3.4-rpm.patch index a91bdb7..b6553ad 100644 --- a/php-bartlett-php-compatinfo-db-3.4-rpm.patch +++ b/php-bartlett-php-compatinfo-db-3.4-rpm.patch @@ -128,3 +128,25 @@ diff -up ./tests/Reference/GenericTest.php.rpm ./tests/Reference/GenericTest.php self::$optionalreleases = []; +diff -up ./src/Infrastructure/Persistence/Doctrine/EntityManagerFactory.php.rpm ./src/Infrastructure/Persistence/Doctrine/EntityManagerFactory.php +--- ./src/Infrastructure/Persistence/Doctrine/EntityManagerFactory.php.rpm 2021-03-17 08:18:49.451918156 +0100 ++++ ./src/Infrastructure/Persistence/Doctrine/EntityManagerFactory.php 2021-03-17 08:20:26.733494710 +0100 +@@ -31,6 +31,9 @@ final class EntityManagerFactory + public static function create(array $connection, bool $isDevMode, string $proxyDir, Cache $cache = null): EntityManagerInterface + { + $paths = [implode(DIRECTORY_SEPARATOR, [__DIR__, 'Entity'])]; ++ // Static files in RPM mode ++ $isDevMode = false; ++ $proxyDir = dirname(__DIR__, 3) . '/proxies'; + $config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode, $proxyDir, $cache); + if ($isDevMode) { + // suggested for DEV mode: see Doctrine ORM documentation +@@ -38,7 +41,7 @@ final class EntityManagerFactory + $config->setAutogenerateProxyClasses(AbstractProxyFactory::AUTOGENERATE_ALWAYS); + } else { + // lazy generation on PROD or TEST modes (i.e: CI) +- $config->setAutogenerateProxyClasses(AbstractProxyFactory::AUTOGENERATE_FILE_NOT_EXISTS); ++ $config->setAutogenerateProxyClasses(AbstractProxyFactory::AUTOGENERATE_NEVER); + } + + return EntityManager::create(self::connection($connection), $config); diff --git a/php-bartlett-php-compatinfo-db.spec b/php-bartlett-php-compatinfo-db.spec index 0574765..8bfb5bb 100644 --- a/php-bartlett-php-compatinfo-db.spec +++ b/php-bartlett-php-compatinfo-db.spec @@ -31,7 +31,7 @@ Name: php-%{c_vendor}-%{c_project} Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}} -Release: 1%{?dist} +Release: 2%{?dist} Summary: Reference Database to be used with php-compatinfo library License: BSD @@ -41,6 +41,7 @@ Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit # Fix autoloader and config path # Fix sqlite database path # Fix version and avoir composer/package-versions-deprecated (relying on composer.lock) +# Set proxy files as static Patch0: %{name}-3.4-rpm.patch # CURL_SSLVERSION constants have been backported Patch1: %{name}-curltls.patch @@ -144,6 +145,7 @@ Conflicts: php-bartlett-PHP-CompatInfo < 5 : relocate mv config src/config +mkdir src/proxies cat << 'EOF' | tee src/autoload.php compatinfo-db export DATABASE_URL=sqlite:///${PWD}/compatinfo.sqlite +doctrine orm:generate-proxies doctrine orm:schema-tool:create : Generate the references database @@ -269,6 +272,10 @@ exit $ret %changelog +* Wed Mar 17 2021 Remi Collet - 3.4.2-2 +- use static proxy files to fix multi-users issue + https://github.com/llaville/php-compatinfo-db/issues/71 + * Mon Mar 15 2021 Remi Collet - 3.4.2-1 - update to 3.4.2 -- cgit