com web/windows: Lock the cache access for generation and reading: include/listing.php
| From: | Anatol Belski | Date: | Wed, 06 Feb 2019 04:14:57 +0000 |
| Subject: | com web/windows: Lock the cache access for generation and reading: include/listing.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-27772@lists.php.net to get a copy of this message | ||
Commit: f4687db1594b518d25a23ab91067af9c384eaecc
Author: Anatol Belski <ab@php.net> Tue, 5 Feb 2019 20:14:57 -0800
Parents: be611654442bc7c96814e2a65345ec08e88ca5ef
Branches: master
Link: http://git.php.net/?p=web/windows.git;a=commitdiff;h=f4687db1594b518d25a23ab91067af9c384eaecc
Log:
Lock the cache access for generation and reading
That's not nice. But otherwise partial web.config and others might be
generated.
Changed paths:
M include/listing.php
Diff:
diff --git a/include/listing.php b/include/listing.php
index ffa41a4..08625b0 100644
--- a/include/listing.php
+++ b/include/listing.php
@@ -86,7 +86,12 @@ function parse_file_name($v)
}
function generate_listing($path, $nmode) {
+ $lck = fopen(DATA_DIR . DIRECTORY_SEPARATOR . "site_generate_listing.lock",
"wb");
+ flock($lck, LOCK_EX);
+
if (file_exists($path . '/cache.info')) {
+ flock($lck, LOCK_UN);
+ fclose($lck);
include $path . '/cache.info';
return $releases;
}
@@ -210,6 +215,9 @@ function generate_listing($path, $nmode) {
generate_latest_releases_html($releases);
}
+ flock($lck, LOCK_UN);
+ fclose($lck);
+
return $releases;
}