From 8231c039edb45ead97bde5b0a0b96b2b24b28768 Mon Sep 17 00:00:00 2001 From: tsimmons Date: Thu, 5 Jan 2017 15:56:24 -0600 Subject: [PATCH 1/2] Close lockfile handle before trying to unlink during update. --- update.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/update.php b/update.php index f17436185..ec6875971 100755 --- a/update.php +++ b/update.php @@ -404,6 +404,8 @@ PluginHost::getInstance()->run_commands($options); - if (file_exists(LOCK_DIRECTORY . "/$lock_filename")) + if (file_exists(LOCK_DIRECTORY . "/$lock_filename")) { + fclose($lock_handle); unlink(LOCK_DIRECTORY . "/$lock_filename"); + } ?> From 9973b13e197eb7fef58dbcb25744757c2788781e Mon Sep 17 00:00:00 2001 From: tsimmons Date: Fri, 6 Jan 2017 11:06:09 -0600 Subject: [PATCH 2/2] Make sure we are running on Windows before fclose() to avoid race condition possible in Nix. --- update.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/update.php b/update.php index ec6875971..65cf9f06e 100755 --- a/update.php +++ b/update.php @@ -404,8 +404,8 @@ PluginHost::getInstance()->run_commands($options); - if (file_exists(LOCK_DIRECTORY . "/$lock_filename")) { - fclose($lock_handle); + if (file_exists(LOCK_DIRECTORY . "/$lock_filename")) + if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') + fclose($lock_handle); unlink(LOCK_DIRECTORY . "/$lock_filename"); - } ?>