diff --git a/CacheWarmer/HydratorCacheWarmer.php b/CacheWarmer/HydratorCacheWarmer.php index 603cff34..17fea048 100644 --- a/CacheWarmer/HydratorCacheWarmer.php +++ b/CacheWarmer/HydratorCacheWarmer.php @@ -14,6 +14,7 @@ use function assert; use function dirname; use function file_exists; +use function is_dir; use function is_writable; use function mkdir; use function sprintf; @@ -58,7 +59,7 @@ public function warmUp($cacheDir) // we need the directory no matter the hydrator cache generation strategy. $hydratorCacheDir = (string) $this->container->getParameter('doctrine_mongodb.odm.hydrator_dir'); if (! file_exists($hydratorCacheDir)) { - if (@mkdir($hydratorCacheDir, 0775, true) === false) { + if (@mkdir($hydratorCacheDir, 0775, true) === false && ! is_dir($hydratorCacheDir)) { throw new RuntimeException(sprintf('Unable to create the Doctrine Hydrator directory (%s)', dirname($hydratorCacheDir))); } } elseif (! is_writable($hydratorCacheDir)) { diff --git a/CacheWarmer/PersistentCollectionCacheWarmer.php b/CacheWarmer/PersistentCollectionCacheWarmer.php index 2abafe24..b39c7371 100644 --- a/CacheWarmer/PersistentCollectionCacheWarmer.php +++ b/CacheWarmer/PersistentCollectionCacheWarmer.php @@ -16,6 +16,7 @@ use function dirname; use function file_exists; use function in_array; +use function is_dir; use function is_writable; use function mkdir; use function sprintf; @@ -60,7 +61,7 @@ public function warmUp($cacheDir) // we need the directory no matter the hydrator cache generation strategy. $collCacheDir = (string) $this->container->getParameter('doctrine_mongodb.odm.persistent_collection_dir'); if (! file_exists($collCacheDir)) { - if (@mkdir($collCacheDir, 0775, true) === false) { + if (@mkdir($collCacheDir, 0775, true) === false && ! is_dir($collCacheDir)) { throw new RuntimeException(sprintf('Unable to create the Doctrine persistent collection directory (%s)', dirname($collCacheDir))); } } elseif (! is_writable($collCacheDir)) { diff --git a/CacheWarmer/ProxyCacheWarmer.php b/CacheWarmer/ProxyCacheWarmer.php index 12d24531..959f007b 100644 --- a/CacheWarmer/ProxyCacheWarmer.php +++ b/CacheWarmer/ProxyCacheWarmer.php @@ -16,6 +16,7 @@ use function assert; use function dirname; use function file_exists; +use function is_dir; use function is_writable; use function mkdir; use function sprintf; @@ -60,7 +61,7 @@ public function warmUp($cacheDir) // we need the directory no matter the proxy cache generation strategy. $proxyCacheDir = (string) $this->container->getParameter('doctrine_mongodb.odm.proxy_dir'); if (! file_exists($proxyCacheDir)) { - if (@mkdir($proxyCacheDir, 0775, true) === false) { + if (@mkdir($proxyCacheDir, 0775, true) === false && ! is_dir($proxyCacheDir)) { throw new RuntimeException(sprintf('Unable to create the Doctrine Proxy directory (%s)', dirname($proxyCacheDir))); } } elseif (! is_writable($proxyCacheDir)) { diff --git a/DependencyInjection/Compiler/CreateHydratorDirectoryPass.php b/DependencyInjection/Compiler/CreateHydratorDirectoryPass.php index 7f0fd118..60700405 100644 --- a/DependencyInjection/Compiler/CreateHydratorDirectoryPass.php +++ b/DependencyInjection/Compiler/CreateHydratorDirectoryPass.php @@ -30,7 +30,7 @@ public function process(ContainerBuilder $container) // Create document proxy directory $hydratorCacheDir = (string) $container->getParameter('doctrine_mongodb.odm.hydrator_dir'); if (! is_dir($hydratorCacheDir)) { - if (@mkdir($hydratorCacheDir, 0775, true) === false) { + if (@mkdir($hydratorCacheDir, 0775, true) === false && ! is_dir($hydratorCacheDir)) { throw new RuntimeException( sprintf('Unable to create the Doctrine Hydrator directory (%s)', dirname($hydratorCacheDir)) ); diff --git a/DependencyInjection/Compiler/CreateProxyDirectoryPass.php b/DependencyInjection/Compiler/CreateProxyDirectoryPass.php index ef7c912c..6c43ac01 100644 --- a/DependencyInjection/Compiler/CreateProxyDirectoryPass.php +++ b/DependencyInjection/Compiler/CreateProxyDirectoryPass.php @@ -30,7 +30,7 @@ public function process(ContainerBuilder $container) // Create document proxy directory $proxyCacheDir = (string) $container->getParameter('doctrine_mongodb.odm.proxy_dir'); if (! is_dir($proxyCacheDir)) { - if (@mkdir($proxyCacheDir, 0775, true) === false) { + if (@mkdir($proxyCacheDir, 0775, true) === false && ! is_dir($proxyCacheDir)) { throw new RuntimeException( sprintf('Unable to create the Doctrine Proxy directory (%s)', dirname($proxyCacheDir)) );