Bug #18279 » 20080222_lock_nocache.diff

Administrator Admin, 2008-02-22 20:20

View differences:

t3lib/class.t3lib_lock.php (working copy)
141 141
						$i++;
142 142
						usleep($this->step*1000);
143 143
						clearstatcache();
144
						t3lib_div::sysLog('Page is locked', 'cms', 0);
144 145
						if (!is_file($this->id)) {	// Lock became free, leave the loop
145 146
							$noWait = false;
146 147
							break;
typo3/sysext/cms/tslib/class.tslib_fe.php (working copy)
2730 2730
	 */
2731 2731
	function acquirePageGenerationLock(&$lockObj, $key)	{
2732 2732
		if ($this->no_cache || $this->headerNoCache()) {
2733
			t3lib_div::sysLog('Page is uncached, so no lock needed', 'cms', 0);
2733 2734
			return true;	// No locking is needed if caching is disabled
2734 2735
		}
2735 2736

  
......
2744 2745
					// true = Page could get locked without blocking
2745 2746
					// false = Page could get locked but process was blocked before
2746 2747
				$success = $lockObj->acquire();
2748
				t3lib_div::sysLog('Acquiring a lock', 'cms', 0);
2747 2749
			}
2748 2750
		} catch (Exception $e) {
2749 2751
			t3lib_div::sysLog('Locking failed: '.$e->getMessage(), 'cms', 3);
......
2757 2759
	 * Release the page generation lock
2758 2760
	 *
2759 2761
	 * @param	object		Reference to a locking object
2762
	 * @param	boolean		If true, attempts to release a lock even if the page is uncached. Useful when an extension sets TSFE->set_no_cache().
2760 2763
	 * @return	boolean		Returns true on success, false otherwise
2761 2764
	 * @see acquirePageGenerationLock()
2762 2765
	 */
2763
	function releasePageGenerationLock(&$lockObj)	{
2764
		if ($this->no_cache || $this->headerNoCache()) {
2766
	function releasePageGenerationLock(&$lockObj, $ignoreNoCache=0)	{
2767
		if (($this->no_cache || $this->headerNoCache()) && !$ignoreNoCache) {
2768
			t3lib_div::sysLog('Page is uncached so no lock to release.', 'cms', 0);
2765 2769
			return true;	// No locking is needed if caching is disabled
2766 2770
		}
2767 2771

  
2768 2772
		$success = false;
2769 2773
		if (is_object($lockObj)) {
2770 2774
			$success = $lockObj->release();
2775
			t3lib_div::sysLog('Lock released', 'cms', 0);
2771 2776
			unset($lockObj);
2772 2777
		}
2773 2778

  
......
4087 4092
	 */
4088 4093
	function set_no_cache()	{
4089 4094
		$this->no_cache = 1;
4095
			// Release open locks
4096
		$this->releasePageGenerationLock($this->pagesection_lockObj, true);
4097
		$this->releasePageGenerationLock($this->pages_lockObj, true);
4090 4098
	}
4091 4099

  
4092 4100
	/**
(1-1/4)