DevHeads.net

com web/windows: Lock the cache access for generation and reading: include/listing.php

Link: <a href="http://git.php.net/?p=web/windows.git;a=commitdiff;h=f4687db1594b518d25a23ab91067af9c384eaecc" title="http://git.php.net/?p=web/windows.git;a=commitdiff;h=f4687db1594b518d25a23ab91067af9c384eaecc">http://git.php.net/?p=web/windows.git;a=commitdiff;h=f4687db1594b518d25a...</a>

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;
}