From 1e9fbd617079ac9ede7cec72bb1207584de66a33 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 21 Nov 2016 11:58:51 +0100 Subject: [PATCH 1/3] Added a tip about the TMPDIR env variable --- components/filesystem/lock_handler.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/filesystem/lock_handler.rst b/components/filesystem/lock_handler.rst index 5d442e79547..e28449d64d8 100644 --- a/components/filesystem/lock_handler.rst +++ b/components/filesystem/lock_handler.rst @@ -52,6 +52,12 @@ By default, the lock will be created in the temporary directory, but you can optionally select the directory where locks are created by passing it as the second argument of the constructor. +.. tip:: + + Another way to configure the directory where the locks are created is to + define the ``TMPDIR`` environment variable. This is useful for example when + deploying a third-party Symfony application whose code can't be modified. + The :method:`Symfony\\Component\\Filesystem\\LockHandler::lock` method tries to acquire the lock. If the lock is acquired, the method returns ``true``, ``false`` otherwise. If the ``lock`` method is called several times on the same From db75231fbeb5ed3d5833d74356cea5b4f32e5de3 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 21 Nov 2016 15:28:14 +0100 Subject: [PATCH 2/3] Reworded the tip to support Windows --- components/filesystem/lock_handler.rst | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/components/filesystem/lock_handler.rst b/components/filesystem/lock_handler.rst index e28449d64d8..07dda34f8ab 100644 --- a/components/filesystem/lock_handler.rst +++ b/components/filesystem/lock_handler.rst @@ -48,15 +48,19 @@ the file, so you can pass any value for this argument. to avoid name collisions, ``LockHandler`` also appends a hash to the name of the lock file. -By default, the lock will be created in the temporary directory, but you can -optionally select the directory where locks are created by passing it as the -second argument of the constructor. +By default, the lock will be created in the system's temporary directory, but +you can optionally select the directory where locks are created by passing it as +the second argument of the constructor. .. tip:: Another way to configure the directory where the locks are created is to - define the ``TMPDIR`` environment variable. This is useful for example when - deploying a third-party Symfony application whose code can't be modified. + define a special environment variable, because PHP will use that value to + override the default temporary directory. In Unix-based systems, define the + ``TMPDIR`` variable. In Windows systems, define any of these variables: + ``TMP``, ``TEMP`` or ``USERPROFILE`` (they are checked in this order). This + technique is useful for example when deploying a third-party Symfony + application whose code can't be modified. The :method:`Symfony\\Component\\Filesystem\\LockHandler::lock` method tries to acquire the lock. If the lock is acquired, the method returns ``true``, From 6421abfcfdebb2fe15c985851e0e6a50e5675d83 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 8 Dec 2016 22:22:18 +0100 Subject: [PATCH 3/3] Fixed some typos --- components/filesystem/lock_handler.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/filesystem/lock_handler.rst b/components/filesystem/lock_handler.rst index 07dda34f8ab..522b0a29507 100644 --- a/components/filesystem/lock_handler.rst +++ b/components/filesystem/lock_handler.rst @@ -56,8 +56,8 @@ the second argument of the constructor. Another way to configure the directory where the locks are created is to define a special environment variable, because PHP will use that value to - override the default temporary directory. In Unix-based systems, define the - ``TMPDIR`` variable. In Windows systems, define any of these variables: + override the default temporary directory. On Unix-based systems, define the + ``TMPDIR`` variable. On Windows systems, define any of these variables: ``TMP``, ``TEMP`` or ``USERPROFILE`` (they are checked in this order). This technique is useful for example when deploying a third-party Symfony application whose code can't be modified.