16812_02.diff

Administrator Admin, 2011-01-13 22:25

Download (7.5 kB)

 
t3lib/config_default.php (working copy)
146 146
						'cacheTable' => 'cachingframework_cache_pagesection',
147 147
						'tagsTable' => 'cachingframework_cache_pagesection_tags',
148 148
					)
149
				)
149
				),
150
				'cache_runtime' => array(
151
					'frontend' => 't3lib_cache_frontend_VariableFrontend',
152
					'backend' => 't3lib_cache_backend_TransientMemoryBackend',
153
					'options' => array(),
154
				),
150 155
			)
151 156
		),
152 157
		'useCachingFramework' => FALSE,			// Boolean: Enable this if you want to use the caching framework by default for the core caches cache_pages, cache_pagesection and cache_hash.
t3lib/class.t3lib_cache.php (working copy)
109 109
	}
110 110

  
111 111
	/**
112
	 * Initializes the cache_runtime cache.
113
	 * This cache is designed to cache data which is only valid for one request.
114
	 *
115
	 * @return void
116
	 * @author Christian Kuhn <lolli@schwarzbu.ch>
117
	 */
118
	public static function initRuntimeCache() {
119
		try {
120
			$GLOBALS['typo3CacheFactory']->create(
121
				'cache_runtime',
122
				$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_runtime']['frontend'],
123
				$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_runtime']['backend'],
124
				$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_runtime']['options']
125
			);
126
		} catch (t3lib_cache_exception_DuplicateIdentifier $e) {
127
			// do nothing, a cache_hash cache already exists
128
		}
129
	}
130

  
131
	/**
112 132
	 * Determines whether the caching framework is initialized.
113 133
	 * The caching framework could be disabled for the core but used by an extension.
114 134
	 *
......
150 170
	include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_cache.php']);
151 171
}
152 172

  
153
?>
173
?>
typo3/init.php (working copy)
241 241
	t3lib_cache::initPageCache();
242 242
	t3lib_cache::initPageSectionCache();
243 243
	t3lib_cache::initContentHashCache();
244
	t3lib_cache::initRuntimeCache();
244 245
}
245 246
// *************************
246 247
// CLI dispatch processing
......
461 462
	ob_start('ob_gzhandler');
462 463
}
463 464

  
464
?>
465
?>
typo3/sysext/cms/tslib/class.tslib_fe.php (working copy)
604 604

  
605 605
			t3lib_cache::initPageSectionCache();
606 606
			t3lib_cache::initContentHashCache();
607
			t3lib_cache::initRuntimeCache();
607 608

  
608 609
			$GLOBALS['TT']->pull();
609 610
		}
typo3/sysext/cms/tslib/class.tslib_content.php (working copy)
5719 5719
							foreach ($targetPageRootline as $data) {
5720 5720
								$targetPageRootlinePids[] = intval($data['uid']);
5721 5721
							}
5722
							$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
5723
								'pid, domainName, forced',
5724
								'sys_domain',
5725
								'pid IN (' . implode(',', $targetPageRootlinePids) . ') ' . ' AND redirectTo=\'\' ' . $this->enableFields('sys_domain'),
5726
								'',
5727
								'sorting ASC'
5728
							);
5729
								// TODO maybe it makes sense to hold all sys_domain records in a cache to save additional DB querys on each typolink
5730
							while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
5731
								$foundDomains[] = preg_replace('/\/$/', '', $row['domainName']);
5732
								if (!isset($firstFoundDomains[$row['pid']])) {
5733
									$firstFoundDomains[$row['pid']] = preg_replace('/\/$/', '', $row['domainName']);
5722
							if (TYPO3_UseCachingFramework) {
5723
								$entryIdentifier = 'sys_domain_' . sha1(implode('', $targetPageRootlinePids));
5724
								$runtimeCache = $GLOBALS['typo3CacheManager']->getCache('cache_runtime');
5725
								if ($runtimeCache->has($entryIdentifier)) {
5726
									$entry = $runtimeCache->get($entryIdentifier);
5727
									$foundDomains = $entry['foundDomains'];
5728
									$firstFoundDomains = $entry['firstFoundDomains'];
5729
									$firstFoundForcedDomains = $entry['firstFoundForcedDomains'];
5730
									$targetPageRootlinePids = $entry['targetPageRootlinePids'];
5731
								} else {
5732
									$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
5733
										'pid, domainName, forced',
5734
										'sys_domain',
5735
										'pid IN (' . implode(',', $targetPageRootlinePids) . ') ' . ' AND redirectTo=\'\' ' . $this->enableFields('sys_domain'),
5736
										'',
5737
										'sorting ASC'
5738
									);
5739
										// TODO maybe it makes sense to hold all sys_domain records in a cache to save additional DB querys on each typolink
5740
									while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
5741
										$foundDomains[] = preg_replace('/\/$/', '', $row['domainName']);
5742
										if (!isset($firstFoundDomains[$row['pid']])) {
5743
											$firstFoundDomains[$row['pid']] = preg_replace('/\/$/', '', $row['domainName']);
5744
										}
5745
										if ($row['forced'] && !isset($firstFoundForcedDomains[$row['pid']])) {
5746
											$firstFoundForcedDomains[$row['pid']] = preg_replace('/\/$/', '', $row['domainName']);
5747
										}
5748
									}
5749
									$GLOBALS['TYPO3_DB']->sql_free_result($res);
5750
									$runtimeCache->set(
5751
										$entryIdentifier,
5752
										array(
5753
											'foundDomains' => $foundDomains,
5754
											'firstFoundDomains' => $firstFoundDomains,
5755
											'firstFoundForcedDomains' => $firstFoundForcedDomains,
5756
											'targetPageRootlinePids' => $targetPageRootlinePids,
5757
										)
5758
									);
5734 5759
								}
5735
								if ($row['forced'] && !isset($firstFoundForcedDomains[$row['pid']])) {
5736
									$firstFoundForcedDomains[$row['pid']] = preg_replace('/\/$/', '', $row['domainName']);
5760
							} else {
5761
								$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
5762
									'pid, domainName, forced',
5763
									'sys_domain',
5764
									'pid IN (' . implode(',', $targetPageRootlinePids) . ') ' . ' AND redirectTo=\'\' ' . $this->enableFields('sys_domain'),
5765
									'',
5766
									'sorting ASC'
5767
								);
5768
									// TODO maybe it makes sense to hold all sys_domain records in a cache to save additional DB querys on each typolink
5769
								while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
5770
									$foundDomains[] = preg_replace('/\/$/', '', $row['domainName']);
5771
									if (!isset($firstFoundDomains[$row['pid']])) {
5772
										$firstFoundDomains[$row['pid']] = preg_replace('/\/$/', '', $row['domainName']);
5773
									}
5774
									if ($row['forced'] && !isset($firstFoundForcedDomains[$row['pid']])) {
5775
										$firstFoundForcedDomains[$row['pid']] = preg_replace('/\/$/', '', $row['domainName']);
5776
									}
5737 5777
								}
5778
								$GLOBALS['TYPO3_DB']->sql_free_result($res);
5738 5779
							}
5739
							$GLOBALS['TYPO3_DB']->sql_free_result($res);
5740 5780

  
5741 5781
								// Set targetDomain to first found domain record if the target page cannot be reached within the current domain
5742 5782
							if (count($foundDomains) > 0 && (!in_array($currentDomain, $foundDomains) || count($firstFoundForcedDomains) > 0)) {
......
8193 8233
	include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['tslib/class.tslib_content.php']);
8194 8234
}
8195 8235

  
8196
?>
8236
?>