From: <var...@us...> - 2021-06-09 15:25:02
|
Revision: 10279 http://sourceforge.net/p/phpwiki/code/10279 Author: vargenau Date: 2021-06-09 15:24:58 +0000 (Wed, 09 Jun 2021) Log Message: ----------- Use LOCK_SH & LOCK_EX instead of numbers Modified Paths: -------------- trunk/lib/WikiDB/backend/file.php trunk/lib/WikiDB/backend/flatfile.php Modified: trunk/lib/WikiDB/backend/file.php =================================================================== --- trunk/lib/WikiDB/backend/file.php 2021-06-09 14:08:42 UTC (rev 10278) +++ trunk/lib/WikiDB/backend/file.php 2021-06-09 15:24:58 UTC (rev 10279) @@ -99,7 +99,7 @@ if (!file_exists($filename)) return NULL; if (!filesize($filename)) return array(); if ($fd = @fopen($filename, "rb")) { - $locked = flock($fd, 1); // Read lock + $locked = flock($fd, LOCK_SH); // Read lock if (!$locked) { ExitWiki("Timeout while obtaining lock. Please try again"); } @@ -124,7 +124,7 @@ { $filename = $this->_pagename2filename($type, $pagename, $version); if ($fd = fopen($filename, 'a+b')) { - $locked = flock($fd, 2); // Exclusive blocking lock + $locked = flock($fd, LOCK_EX); // Exclusive blocking lock if (!$locked) { ExitWiki("Timeout while obtaining lock. Please try again"); } Modified: trunk/lib/WikiDB/backend/flatfile.php =================================================================== --- trunk/lib/WikiDB/backend/flatfile.php 2021-06-09 14:08:42 UTC (rev 10278) +++ trunk/lib/WikiDB/backend/flatfile.php 2021-06-09 15:24:58 UTC (rev 10279) @@ -64,7 +64,7 @@ if (!file_exists($filename)) return NULL; if (!filesize($filename)) return array(); if ($fd = @fopen($filename, "rb")) { - $locked = flock($fd, 1); // Read lock + $locked = flock($fd, LOCK_SH); // Read lock if (!$locked) { ExitWiki("Timeout while obtaining lock. Please try again"); } @@ -174,7 +174,7 @@ $pagedata .= MimeifyPageRevision($page, $current); if ($fd = fopen($filename, 'a+b')) { - $locked = flock($fd, 2); // Exclusive blocking lock + $locked = flock($fd, LOCK_EX); // Exclusive blocking lock if (!$locked) { ExitWiki("Timeout while obtaining lock. Please try again"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |