Project

General

Profile

« Previous | Next » 

Revision 1893

Added by Dietmar over 11 years ago

  1. little issue on handing the cache in TranslationTable
  2. fix missing block or block0 issue in /admin/pages/section.php

View differences:

TranslationTable.php
80 80
 */	
81 81
	public function load($sAdaptor)
82 82
	{
83
		$sCachePath	= $this->getCachePath();
84
		$sCacheFile = $sCachePath.md5($this->sAddon.$this->sSystemLang.
85
		                              $this->sDefaultLang.$this->sUserLang).'.php';
83
		$sCacheFile = '';
84
		if($this->bUseCache) {
85
			$sCachePath	= $this->getCachePath();
86
			$sCacheFile = $sCachePath.md5($this->sAddon.$this->sSystemLang.
87
										  $this->sDefaultLang.$this->sUserLang).'.php';
88
		}
86 89
		if($this->bUseCache && is_readable($sCacheFile)) {
87
			$this->aTranslations = $this->loadCacheFile($sCacheFile);
90
				$this->aTranslations = $this->loadCacheFile($sCacheFile);
88 91
		}else {
89 92
			$bLanguageFound = false;
90 93
			$oAdaptor= new $sAdaptor($this->sAddon);
......
147 150
				                                    $this->aLanguages['system'],
148 151
				                                    $this->aLanguages['default'],
149 152
				                                    $this->aLanguages['user']);
150
				if($this->bUseCache) {
151
					$this->writeCacheFile($sCacheFile);
152
				}
153
				$this->writeCacheFile($sCacheFile);
153 154
			}
154 155
		}
155 156
		return $this;
......
242 243
 */	
243 244
	protected function writeCacheFile($sCacheFile)
244 245
	{
245
		$sOutput = '<?php'."\n".'/* autogenerated cachefile */'."\n";
246
		while (list($key, $value) = each($this->aTranslations)) {
247
			$sOutput .= '$aTranslation[\''.$key.'\'] = \''.addslashes($value).'\';'."\n";
246
		if($this->bUseCache) {
247
			$sOutput = '<?php'."\n".'/* autogenerated cachefile */'."\n";
248
			while (list($key, $value) = each($this->aTranslations)) {
249
				$sOutput .= '$aTranslation[\''.$key.'\'] = \''.addslashes($value).'\';'."\n";
250
			}
251
			file_put_contents($sCacheFile, $sOutput, LOCK_EX);
248 252
		}
249
		file_put_contents($sCacheFile, $sOutput, LOCK_EX);
250 253
	}
251 254
} // end of class TranslationTable

Also available in: Unified diff