Bug #18279 » 20080222_lock_nocache.diff
t3lib/class.t3lib_lock.php (working copy) | ||
---|---|---|
$i++;
|
||
usleep($this->step*1000);
|
||
clearstatcache();
|
||
t3lib_div::sysLog('Page is locked', 'cms', 0);
|
||
if (!is_file($this->id)) { // Lock became free, leave the loop
|
||
$noWait = false;
|
||
break;
|
typo3/sysext/cms/tslib/class.tslib_fe.php (working copy) | ||
---|---|---|
*/
|
||
function acquirePageGenerationLock(&$lockObj, $key) {
|
||
if ($this->no_cache || $this->headerNoCache()) {
|
||
t3lib_div::sysLog('Page is uncached, so no lock needed', 'cms', 0);
|
||
return true; // No locking is needed if caching is disabled
|
||
}
|
||
... | ... | |
// true = Page could get locked without blocking
|
||
// false = Page could get locked but process was blocked before
|
||
$success = $lockObj->acquire();
|
||
t3lib_div::sysLog('Acquiring a lock', 'cms', 0);
|
||
}
|
||
} catch (Exception $e) {
|
||
t3lib_div::sysLog('Locking failed: '.$e->getMessage(), 'cms', 3);
|
||
... | ... | |
* Release the page generation lock
|
||
*
|
||
* @param object Reference to a locking object
|
||
* @param boolean If true, attempts to release a lock even if the page is uncached. Useful when an extension sets TSFE->set_no_cache().
|
||
* @return boolean Returns true on success, false otherwise
|
||
* @see acquirePageGenerationLock()
|
||
*/
|
||
function releasePageGenerationLock(&$lockObj) {
|
||
if ($this->no_cache || $this->headerNoCache()) {
|
||
function releasePageGenerationLock(&$lockObj, $ignoreNoCache=0) {
|
||
if (($this->no_cache || $this->headerNoCache()) && !$ignoreNoCache) {
|
||
t3lib_div::sysLog('Page is uncached so no lock to release.', 'cms', 0);
|
||
return true; // No locking is needed if caching is disabled
|
||
}
|
||
$success = false;
|
||
if (is_object($lockObj)) {
|
||
$success = $lockObj->release();
|
||
t3lib_div::sysLog('Lock released', 'cms', 0);
|
||
unset($lockObj);
|
||
}
|
||
... | ... | |
*/
|
||
function set_no_cache() {
|
||
$this->no_cache = 1;
|
||
// Release open locks
|
||
$this->releasePageGenerationLock($this->pagesection_lockObj, true);
|
||
$this->releasePageGenerationLock($this->pages_lockObj, true);
|
||
}
|
||
/**
|